diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2017-01-28 20:00:45 -0600 |
---|---|---|
committer | Luiz Souza <luiz@netgate.com> | 2017-07-17 20:11:44 -0500 |
commit | 29a346c21cd9bf2913cd4e7d0feaf38ccebcab25 (patch) | |
tree | 346f19a597d6e877fc20a995fcaadbab7726e510 | |
parent | 01a42e5ccbe9da9543ec7e34ff2d7f0343fe083b (diff) | |
download | FreeBSD-src-29a346c21cd9bf2913cd4e7d0feaf38ccebcab25.zip FreeBSD-src-29a346c21cd9bf2913cd4e7d0feaf38ccebcab25.tar.gz |
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).
Found while debugging Ticker #7124
(cherry picked from commit 5eb28c4fe8597d2b7a5ace3de98ba4b762b2e1a8)
-rw-r--r-- | sys/netpfil/pf/pf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 356e802..7c7d5f3 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1612,6 +1612,12 @@ pf_purge_thread(void *unused __unused) continue; } + /* 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. */ idx = pf_purge_expired_states(idx, pf_hashmask / (V_pf_default_rule.timeout[PFTM_INTERVAL] * 10)); |