From f97c6774ef3e4bd4cf77b5e6ff1870bc0f7e271b Mon Sep 17 00:00:00 2001 From: Michael Eitelwein Date: Thu, 7 Jan 2016 15:24:13 +0100 Subject: [PATCH] Fix regex to extract firewall chain for ipv6 in showrequestfrom*.dat If bridged ipv6 is used, $iface is taken from PHYSIN In the log line the order of fields is "... IN=XY OUT=XY PHYSIN=XY ..." Signed-off-by: Michael Eitelwein --- html/cgi-bin/logs.cgi/showrequestfromcountry.dat | 8 ++++---- html/cgi-bin/logs.cgi/showrequestfromip.dat | 2 +- html/cgi-bin/logs.cgi/showrequestfromport.dat | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat index 0784ab941f..07bf86407e 100644 --- a/html/cgi-bin/logs.cgi/showrequestfromcountry.dat +++ b/html/cgi-bin/logs.cgi/showrequestfromcountry.dat @@ -181,7 +181,7 @@ if (!$skip) elsif($srcaddr ne '') { # or srcaddr matches country code my $ccode = $gi->country_code_by_name($srcaddr); - if($ccode eq $country){ + if($ccode eq uc($country)){ $log[$lines] = $_; $lines++; } @@ -221,7 +221,7 @@ if ($multifile) { elsif (($_ =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($_ =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { my $srcaddr=$1; my $ccode = $gi->country_code_by_name($srcaddr); - if($ccode eq $country){ + if($ccode eq uc($country)){ # or srcaddr matches country code $log[$lines] = $_; $lines++; @@ -351,7 +351,7 @@ foreach $_ (@slice) if($iface ne $country) { $ccode = $gi->country_code_by_name($srcaddr); } - if($iface eq $country || $ccode eq $country) { + if($iface eq $country || $ccode eq uc($country)) { my $chain = ''; my $in = '-'; my $out = '-'; my $srcaddr = ''; my $dstaddr = ''; @@ -359,7 +359,7 @@ foreach $_ (@slice) my $srcport = ''; my $dstport = ''; # If ipv6 uses bridge, the use PHYSIN otherwise use IN - if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {} + if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {} elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {} my $timestamp = $1; my $chain = $2; my $packet = $3; $timestamp =~ /(...) (..) (..:..:..)/; diff --git a/html/cgi-bin/logs.cgi/showrequestfromip.dat b/html/cgi-bin/logs.cgi/showrequestfromip.dat index 94e795c6d1..3611c1915b 100644 --- a/html/cgi-bin/logs.cgi/showrequestfromip.dat +++ b/html/cgi-bin/logs.cgi/showrequestfromip.dat @@ -303,7 +303,7 @@ foreach $_ (@slice) my $srcport = ''; my $dstport = ''; # If ipv6 uses bridge, the use PHYSIN, otherwise use IN - if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {} + if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {} elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {} my $timestamp = $1; my $chain = $2; my $packet = $3; $timestamp =~ /(...) (..) (..:..:..)/; diff --git a/html/cgi-bin/logs.cgi/showrequestfromport.dat b/html/cgi-bin/logs.cgi/showrequestfromport.dat index af7779a87f..d735c7be9c 100644 --- a/html/cgi-bin/logs.cgi/showrequestfromport.dat +++ b/html/cgi-bin/logs.cgi/showrequestfromport.dat @@ -308,7 +308,7 @@ foreach $_ (@slice) my $srcport = ''; my $dstport = ''; # If ipv6 uses bridge, the use PHYSIN, otherwise use IN - if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {} + if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {} elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {} my $timestamp = $1; my $chain = $2; my $packet = $3; $timestamp =~ /(...) (..) (..:..:..)/; -- 2.39.5