summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2016-06-30 19:32:45 +0000
committerbz <bz@FreeBSD.org>2016-06-30 19:32:45 +0000
commit2af4ea8fc23a52e81375e66341be2d2596a3fb68 (patch)
treed95ffe943fa2d9c93e3dcfb052ac8fbf16c2dad3
parent0c1171f994c5ad66aa192de0cc43b326e8cee144 (diff)
downloadFreeBSD-src-2af4ea8fc23a52e81375e66341be2d2596a3fb68.zip
FreeBSD-src-2af4ea8fc23a52e81375e66341be2d2596a3fb68.tar.gz
In case of the global eventhandler make sure the current VNET
is still operational before doing any work; otherwise we might run into, e.g., destroyed locks. PR: 210724 Reported by: olevole olevole.ru Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Obtained from: projects/vnet Approved by: re (gjb)
-rw-r--r--sys/netpfil/ipfw/ip_fw_nat.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c
index eb61021..cb816f7 100644
--- a/sys/netpfil/ipfw/ip_fw_nat.c
+++ b/sys/netpfil/ipfw/ip_fw_nat.c
@@ -104,6 +104,10 @@ ifaddr_change(void *arg __unused, struct ifnet *ifp)
KASSERT(curvnet == ifp->if_vnet,
("curvnet(%p) differs from iface vnet(%p)", curvnet, ifp->if_vnet));
+
+ if (V_ipfw_vnet_ready == 0 || V_ipfw_nat_ready == 0)
+ return;
+
chain = &V_layer3_chain;
IPFW_UH_WLOCK(chain);
/* Check every nat entry... */
@@ -1145,12 +1149,12 @@ vnet_ipfw_nat_uninit(const void *arg __unused)
chain = &V_layer3_chain;
IPFW_WLOCK(chain);
+ V_ipfw_nat_ready = 0;
LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) {
LIST_REMOVE(ptr, _next);
free_nat_instance(ptr);
}
flush_nat_ptrs(chain, -1 /* flush all */);
- V_ipfw_nat_ready = 0;
IPFW_WUNLOCK(chain);
return (0);
}
OpenPOWER on IntegriCloud