Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Apr 2007 19:34:33 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 118598 for review
Message-ID:  <200704221934.l3MJYXBv005300@repoman.freebsd.org>

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

Change 118598 by zec@zec_tca51 on 2007/04/22 19:34:14

	Implement vnet detachment routine for lo0.

Affected files ...

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

Differences ...

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

@@ -107,8 +107,10 @@
 static int	lo_clone_create(struct if_clone *, int, caddr_t);
 static void	lo_clone_destroy(struct ifnet *);
 static int	vnet_loif_iattach(void);
+#ifdef VIMAGE
+static int	vnet_loif_idetach(void);
+#endif
 
-
 #ifndef VIMAGE
 struct ifnet *loif = NULL;			/* Used externally */
 static LIST_HEAD(lo_list, lo_softc) lo_list;
@@ -188,7 +190,7 @@
 	.name		= "loif",
 	.symmap		= NULL,
 	.i_attach	= vnet_loif_iattach,
-	.i_detach	= NULL,
+	.i_detach	= vnet_loif_idetach
 };
 #endif
 
@@ -208,6 +210,21 @@
 	return 0;
 }
 
+#ifdef VIMAGE
+static int vnet_loif_idetach(void)
+{
+	INIT_VNET_NET(curvnet);
+	struct lo_softc *lop, *nlop;
+
+	LIST_FOREACH_SAFE(lop, &V_lo_list, sc_next, nlop) {
+		if (lop->sc_ifp == V_loif)
+			V_loif = NULL;
+		lo_clone_destroy(lop->sc_ifp);
+	}
+	return 0;
+}
+#endif
+
 static int
 loop_modevent(module_t mod, int type, void *data) 
 { 



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