PERFORCE change 118758 for review

Marko Zec zec at FreeBSD.org
Tue Apr 24 22:35:49 UTC 2007


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

Change 118758 by zec at zec_tca51 on 2007/04/24 22:35:11

	A hack to allow for lo0 to be destroyed when cleaning up
	a vnet instance.

Affected files ...

.. //depot/projects/vimage/src/sys/net/if_loop.c#12 edit

Differences ...

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

@@ -211,12 +211,24 @@
 static int vnet_loif_idetach(void)
 {
 	INIT_VNET_NET(curvnet);
-	struct lo_softc *lop, *nlop;
+	struct lo_softc *sc, *nsc;
+
+	LIST_FOREACH_SAFE(sc, &V_lo_list, sc_next, nsc) {
+		struct ifnet *ifp = sc->sc_ifp;
 
-	LIST_FOREACH_SAFE(lop, &V_lo_list, sc_next, nlop) {
-		if (lop->sc_ifp == V_loif)
+		if (ifp == V_loif) {
+			/*
+			 * A hack to allow lo0 to be detached:
+			 * bump if_unit number from 0 to 1.  By 
+			 * setting V_loif to NULL we prevent queuing
+			 * of routing messages that would have
+			 * m_pkthdr.rcvif pointing to a nonexisting
+			 * ifnet, i.e. the lo0 we just destroyed.
+			 */
+			ifp->if_dunit = 1;
 			V_loif = NULL;
-		lo_clone_destroy(lop->sc_ifp);
+		}
+		if_clone_destroy(ifp->if_xname);
 	}
 	return 0;
 }


More information about the p4-projects mailing list