summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/net/if.c16
-rw-r--r--sys/net/rtsock.c2
2 files changed, 13 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 7e4df75..33adc50 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2512,21 +2512,27 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiaddr *ifma, int detaching)
/*
* If the ifnet is detaching, null out references to ifnet,
* so that upper protocol layers will notice, and not attempt
- * to obtain locks for an ifnet which no longer exists.
- * It is OK to call rt_newmaddrmsg() with a NULL ifp.
+ * to obtain locks for an ifnet which no longer exists. The
+ * routing socket announcement must happen before the ifnet
+ * instance is detached from the system.
*/
if (detaching) {
#ifdef DIAGNOSTIC
printf("%s: detaching ifnet instance %p\n", __func__, ifp);
#endif
- ifma->ifma_ifp = NULL;
+ /*
+ * ifp may already be nulled out if we are being reentered
+ * to delete the ll_ifma.
+ */
+ if (ifp != NULL) {
+ rt_newmaddrmsg(RTM_DELMADDR, ifma);
+ ifma->ifma_ifp = NULL;
+ }
}
if (--ifma->ifma_refcount > 0)
return 0;
- rt_newmaddrmsg(RTM_DELMADDR, ifma);
-
/*
* If this ifma is a network-layer ifma, a link-layer ifma may
* have been associated with it. Release it first if so.
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 16b94ad..8394786 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -964,6 +964,8 @@ rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma)
if (m == NULL)
return;
ifmam = mtod(m, struct ifma_msghdr *);
+ KASSERT(ifp != NULL, ("%s: link-layer multicast address w/o ifp\n",
+ __func__));
ifmam->ifmam_index = ifp->if_index;
ifmam->ifmam_addrs = info.rti_addrs;
rt_dispatch(m, ifma->ifma_addr);
OpenPOWER on IntegriCloud