From 9a56b9608ce8abfe35f513076118876bca49a792 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 30 Jun 2015 17:54:26 +0200 Subject: [PATCH] fixed to not show the red background color in listening network ports using IPv6 in the 'port' graph --- Changes | 3 +++ lib/port.pm | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index bb06a3d..3677c90 100644 --- a/Changes +++ b/Changes @@ -34,6 +34,9 @@ - Fixed a wrong example in the documentation when showing how to define the same port number using IPv4 and IPv6 in the 'port' graph. (thanks to Dirk Tanneberger, os AT tanneberger.biz for pointing this out) +- Fixed to not show the red background color in listening network ports using + IPv6 in the 'port' graph. + (thanks to Dirk Tanneberger, os AT tanneberger.biz for pointing this out) - Small cosmetic changes. diff --git a/lib/port.pm b/lib/port.pm index 872fece..279299d 100644 --- a/lib/port.pm +++ b/lib/port.pm @@ -500,12 +500,15 @@ sub port_cgi { } my $pnum; $pl[$n] = trim($pl[$n]); + my $num = ($pl[$n] =~ m/^(\d+).*?/)[0]; # strips any suffix from port number my $pn = trim((split(',', $port->{desc}->{$pl[$n]}))[0]); my $pp = trim((split(',', $port->{desc}->{$pl[$n]}))[1]); $pp =~ s/6//; my $prig = trim((split(',', $port->{desc}->{$pl[$n]}))[3]); my $plim = trim((split(',', $port->{desc}->{$pl[$n]}))[4]); @riglim = @{setup_riglim($prig, $plim)}; + + # check if the network port is still listening undef(@warning); if($config->{os} eq "Linux") { open(IN, "netstat -nl --$pp |"); @@ -513,7 +516,7 @@ sub port_cgi { (undef, undef, undef, $pnum) = split(' ', $_); chomp($pnum); $pnum =~ s/.*://; - if($pnum eq $pl[$n]) { + if($pnum eq $num) { last; } } @@ -529,14 +532,14 @@ sub port_cgi { chomp($pnum); ($pnum) = ($pnum =~ m/^.*?(\.\d+$)/); $pnum =~ s/\.//; - if($pnum eq $pl[$n]) { + if($pnum eq $num) { last; } } } close(IN); } - if(lc($pcon) ne "out" && $pnum ne $pl[$n]) { + if(lc($pcon) ne "out" && $pnum ne $num) { push(@warning, $colors->{warning_color}); }