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
This commit is contained in:
Renato Botelho 2019-02-27 09:06:54 -03:00
parent c16a2fe16e
commit 117f032ccf

View File

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