From 1e4fe016bacc7c54366b7915ad38569e01d3b64e Mon Sep 17 00:00:00 2001 From: zsdc Date: Thu, 20 Jun 2019 23:58:47 +0300 Subject: [show firewall rule] T1460: Fixed parsing of rules counters with values more than 10000000 --- scripts/firewall/vyatta-show-firewall.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/firewall/vyatta-show-firewall.pl b/scripts/firewall/vyatta-show-firewall.pl index e679745..aaf011c 100755 --- a/scripts/firewall/vyatta-show-firewall.pl +++ b/scripts/firewall/vyatta-show-firewall.pl @@ -326,16 +326,19 @@ sub print_detail_rule { my @string_words_part1=(); my @string_words_part2=(); my @string_words_part3 = (); - @string_words = split (/\s+/, $string, 14); - @string_words=splice(@string_words, 1, 13); + + # trim leading and trailing whitespaces + $string =~ s/^\s+|\s+$//g; + @string_words = split (/\s+/, $string, 13); @string_words_part1=splice(@string_words, 0, 4); # packets, bytes, target, proto if (defined $cli_rule->{_protocol} && $cli_rule->{_protocol} eq 'tcp_udp') { $string_words_part1[3] = 'tcp_udp'; + # trim leading and trailing whitespaces + $udp_string =~ s/^\s+|\s+$//g; # get udp rule packets, bytes - my @udp_string_words=split(/\s+/, $udp_string, 14); - @udp_string_words=splice(@udp_string_words, 1, 13); + my @udp_string_words=split(/\s+/, $udp_string, 13); @udp_string_words=splice(@udp_string_words, 0, 4); # packets, bytes, target, proto $string_words_part1[0] += $udp_string_words[0]; $string_words_part1[1] += $udp_string_words[1]; -- cgit v1.2.3