added the new option 'ipv6_disabled' (default: no) to disable IPv6 monitoring

This commit is contained in:
Jordi Sanfeliu 2015-08-03 11:22:21 +02:00
parent 517e3bd5d3
commit 065f09588f
3 changed files with 69 additions and 54 deletions

View File

@ -27,6 +27,7 @@
- Added support of Basic Authentication to Wowza graph. [#100] - Added support of Basic Authentication to Wowza graph. [#100]
- Added alert capabilities to Apache graph based on the remaining free slots. - Added alert capabilities to Apache graph based on the remaining free slots.
(suggested by Marco Reale, mlist AT libero.it) (suggested by Marco Reale, mlist AT libero.it)
- Added the new option 'ipv6_disabled' (default: no) to disable IPv6 monitoring.
- Fixed the text color in the bottom URL of the Bind graph. - Fixed the text color in the bottom URL of the Bind graph.
- Fixed the text color in the bottom URL of the Icecast Streaming Server graph. - Fixed the text color in the bottom URL of the Icecast Streaming Server graph.
- Fixed a problem with multiple 'ApplicationInstance' tags in Wowza Server - Fixed a problem with multiple 'ApplicationInstance' tags in Wowza Server

View File

@ -358,6 +358,7 @@ sub flush_accounting_rules {
} }
# IPv6 # IPv6
if(lc($config->{ipv6_disabled}) ne "y") {
undef(@names); undef(@names);
if(open(IN, "$cmd6 -t $table -nxvL INPUT --line-numbers |")) { if(open(IN, "$cmd6 -t $table -nxvL INPUT --line-numbers |")) {
my @rules; my @rules;
@ -394,6 +395,7 @@ sub flush_accounting_rules {
system("$cmd6 -t $table -X $_"); system("$cmd6 -t $table -X $_");
} }
} }
}
if(open(IN, "$cmd -t $table -nxvL FORWARD --line-numbers |")) { if(open(IN, "$cmd -t $table -nxvL FORWARD --line-numbers |")) {
my @rules; my @rules;
my @names; my @names;
@ -415,6 +417,7 @@ sub flush_accounting_rules {
system("$cmd -t $table -X $_"); system("$cmd -t $table -X $_");
} }
} }
if(lc($config->{ipv6_disabled}) ne "y") {
if(open(IN, "$cmd6 -t $table -nxvL FORWARD --line-numbers |")) { if(open(IN, "$cmd6 -t $table -nxvL FORWARD --line-numbers |")) {
my @rules; my @rules;
my @names; my @names;
@ -436,9 +439,12 @@ sub flush_accounting_rules {
system("$cmd6 -t $table -X $_"); system("$cmd6 -t $table -X $_");
} }
} }
}
logger("$num iptables rules have been flushed.") if $debug; logger("$num iptables rules have been flushed.") if $debug;
if(lc($config->{ipv6_disabled}) ne "y") {
logger("$num6 ip6tables rules have been flushed.") if $debug; logger("$num6 ip6tables rules have been flushed.") if $debug;
} }
}
if(grep {$_ eq $config->{os}} ("FreeBSD", "OpenBSD", "NetBSD")) { if(grep {$_ eq $config->{os}} ("FreeBSD", "OpenBSD", "NetBSD")) {
logger("Flushing out ipfw rules.") if $debug; logger("Flushing out ipfw rules.") if $debug;
system("ipfw delete $config->{port}->{rule} 2>/dev/null"); system("ipfw delete $config->{port}->{rule} 2>/dev/null");

View File

@ -147,6 +147,10 @@ sub port_init {
} }
$cmd = "iptables" . $config->{iptables_wait_lock}; $cmd = "iptables" . $config->{iptables_wait_lock};
if(grep {$_ eq $p} ("tcp6", "udp6")) { if(grep {$_ eq $p} ("tcp6", "udp6")) {
if(lc($config->{ipv6_disabled}) ne "y") {
logger("$myself: IPv6 is explicitly disabled, you shouldn't want to monitor 'tcp6' or 'udp6' protocols.");
next;
}
$cmd = "ip6tables" . $config->{iptables_wait_lock}; $cmd = "ip6tables" . $config->{iptables_wait_lock};
$p =~ s/6//; $p =~ s/6//;
} }
@ -215,9 +219,11 @@ sub port_update {
open(IN, "$cmd -t $table -nxvL INPUT 2>/dev/null |"); open(IN, "$cmd -t $table -nxvL INPUT 2>/dev/null |");
@data = <IN>; @data = <IN>;
close(IN); close(IN);
if(lc($config->{ipv6_disabled}) ne "y") {
open(IN, "$cmd6 -t $table -nxvL INPUT 2>/dev/null |"); open(IN, "$cmd6 -t $table -nxvL INPUT 2>/dev/null |");
push(@data, <IN>); push(@data, <IN>);
close(IN); close(IN);
}
for($l = 0; $l < scalar(@data); $l++) { for($l = 0; $l < scalar(@data); $l++) {
for($n = 0; $n < $port->{max}; $n++) { for($n = 0; $n < $port->{max}; $n++) {
$i_in[$n] = 0 unless $i_in[$n]; $i_in[$n] = 0 unless $i_in[$n];
@ -243,9 +249,11 @@ sub port_update {
open(IN, "$cmd -t $table -nxvL OUTPUT 2>/dev/null |"); open(IN, "$cmd -t $table -nxvL OUTPUT 2>/dev/null |");
@data = <IN>; @data = <IN>;
close(IN); close(IN);
if(lc($config->{ipv6_disabled}) ne "y") {
open(IN, "$cmd6 -t $table -nxvL OUTPUT 2>/dev/null |"); open(IN, "$cmd6 -t $table -nxvL OUTPUT 2>/dev/null |");
push(@data, <IN>); push(@data, <IN>);
close(IN); close(IN);
}
for($l = 0; $l < scalar(@data); $l++) { for($l = 0; $l < scalar(@data); $l++) {
for($n = 0; $n < $port->{max}; $n++) { for($n = 0; $n < $port->{max}; $n++) {
$o_out[$n] = 0 unless $o_out[$n]; $o_out[$n] = 0 unless $o_out[$n];