net: move interface removal notification up in if_detach_internal
This is needed to prevent having interfaces with ifp->if_addr == NULL on bridge interfaces. Moving the notification event handlers up makes sure the interfaces are removed before doing any more cleanup. Sponsored by: Citrix Systems R&D Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D598 net/if.c - Move interface removal notification up in if_detach_internal.
This commit is contained in:
parent
5e1d15a879
commit
af371fc66a
11
sys/net/if.c
11
sys/net/if.c
@ -874,6 +874,12 @@ if_detach_internal(struct ifnet *ifp, int vmove)
|
||||
#endif
|
||||
if_purgemaddrs(ifp);
|
||||
|
||||
/* Announce that the interface is gone. */
|
||||
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
|
||||
EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
|
||||
if (IS_DEFAULT_VNET(curvnet))
|
||||
devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
|
||||
|
||||
if (!vmove) {
|
||||
/*
|
||||
* Prevent further calls into the device driver via ifnet.
|
||||
@ -911,11 +917,6 @@ if_detach_internal(struct ifnet *ifp, int vmove)
|
||||
}
|
||||
}
|
||||
|
||||
/* Announce that the interface is gone. */
|
||||
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
|
||||
EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
|
||||
if (IS_DEFAULT_VNET(curvnet))
|
||||
devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
|
||||
if_delgroups(ifp);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user