diff options
author | thompsa <thompsa@FreeBSD.org> | 2007-05-07 00:28:55 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2007-05-07 00:28:55 +0000 |
commit | 46904da6708bef5c82473bee8fa21f4e0d2a8730 (patch) | |
tree | 67b80c585fcd86344d00a12b18ee6d2d44484700 /sys/net/if_lagg.c | |
parent | caab23fd294a310227a4c2f4912f639cdebc28e2 (diff) | |
download | FreeBSD-src-46904da6708bef5c82473bee8fa21f4e0d2a8730.zip FreeBSD-src-46904da6708bef5c82473bee8fa21f4e0d2a8730.tar.gz |
Avoid touching various unsafe parts if the interface is disappearing.
Diffstat (limited to 'sys/net/if_lagg.c')
-rw-r--r-- | sys/net/if_lagg.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index bb23d29..8eddf4c 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -332,7 +332,8 @@ lagg_port_lladdr(struct lagg_port *lp, uint8_t *lladdr) struct ifnet *ifp = lp->lp_ifp; int error; - if (memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0) + if (lp->lp_detaching || + memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0) return; /* Set the link layer address */ @@ -467,9 +468,15 @@ lagg_port_destroy(struct lagg_port *lp, int runpd) if (runpd && sc->sc_port_destroy != NULL) (*sc->sc_port_destroy)(lp); - /* Remove multicast addresses and interface flags from this port */ - lagg_ether_cmdmulti(lp, 0); - lagg_setflags(lp, 0); + /* + * Remove multicast addresses and interface flags from this port and + * reset the MAC address, skip if the interface is being detached. + */ + if (!lp->lp_detaching) { + lagg_ether_cmdmulti(lp, 0); + lagg_setflags(lp, 0); + lagg_port_lladdr(lp, lp->lp_lladdr); + } /* Restore interface */ ifp->if_type = lp->lp_iftype; @@ -499,9 +506,6 @@ lagg_port_destroy(struct lagg_port *lp, int runpd) lagg_port_lladdr(lp_ptr, lladdr); } - /* Reset the port lladdr */ - lagg_port_lladdr(lp, lp->lp_lladdr); - if (lp->lp_ifflags) if_printf(ifp, "%s: lp_ifflags unclean\n", __func__); @@ -598,6 +602,7 @@ lagg_port_ifdetach(void *arg __unused, struct ifnet *ifp) sc = lp->lp_lagg; LAGG_LOCK(sc); + lp->lp_detaching = 1; lagg_port_destroy(lp, 1); LAGG_UNLOCK(sc); } |