svn commit: r363735 - head/sys/netgraph

Mark Johnston markj at FreeBSD.org
Fri Jul 31 14:08:33 UTC 2020


Author: markj
Date: Fri Jul 31 14:08:32 2020
New Revision: 363735
URL: https://svnweb.freebsd.org/changeset/base/363735

Log:
  ng_iface(4): Set the current VNET before calling netisr_dispatch().
  
  This is normally handled by a netgraph thread, but netgraph messages may
  be dispatched directly to a node, in which case no VNET is set before
  ng_iface calls into the network stack.  Netgraph could probably handle
  this more generally, but for now just be sure to set the current VNET in
  ng_iface.
  
  PR:		242406
  Tested by:	Michael Muenz <m.muenz at gmail.com>
  Reviewed by:	Lutz Donnerhacke
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D25788

Modified:
  head/sys/netgraph/ng_iface.c

Modified: head/sys/netgraph/ng_iface.c
==============================================================================
--- head/sys/netgraph/ng_iface.c	Fri Jul 31 12:40:31 2020	(r363734)
+++ head/sys/netgraph/ng_iface.c	Fri Jul 31 14:08:32 2020	(r363735)
@@ -732,9 +732,11 @@ ng_iface_rcvdata(hook_p hook, item_p item)
 	}
 	random_harvest_queue(m, sizeof(*m), RANDOM_NET_NG);
 	M_SETFIB(m, ifp->if_fib);
+	CURVNET_SET(ifp->if_vnet);
 	NET_EPOCH_ENTER(et);
 	netisr_dispatch(isr, m);
 	NET_EPOCH_EXIT(et);
+	CURVNET_RESTORE();
 	return (0);
 }
 


More information about the svn-src-head mailing list