Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2017 17:15:19 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r321296 - stable/11/sys/netpfil/pf
Message-ID:  <201707201715.v6KHFJrn034829@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Thu Jul 20 17:15:18 2017
New Revision: 321296
URL: https://svnweb.freebsd.org/changeset/base/321296

Log:
  MFC r312943
  
  Do not run the pf purge thread while the VNET variables are not
  initialized, this can cause a divide by zero (if the VNET initialization
  takes to long to complete).
  
  PR:		220830

Modified:
  stable/11/sys/netpfil/pf/pf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf.c
==============================================================================
--- stable/11/sys/netpfil/pf/pf.c	Thu Jul 20 16:24:29 2017	(r321295)
+++ stable/11/sys/netpfil/pf/pf.c	Thu Jul 20 17:15:18 2017	(r321296)
@@ -129,6 +129,8 @@ VNET_DEFINE(int,			 pf_tcp_secret_init);
 #define	V_pf_tcp_secret_init		 VNET(pf_tcp_secret_init)
 VNET_DEFINE(int,			 pf_tcp_iss_off);
 #define	V_pf_tcp_iss_off		 VNET(pf_tcp_iss_off)
+VNET_DECLARE(int,			 pf_vnet_active);
+#define	V_pf_vnet_active		 VNET(pf_vnet_active)
 
 /*
  * Queue for pf_intr() sends.
@@ -1439,6 +1441,12 @@ pf_purge_thread(void *unused __unused)
 			pf_end_threads++;
 			wakeup(pf_purge_thread);
 			kproc_exit(0);
+		}
+
+		/* Wait while V_pf_default_rule.timeout is initialized. */
+		if (V_pf_vnet_active == 0) {
+			CURVNET_RESTORE();
+			continue;
 		}
 
 		/* Process 1/interval fraction of the state table every run. */



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