diff options
author | Ermal <eri@pfsense.org> | 2014-11-10 21:47:14 +0100 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-11-10 21:47:14 +0100 |
commit | d87fcac96b45958bd777c7ac38cc0665dbde6062 (patch) | |
tree | 599a680c39d7db4a859595b17fe65b948def3dc9 /etc/inc/unbound.inc | |
parent | 24d728bb4feb848b10d42a81df0e0a92dd599764 (diff) | |
download | pfsense-d87fcac96b45958bd777c7ac38cc0665dbde6062.zip pfsense-d87fcac96b45958bd777c7ac38cc0665dbde6062.tar.gz |
Do not require the default sysctl items to be set on the config.xml but rather extract the definitions from the sysctl tree. Also to reduce config.xml size
Diffstat (limited to 'etc/inc/unbound.inc')
-rw-r--r-- | etc/inc/unbound.inc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index 4088035..b047346 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -79,14 +79,16 @@ function unbound_optimization() { * Larger socket buffer for busy servers * Check that it is set to 4MB (by default the OS has it configured to 4MB) */ - foreach ($config['sysctl']['item'] as $tunable) { - if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') { - $so = floor(($tunable['value']/1024/1024)-1); - // Check to ensure that the number is not a negative - if ($so > 0) - $optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m"; - else - unset($optimization['so_rcvbuf']); + if (is_array($config['sysctl']) && is_array($config['sysctl']['item'])) { + foreach ($config['sysctl']['item'] as $tunable) { + if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') { + $so = floor(($tunable['value']/1024/1024)-1); + // Check to ensure that the number is not a negative + if ($so > 0) + $optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m"; + else + unset($optimization['so_rcvbuf']); + } } } // Safety check in case kern.ipc.maxsockbuf is not available. |