]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
firewallog.dat: Fix bug13068 - remove blocklist entries from firewall log
authorAdolf Belka <adolf.belka@ipfire.org>
Fri, 28 Feb 2025 11:27:31 +0000 (12:27 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 Mar 2025 11:15:36 +0000 (11:15 +0000)
- The blocklist log entries are also under kernel: and so currently also show up in the
   firewall logs as well as in the ip blocklist logs menus. If there are a lot of
   blocklist entries it can make it very difficult to go through the firewall logs.
- This bugfix excxludes any kernel: log entries that have a chain starting with BLKLST.
- Tested out on physical and vm IPFire systems.

Fixes: bug13068
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/logs.cgi/firewalllog.dat [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 01dcdc7..aafbe3d
@@ -176,23 +176,25 @@ while ($gzindex >=0 && $loop) {
                READ:while (<FILE>) {
                        my $line = $_;
                        if ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ kernel:.*IN=.*$/) {
-                               # when standart viewing, just keep in memory the correct slice
-                               # it starts a '$start' and size is $viewport
-                               # If export, then keep all lines...
-                               if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){
-                                       $log[$lines++] = "$line";
-                               } else {
-                                       if ($lines++ < ($start + $Header::viewsize)) {
-                                               push(@log,"$line");
-                                               if (@log > $Header::viewsize) {
-                                                       shift (@log);
+                               unless ($line =~ /^${monthstr} ${daystr} ..:..:.. [\w\-]+ kernel:\sBLKLST.*IN=.*$/) {
+                                       # when standart viewing, just keep in memory the correct slice
+                                       # it starts a '$start' and size is $viewport
+                                       # If export, then keep all lines...
+                                       if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){
+                                               $log[$lines++] = "$line";
+                                       } else {
+                                               if ($lines++ < ($start + $Header::viewsize)) {
+                                                       push(@log,"$line");
+                                                       if (@log > $Header::viewsize) {
+                                                               shift (@log);
+                                                       }
+                                               #} else { dont do this optimisation, need to count lines !
+                                               #       $datetime = $maxtime; # we have read viewsize lines, stop main loop
+                                               #       last READ;         # exit read file
                                                }
-                                       #} else { dont do this optimisation, need to count lines !
-                                       #       $datetime = $maxtime; # we have read viewsize lines, stop main loop
-                                       #       last READ;         # exit read file
                                        }
+                                       $search_for_end = 1;    # we find the start of slice, can look for end now
                                }
-                               $search_for_end = 1;    # we find the start of slice, can look for end now
                        } else {
                                if ($search_for_end == 1) {
                                        #finish read files when date is over (test month equality only)