Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Aug 2014 10:47:25 +0000 (UTC)
From:      Roger Pau Monné <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270041 - head/sys/net
Message-ID:  <201408161047.s7GAlPlj071097@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408161047.s7GAlPlj071097>