PERFORCE change 124733 for review

Marko Zec zec at FreeBSD.org
Sun Aug 5 09:15:53 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=124733

Change 124733 by zec at zec_tpx32 on 2007/08/05 16:15:25

	When detaching an ifnet clear its if_vnet field, so that
	we know it's a homeless entity until it gets reattached.
	
	Do not announce ifnet events to devctl/devd, except for
	ifnets attached to the default vnet (vnet_0).

Affected files ...

.. //depot/projects/vimage/src/sys/net/if.c#19 edit

Differences ...

==== //depot/projects/vimage/src/sys/net/if.c#19 (text+ko) ====

@@ -490,7 +490,7 @@
 void
 if_free_type(struct ifnet *ifp, u_char type)
 {
-	INIT_VNET_NET(ifp->if_vnet);
+	INIT_VNET_NET(curvnet); /* ifp->if_vnet can be NULL here ! */
 
 	if (ifp != ifnet_byindex(ifp->if_index)) {
 		if_printf(ifp, "%s: value was not if_alloced, skipping\n",
@@ -631,6 +631,9 @@
 		if_attachdomain1(ifp);
 
 	EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
+#ifdef VIMAGE
+	if (IS_VNET_0(curvnet))
+#endif
 	devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL);
 
 	/* Announce the interface. */
@@ -850,6 +853,9 @@
 	/* Announce that the interface is gone. */
 	rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
 	EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
+#ifdef VIMAGE
+	if (IS_VNET_0(curvnet))
+#endif
 	devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
 
 	IF_AFDATA_LOCK(ifp);
@@ -868,6 +874,9 @@
 	knlist_destroy(&ifp->if_klist);
 	mtx_destroy(&ifp->if_snd.ifq_mtx);
 	IF_AFDATA_DESTROY(ifp);
+#ifdef VIMAGE
+	ifp->if_vnet = NULL;
+#endif
 	splx(s);
 }
 
@@ -1509,6 +1518,9 @@
 		(*lagg_linkstate_p)(ifp, link_state);
 	}
 
+#ifdef VIMAGE
+	if (IS_VNET_0(curvnet))
+#endif
 	devctl_notify("IFNET", ifp->if_xname,
 	    (link_state == LINK_STATE_UP) ? "LINK_UP" : "LINK_DOWN", NULL);
 	if (pending > 1)


More information about the p4-projects mailing list