mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
firewalllog.dat: Proper display protocol names.
In some cases iptables logs the protocol number instead of the name. When accessing the logs via the WUI, this number has been displayed as used protocol, which is very hard to read and understand. This commit adds a new function to the general-functions.pl, which generates a hash to translate the protocol number into the protocol name. Fixes #11282. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
5c9faddc97
commit
ca1f4a07ab
@@ -325,6 +325,8 @@ print <<END
|
||||
END
|
||||
;
|
||||
|
||||
# Generate hash to translate protocol numbers into protocol names.
|
||||
my %protocols = &General::generateProtoTransHash();
|
||||
|
||||
$lines = 0;
|
||||
foreach $_ (@log)
|
||||
@@ -354,6 +356,12 @@ foreach $_ (@log)
|
||||
# Get the country code.
|
||||
my $ccode = &Location::Functions::lookup_country_code($srcaddr);
|
||||
|
||||
# Lookup if the grabbed protocol is part of the protocols hash.
|
||||
if (exists ($protocols{$proto})) {
|
||||
# Translate protocol number into protocol name.
|
||||
$proto = $protocols{$proto};
|
||||
}
|
||||
|
||||
my $servi = uc(getservbyport($srcport, lc($proto)));
|
||||
if ($servi ne '' && $srcport < 1024) {
|
||||
$srcport = "$srcport($servi)";
|
||||
|
||||
Reference in New Issue
Block a user