]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/logs.cgi/showrequestfromport.dat
Enable correct display of ipv6 entries in Firewall log pages of web UI.
[ipfire-2.x.git] / html / cgi-bin / logs.cgi / showrequestfromport.dat
index ad9823cde7fc0183d49b901ce04ccac368b065be..af7779a87fc6873466a0b5ea8827f9a9b4a50400 100644 (file)
@@ -307,15 +307,19 @@ foreach $_ (@slice)
        my $protostr = '';
        my $srcport = ''; my $dstport = '';
 
-       $_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/;
+        # If ipv6 uses bridge, the use PHYSIN, otherwise use IN
+       if ($_ =~ /(^.* ..:..:..) [\w\-]+ kernel:(.*)(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 ($a =~ /IN\=(\w+)/) { $iface = $1; }
-       if ($a =~ /OUT\=(\w+)/) { $out = $1; }
-       if ($a =~ /SRC\=([\d\.]+)/) { $srcaddr = $1; }
-       if ($a =~ /DST\=([\d\.]+)/) { $dstaddr = $1; }
+        # 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; }
+       # 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; }
        if ($a =~ /PROTO\=(\w+)/) { $protostr = $1; }
        my $protostrlc = lc($protostr);
        if ($a =~  /SPT\=([\d\.]+)/){ $srcport = $1; }