public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Adolf Belka <adolf.belka@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] firewallog.dat: Fix bug13068 - remove blocklist entries from firewall log
Date: Sun, 02 Mar 2025 09:26:14 +0000	[thread overview]
Message-ID: <20250228112731.5437-1-adolf.belka@ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2767 bytes --]

- 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(a)ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka(a)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

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)
-- 
2.48.1


                 reply	other threads:[~2025-03-02  9:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250228112731.5437-1-adolf.belka@ipfire.org \
    --to=adolf.belka@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox