From 4dfc14961006b0702d1c5e18190b3fcd64dd4d76 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Sun, 6 Oct 2013 21:39:13 +0200 Subject: Make sure send and receive buffers actually do get set --- config/unbound/unbound.inc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'config/unbound') diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index c3de2f88..9c38fa2e 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -546,6 +546,7 @@ harden-dnssec-stripped: {$harden_dnssec_stripped} {$optimization['rrset_cache_size']} outgoing-range: 8192 {$optimization['so_rcvbuf']} +{$optimization['so_sndbuf']} # Interface IP(s) to bind to {$unbound_bind_interfaces} @@ -648,20 +649,21 @@ function unbound_optimization() { // 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); + if ($tunable['value'] == 'default') + $maxsockbuf = '4262144'; + else + $maxsockbuf = $tunable['value']; + $so = floor(($maxsockbuf/1024/1024)-1); // Check to ensure that the number is not a negative if ($so > 0) { $optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m"; $optimization['so_sndbuf'] = "so-sndbuf: {$so}m"; } else { - unset($optimization['so_rcvbuf']); - unset($optimization['so_sndbuf']); + $optimization['so_rcvbuf'] = "#so-rcvbuf: 4m"; + $optimization['so_sndbuf'] = "#so-sndbuf: 4m"; } } } - // Safety check in case kern.ipc.maxsockbuf is deleted. - if(!isset($optimization['so_rcvbuf'])) - $optimization['so_rcvbuf'] = "#so-rcvbuf: 4m"; return $optimization; } -- cgit v1.2.3