Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jun 2016 19:32:45 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302302 - head/sys/netpfil/ipfw
Message-ID:  <201606301932.u5UJWjW8095281@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Thu Jun 30 19:32:45 2016
New Revision: 302302
URL: https://svnweb.freebsd.org/changeset/base/302302

Log:
  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)

Modified:
  head/sys/netpfil/ipfw/ip_fw_nat.c

Modified: head/sys/netpfil/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_nat.c	Thu Jun 30 19:09:44 2016	(r302301)
+++ head/sys/netpfil/ipfw/ip_fw_nat.c	Thu Jun 30 19:32:45 2016	(r302302)
@@ -104,6 +104,10 @@ ifaddr_change(void *arg __unused, struct
 
 	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 __u
 
 	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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606301932.u5UJWjW8095281>