Properly set VNET when nuking recvif from fragment queues.

In theory the eventhandler invoke should be in the same VNET as
the the current interface. We however cannot guarantee that for
all cases in the future.

So before checking if the fragmentation handling for this VNET
is active, switch the VNET to the VNET of the interface to always
get the one we want.

Reviewed by:	hselasky
MFC after:	3 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D22153
This commit is contained in:
Bjoern A. Zeeb 2019-10-25 18:54:06 +00:00
parent ecd9fdeb46
commit 6e6b5143f5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354092
2 changed files with 9 additions and 4 deletions

View File

@ -632,14 +632,17 @@ ipreass_cleanup(void *arg __unused, struct ifnet *ifp)
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
CURVNET_SET_QUIET(ifp->if_vnet);
/*
* Skip processing if IPv4 reassembly is not initialised or
* torn down by ipreass_destroy().
*/
if (V_ipq_zone == NULL)
if (V_ipq_zone == NULL) {
CURVNET_RESTORE();
return;
}
CURVNET_SET_QUIET(ifp->if_vnet);
for (i = 0; i < IPREASS_NHASH; i++) {
IPQ_LOCK(i);
/* Scan fragment list. */

View File

@ -307,16 +307,18 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp)
KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
CURVNET_SET_QUIET(ifp->if_vnet);
#ifdef VIMAGE
/*
* Skip processing if IPv6 reassembly is not initialised or
* torn down by frag6_destroy().
*/
if (!V_frag6_on)
if (!V_frag6_on) {
CURVNET_RESTORE();
return;
}
#endif
CURVNET_SET_QUIET(ifp->if_vnet);
for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) {
IP6QB_LOCK(bucket);
head = IP6QB_HEAD(bucket);