]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Fixed detection of firewall chain when bridge is used for ipv6
authorMichael Eitelwein <michael@eitelwein.net>
Thu, 7 Jan 2016 18:40:24 +0000 (19:40 +0100)
committerMichael Eitelwein <michael@eitelwein.net>
Thu, 7 Jan 2016 18:40:24 +0000 (19:40 +0100)
Signed-off-by: Michael Eitelwein <michael@eitelwein.net>
html/cgi-bin/logs.cgi/firewalllog.dat
html/cgi-bin/logs.cgi/firewalllogcountry.dat
html/cgi-bin/logs.cgi/showrequestfromcountry.dat
html/cgi-bin/logs.cgi/showrequestfromip.dat
html/cgi-bin/logs.cgi/showrequestfromport.dat

index 7ae9be69960b1ce6716f1cc842a993b4096f97ba..df9b488126406a405957364e096cfb9a05a5b0e6 100644 (file)
@@ -339,7 +339,7 @@ foreach $_ (@log)
         my $chain = $3; 
 
                my ($iface, $srcaddr, $dstaddr, $macaddr, $proto, $srcport, $dstport);
-               if ($packet =~ /PHYSIN=(\w+)/) { $iface=$1 } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }
+               if ($packet =~ /PHYSIN=(\w+)/) { $iface=$1; } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }
                # Identify whether ipv4 or ipv6. Both are mutally exclusive.
                if ($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) { $srcaddr=$1; }
                 if ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/) { $srcaddr=$1; }
index 2661ddd01af6a9d29a05c6e5a2f638bcd84788ce..087b844432e3c39c4deacc5a04e6e15b70b446d2 100644 (file)
@@ -294,16 +294,16 @@ $lines = 0;
 foreach $_ (@log)
 {
   # If ipv6 uses bridge, use PHYSIN for iface, otherwise IN
-  if (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
+  if    (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
   elsif (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
   my $packet = $4;
   my $iface  = '';
-  if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($packet =~ /IN=(\w+)/) { $iface = $1 }
+  if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }
   if ( $1 =~ /2./ ) { $iface=''; }
   my $srcaddr = '';
   # Find ipv4 and ipv6 addresses
-  if ($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) { $srcaddr = $1 }
-  elsif ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/) { $srcaddr = $1 }
+  if    ($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) { $srcaddr = $1; }
+  elsif ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/) { $srcaddr = $1; }
 
   if($iface eq $red_interface) {
     # Traffic from red
index 07bf86407ecfa35ac955a074af369b7612857fa7..27e76971a3e6059af6502fb4844265d2e8f57fcd 100644 (file)
@@ -161,16 +161,16 @@ if (!$skip)
          # First check whether valid log line (date, day)
           if (/(^${monthstr} ${daystr} ..:..:..) [\w\-]+ kernel:.*(IN=.*)$/) {
            # If ipv6 uses bridge, then use PHYSIN otherwise use IN
-            if (/(^${monthstr} ${daystr} ..:..:..) [\w\-]+ kernel:.*(PHYSIN=.*)$/) {}
+            if    (/(^${monthstr} ${daystr} ..:..:..) [\w\-]+ kernel:.*(PHYSIN=.*)$/) {}
             elsif (/(^${monthstr} ${daystr} ..:..:..) [\w\-]+ kernel:.*(IN=.*)$/) {}
             my $packet  = $2;
             my $iface   = '';
             my $srcaddr = '';
             # If ipv6 uses bridge, use PHYSIN otherwise IN
-            if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($packet =~ /IN=(\w+)/) { $iface = $1 }
+            if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }
             # Extract ipv4 and ipv6 addresses
             if (($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
-              $srcaddr = $1 
+              $srcaddr = $1; 
             };
 
             if($iface eq $country) {
@@ -210,7 +210,7 @@ if ($multifile) {
                  if (/(^${monthstr} ${daystr} ..:..:..) [\w\-]+ kernel:.*(IN=.*)$/) {
                     my  $iface = '';
                     # If ipv6 uses bridge, then use PHYSIN otherwise IN
-                    if ($_ =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($_ =~ /IN=(\w+)/) { $iface = $1 }
+                    if ($_ =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($_ =~ /IN=(\w+)/) { $iface = $1; }
 
                     if($iface eq $country) {
                       # iface matches country code
@@ -333,17 +333,17 @@ foreach $_ (@slice)
 {
   $a = $_;
   # If ipv6 uses bridge, use PHYSIN otherwise use IN
-  if (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
+  if    (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(PHYSIN=.*)$/) {}
   elsif (/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {};
   my $packet = $4;
   my $iface = ''; 
   # If ipv6 uses bridge, use PHYSIN otherwise use IN
-  if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($packet =~ /IN=(\w+)/) { $iface = $1 }  
-  if ( $1 =~ /2./ ){ $iface="";}
+  if ($packet =~ /PHYSIN=(\w+)/) { $iface = $1; } elsif ($packet =~ /IN=(\w+)/) { $iface = $1; }  
+  if ( $1 =~ /2./ ){ $iface=""; }
   my $srcaddr = '';
   # Extract ipv4 and ipv6 addresses
   if (($packet =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($packet =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
-    $srcaddr = $1
+    $srcaddr = $1;
   };
 
   if($iface eq $country || $srcaddr ne '') {
@@ -359,15 +359,15 @@ foreach $_ (@slice)
       my $srcport = ''; my $dstport = '';
 
       # If ipv6 uses bridge, the use PHYSIN otherwise use IN
-      if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
+      if    ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
       elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
       my $timestamp = $1; my $chain = $2; my $packet = $3;
       $timestamp =~ /(...) (..) (..:..:..)/;
       my $month = $1; my $day = $2; my $time = $3;
 
       # If ipv6 uses bridge, use PHYSIN and PHYSOUT, otherwise use IN and OUT
-      if ($a =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($a =~ /IN=(\w+)/) { $iface = $1 }
-      if ($a =~ /PHYSOUT=(\w+)/) { $out = $1 } elsif ($a =~ /OUT=(\w+)/) { $out = $1 }
+      if ($a =~ /PHYSIN=(\w+)/)  { $iface = $1; } elsif ($a =~ /IN=(\w+)/)  { $iface = $1; }
+      if ($a =~ /PHYSOUT=(\w+)/) { $out = $1; }   elsif ($a =~ /OUT=(\w+)/) { $out = $1; }
       # Extract ipv4 and ipv6 addresses
       if (($a =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $srcaddr = $1; }
       if (($a =~ /DST\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /DST\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $dstaddr = $1; }
index 3611c1915b84781bd22c3579464146d324950ac4..d7d1ace912479c33863d96be4767c2ebc51b1522 100644 (file)
@@ -303,15 +303,15 @@ foreach $_ (@slice)
        my $srcport = ''; my $dstport = '';
 
        # If ipv6 uses bridge, the use PHYSIN, otherwise use IN
-        if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
+        if    ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
         elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
        my $timestamp = $1; my $chain = $2; my $packet = $3;
        $timestamp =~ /(...) (..) (..:..:..)/;
        my $month = $1; my $day = $2; my $time = $3;
 
         # If ipv6 uses bridge, the use PHYSIN and PHYSOUT, otherwise use IN and OUT
-        if ($a =~ /PHYSIN=(\w+)/) { $iface = $1 } elsif ($a =~ /IN=(\w+)/) { $iface = $1 }
-        if ($a =~ /PHYSOUT=(\w+)/) { $out = $1 } elsif ($a =~ /OUT=(\w+)/) { $out = $1 }
+        if ($a =~ /PHYSIN=(\w+)/)  { $iface = $1; } elsif ($a =~ /IN=(\w+)/)  { $iface = $1; }
+        if ($a =~ /PHYSOUT=(\w+)/) { $out = $1; }   elsif ($a =~ /OUT=(\w+)/) { $out = $1; }
         # Detect ipv4 and ipv6 addresses
        if (($a =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $srcaddr = $1; }
        if (($a =~ /DST\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /DST\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $dstaddr = $1; }
index d735c7be9c4c49f4b9f63c13458892edf576237f..6f5f63bfbf232c470aff51ee658c3a8367eef95c 100644 (file)
@@ -308,15 +308,15 @@ foreach $_ (@slice)
        my $srcport = ''; my $dstport = '';
 
         # If ipv6 uses bridge, the use PHYSIN, otherwise use IN
-       if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
+       if    ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)(PHYSIN=.*)$/) {}
         elsif ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/) {}
        my $timestamp = $1; my $chain = $2; my $packet = $3;
        $timestamp =~ /(...) (..) (..:..:..)/;
        my $month = $1; my $day = $2; my $time = $3; my $iface;
 
         # If ipv6 uses bridge, the use PHYSIN and PHYSOUT, otherwise use IN and OUT
-       if ($a =~ /PHYSIN\=(\w+)/) { $iface = $1; } elsif ($a =~ /IN\=(\w+)/) { $iface = $1; }
-        if ($a =~ /PHYSOUT\=(\w+)/) { $out = $1; } elsif ($a =~ /OUT\=(\w+)/) { $out = $1; }
+       if ($a =~ /PHYSIN\=(\w+)/)  { $iface = $1; } elsif ($a =~ /IN\=(\w+)/)  { $iface = $1; }
+        if ($a =~ /PHYSOUT\=(\w+)/) { $out = $1; }   elsif ($a =~ /OUT\=(\w+)/) { $out = $1; }
        # Detect ipv4 and ipv6 addresses
        if (($a =~ /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $srcaddr = $1; }
        if (($a =~ /DST\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($a =~ /DST\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) { $dstaddr = $1; }