Author: royger
Date: Sat Aug 16 10:47:24 2014
New Revision: 270041
URL: http://svnweb.freebsd.org/changeset/base/270041

Log:
  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.

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c   Sat Aug 16 08:38:53 2014        (r270040)
+++ head/sys/net/if.c   Sat Aug 16 10:47:24 2014        (r270041)
@@ -874,6 +874,12 @@ if_detach_internal(struct ifnet *ifp, in
 #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, in
                }
        }
 
-       /* 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);
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to