aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-02-22 07:19:43 +0000
committerKristof Provost <kp@FreeBSD.org>2021-02-23 12:54:07 +0000
commitc139b3c19b52abe3b5ba23a8175e58e70c7a528d (patch)
treec3d389c84d8b374c784085515bf24dc6e62a8576
parent38c0951386d82f4c51cf4e245253cdef18d2254a (diff)
downloadsrc-c139b3c19b52abe3b5ba23a8175e58e70c7a528d.tar.gz
src-c139b3c19b52abe3b5ba23a8175e58e70c7a528d.zip
arp/nd: Cope with late calls to iflladdr_event
When tearing down vnet jails we can move an if_bridge out (as part of the normal vnet_if_return()). This can, when it's clearing out its list of member interfaces, change its link layer address. That sends an iflladdr_event, but at that point we've already freed the AF_INET/AF_INET6 if_afdata pointers. In other words: when the iflladdr_event callbacks fire we can't assume that ifp->if_afdata[AF_INET] will be set. Reviewed by: donner@, melifaro@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28860
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--sys/netinet6/nd6.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index e09ad3d47382..ef50ec9ca964 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1479,6 +1479,10 @@ arp_handle_ifllchange(struct ifnet *ifp)
static void
arp_iflladdr(void *arg __unused, struct ifnet *ifp)
{
+ /* if_bridge can update its lladdr during if_vmove(), after we've done
+ * if_detach_internal()/dom_ifdetach(). */
+ if (ifp->if_afdata[AF_INET] == NULL)
+ return;
lltable_update_ifaddr(LLTABLE(ifp));
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 497c0bfc10e8..62f0ac733a23 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -208,6 +208,8 @@ nd6_lle_event(void *arg __unused, struct llentry *lle, int evt)
static void
nd6_iflladdr(void *arg __unused, struct ifnet *ifp)
{
+ if (ifp->if_afdata[AF_INET6] == NULL)
+ return;
lltable_update_ifaddr(LLTABLE6(ifp));
}