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@gmail.com>
Reviewed by:	Lutz Donnerhacke
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25788
This commit is contained in:
Mark Johnston 2020-07-31 14:08:32 +00:00
parent 7c5ec5fe6a
commit 460a9f9d45
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363735

View File

@ -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);
}