]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/logs.cgi/firewalllogip.dat
Enable correct display of ipv6 entries in Firewall log pages of web UI.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / logs.cgi / firewalllogip.dat
index 7d82d20e725e07f3569921a51ef030650b5e2510..6fc34223e1264b2491dd4c6db991f0f3e7045f00 100644 (file)
@@ -291,7 +291,8 @@ if ($pienumber == -1 || $pienumber > $lines || $sortcolumn == 2) { $pienumber =
 $lines = 0;
 foreach $_ (@log)
 {
-  if($_ =~  /SRC\=([\d\.]+)/){
+  # Extract ipv4 or ipv6 address
+  if (($_ =~  /SRC\=(([\d]{1,3})(\.([\d]{1,3})){3})/) or ($_ =~ /SRC\=(([0-9a-fA-F]{0,4})(\:([0-9a-fA-F]{0,4})){2,7})/)) {
     $tabjc{$1} = $tabjc{$1} + 1 ;
     if(($tabjc{$1} == 1) && ($lines < $pienumber)) { $lines = $lines + 1; }
     $linesjc++;
@@ -428,10 +429,8 @@ for($s=0;$s<$lines;$s++)
   $percent = $value[$s] * 100 / $linesjc;
   $percent = sprintf("%.f", $percent);
   $total = $total + $value[$s];
-  my $colorIndex = $color % 10;
-  if($colorIndex == 0) {
-    $colorIndex = 10;
-  }
+  # colors are numbered 1 to 10
+  my $colorIndex = ($color % 10) + 1;
   $col="bgcolor='$color{\"color$colorIndex\"}'";
   print "<tr>";
   
@@ -459,10 +458,8 @@ for($s=0;$s<$lines;$s++)
 
 if($cgiparams{'otherspie'} == 2 ){}
 else{
-  my $colorIndex = $color % 10;
-  if($colorIndex == 0) {
-    $colorIndex = 10;
-  }
+  # colors are numbered 1 to 10
+  my $colorIndex = ($color % 10) + 1;
   $col="bgcolor='$color{\"color$colorIndex\"}'";
   print "<tr>";