firewallog.dat: Fix bug13068 - remove blocklist entries from firewall log

Message ID 20250228112731.5437-1-adolf.belka@ipfire.org
State Staged
Commit 285cacf9cfcf300cf61e7cfe3f19dd318392aff7
Headers
Series firewallog.dat: Fix bug13068 - remove blocklist entries from firewall log |

Commit Message

Adolf Belka Feb. 28, 2025, 11:27 a.m. UTC
  - 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>
---
 html/cgi-bin/logs.cgi/firewalllog.dat | 30 ++++++++++++++-------------
 1 file changed, 16 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 html/cgi-bin/logs.cgi/firewalllog.dat
  

Patch

diff --git a/html/cgi-bin/logs.cgi/firewalllog.dat b/html/cgi-bin/logs.cgi/firewalllog.dat
old mode 100644
new mode 100755
index 01dcdc7d4..aafbe3db7
--- a/html/cgi-bin/logs.cgi/firewalllog.dat
+++ b/html/cgi-bin/logs.cgi/firewalllog.dat
@@ -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)