From 4c103fdad9f95e4c3bf09e438ffc678209383f35 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 22 May 2016 12:47:29 +0200 Subject: [PATCH 208/257] ipfw: Prefill the dynamic rule zone and prevent uma from freeing unused items Obtained from: ElectroBSD PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209680 --- sys/netpfil/ipfw/ip_fw_dynamic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_fw_dynamic.c b/sys/netpfil/ipfw/ip_fw_dynamic.c index 7dd72e47dd9e..f1fda48d28a6 100644 --- a/sys/netpfil/ipfw/ip_fw_dynamic.c +++ b/sys/netpfil/ipfw/ip_fw_dynamic.c @@ -1399,11 +1399,14 @@ ipfw_dyn_init(struct ip_fw_chain *chain) V_ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0); + UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Enforce limit on dynamic rules */ uma_zone_set_max(V_ipfw_dyn_rule_zone, V_dyn_max); + /* Prefill the zone to make sure the limit is always reachable */ + uma_prealloc(V_ipfw_dyn_rule_zone, V_dyn_max); + callout_init(&V_ipfw_timeout, 1); /* -- 2.11.0