firewalllog.dat: Fix for bug#13492 - include chain in the exported output

Message ID 20231222123747.5917-1-adolf.belka@ipfire.org
State Staged
Commit f02adfbc7488c408ad73def2cb59997dfaf7265f
Headers
Series firewalllog.dat: Fix for bug#13492 - include chain in the exported output |

Commit Message

Adolf Belka Dec. 22, 2023, 12:37 p.m. UTC
  - The regex code does not extract out the chain and so it is missed off from the log output
   when it is exported.
- Changed code tested out on my vm testbed and confirmed to work and include the chain in
   the output.

Fixes: Bug13492
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 html/cgi-bin/logs.cgi/firewalllog.dat | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Bernhard Bitsch Dec. 22, 2023, 1:27 p.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfre.org>

Am 22.12.2023 um 13:37 schrieb Adolf Belka:
> - The regex code does not extract out the chain and so it is missed off from the log output
>     when it is exported.
> - Changed code tested out on my vm testbed and confirmed to work and include the chain in
>     the output.
> 
> Fixes: Bug13492
> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
>   html/cgi-bin/logs.cgi/firewalllog.dat | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/html/cgi-bin/logs.cgi/firewalllog.dat b/html/cgi-bin/logs.cgi/firewalllog.dat
> index 467d06008..b07a4262d 100644
> --- a/html/cgi-bin/logs.cgi/firewalllog.dat
> +++ b/html/cgi-bin/logs.cgi/firewalllog.dat
> @@ -211,11 +211,12 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'})
>   
>   	foreach $_ (@log)
>   	{
> -		/^... (..) (..:..:..) [\w\-]+ kernel:.*(IN=.*)$/;
> +		/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/;
>   		my $day =  $1;
>   		$day =~ tr / /0/;
>   		my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ;
> -		print "$time $3\r\n";
> +		my $chain = $3;
> +		print "$time $chain $4\r\n";
>   
>   	}
>   	exit 0;
  

Patch

diff --git a/html/cgi-bin/logs.cgi/firewalllog.dat b/html/cgi-bin/logs.cgi/firewalllog.dat
index 467d06008..b07a4262d 100644
--- a/html/cgi-bin/logs.cgi/firewalllog.dat
+++ b/html/cgi-bin/logs.cgi/firewalllog.dat
@@ -211,11 +211,12 @@  if ($cgiparams{'ACTION'} eq $Lang::tr{'export'})
 
 	foreach $_ (@log)
 	{
-		/^... (..) (..:..:..) [\w\-]+ kernel:.*(IN=.*)$/;
+		/^... (..) (..:..:..) [\w\-]+ kernel:(.*)(IN=.*)$/;
 		my $day =  $1;
 		$day =~ tr / /0/;
 		my $time = $cgiparams{'DAY'} ? "$2" : "$day/$2" ;
-		print "$time $3\r\n";
+		my $chain = $3;
+		print "$time $chain $4\r\n";
 
 	}
 	exit 0;