svn commit: r321296 - stable/11/sys/netpfil/pf

Kristof Provost kp at FreeBSD.org
Thu Jul 20 17:15:20 UTC 2017


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. */


More information about the svn-src-all mailing list