From 117f032ccfd67d0cf5b4d0a41f9705abf890937e Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 27 Feb 2019 09:06:54 -0300 Subject: [PATCH] Add net.pf.request_maxcount to loader.conf On FreeBSD 12 and newer pf uses this sysctl to define maximum number of items supported by its allocations. Make sure it's always present in /boot/loader.conf and set it to the same value of config item for system -> maximumtableentries --- src/etc/inc/pfsense-utils.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index d972f36fef..e7c0b891fd 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -1182,7 +1182,8 @@ function load_loader_conf($loader_conf = NULL, $local = false) { /* These values should be removed from loader.conf and loader.conf.local * As they will be replaced when necessary. */ $remove = array("hw.usb.no_pf", "hint.mdio.0.at", "hint.e6000sw.0", - "hw.e6000sw.default_disabled", "vm.pmap.pti"); + "hw.e6000sw.default_disabled", "vm.pmap.pti", + "net.pf.request_maxcount"); if (!$local) { /* These values should only be filtered in loader.conf, not .local */ $remove = array_merge($remove, @@ -1303,6 +1304,13 @@ function setup_loader_settings($path = "", $upgrade = false) { $data[] = 'vm.pmap.pti="0"'; } + if (isset($config['system']['maximumtableentries'])) { + $maximumtableentries = $config['system']['maximumtableentries']; + } else { + $maximumtableentries = pfsense_default_table_entries_size(); + } + $data[] = 'net.pf.request_maxcount="' . $maximumtableentries . '"'; + safe_write_file($loader_conf_file, $data); /* Filter loader.conf.local to avoid duplicate settings. */