Date: Wed, 2 May 2007 21:40:15 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 119185 for review Message-ID: <200705022140.l42LeF5J017095@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119185 Change 119185 by zec@zec_tpx32 on 2007/05/02 21:39:29 It is possible that an ifnet and a netgraph node it is associated to are attached to different vnets. In netgraph node destructor for such a node/ifnet (ng_iface or ng_eiface) pair, before calling if_detach() we must set the current vnet context to the vnet that our ifnet is associated to. Affected files ... .. //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#4 edit .. //depot/projects/vimage/src/sys/netgraph/ng_iface.c#2 edit Differences ... ==== //depot/projects/vimage/src/sys/netgraph/ng_eiface.c#4 (text+ko) ==== @@ -28,6 +28,8 @@ * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.38 2007/03/08 21:10:53 ru Exp $ */ +#include "opt_vimage.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/errno.h> @@ -38,6 +40,7 @@ #include <sys/sockio.h> #include <sys/socket.h> #include <sys/syslog.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -539,8 +542,10 @@ const priv_p priv = NG_NODE_PRIVATE(node); struct ifnet *const ifp = priv->ifp; + CURVNET_SET_QUIET(ifp->if_vnet); ether_ifdetach(ifp); if_free(ifp); + CURVNET_RESTORE(); free_unr(ng_eiface_unit, priv->unit); FREE(priv, M_NETGRAPH); NG_NODE_SET_PRIVATE(node, NULL); ==== //depot/projects/vimage/src/sys/netgraph/ng_iface.c#2 (text+ko) ==== @@ -56,6 +56,7 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipx.h" +#include "opt_vimage.h" #include <sys/param.h> #include <sys/systm.h> @@ -69,6 +70,7 @@ #include <sys/socket.h> #include <sys/syslog.h> #include <sys/libkern.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_types.h> @@ -766,9 +768,11 @@ { const priv_p priv = NG_NODE_PRIVATE(node); + CURVNET_SET_QUIET(priv->ifp->if_vnet); bpfdetach(priv->ifp); if_detach(priv->ifp); if_free(priv->ifp); + CURVNET_RESTORE(); priv->ifp = NULL; free_unr(ng_iface_unit, priv->unit); FREE(priv, M_NETGRAPH_IFACE);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705022140.l42LeF5J017095>