From 4ece273b951d9a9402e67abc4001aa2211800f22 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Mon, 20 Jul 2015 13:02:58 +0200 Subject: [PATCH] fixed to avoid checking 'iptables' version on BSD systems --- monitorix | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/monitorix b/monitorix index ad01a9b..32efa1d 100755 --- a/monitorix +++ b/monitorix @@ -538,18 +538,20 @@ if(open(OUT, "> " . $config{base_dir} . "/cgi/monitorix.conf.path")) { logger("Unable to create the file '$config{base_dir}/cgi/monitorix.conf.path'. $!"); } -# make sure that 'ip_default_table' option has a consistent value -$config{ip_default_table} = "filter" if !$config{ip_default_table}; +if($config{os} eq "Linux") { + # make sure that 'ip_default_table' option has a consistent value + $config{ip_default_table} = "filter" if !$config{ip_default_table}; -# check 'iptables' version to include the new wait lock option '--wait' -my $ipv = `iptables --version`; -chomp($ipv); -$ipv =~ s/^iptables v//; -$ipv = sprintf("%03s.%03s.%03s", split('\.', $ipv)); -if($ipv gt "001.004.020") { # 1.4.20 - $config{iptables_wait_lock} = " --wait "; -} else { - $config{iptables_wait_lock} = ""; + # check 'iptables' version to include the new wait lock option '--wait' + my $ipv = `iptables --version`; + chomp($ipv); + $ipv =~ s/^iptables v//; + $ipv = sprintf("%03s.%03s.%03s", split('\.', $ipv)); + if($ipv gt "001.004.020") { # 1.4.20 + $config{iptables_wait_lock} = " --wait "; + } else { + $config{iptables_wait_lock} = ""; + } } # make sure that there aren't residual Monitorix iptables rules