Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Apr 2007 22:35:47 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 118758 for review
Message-ID:  <200704242235.l3OMZlkX033326@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=118758

Change 118758 by zec@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;
 }



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