PERFORCE change 119185 for review
Marko Zec
zec at FreeBSD.org
Wed May 2 21:40:16 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119185
Change 119185 by zec at 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);
More information about the p4-projects
mailing list