diff options
author | Daniil Baturin <daniil@baturin.org> | 2019-06-21 08:54:54 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 08:54:54 +0700 |
commit | e6bff7fd27e74bf25737fa22aed6a5a60b7f03bd (patch) | |
tree | 5aa7a2a06fa79081c42909666ee12c3313d596a2 /scripts/firewall/vyatta-show-firewall.pl | |
parent | 20ec38b975f0e1deb0fb84fb692d3176d7554fca (diff) | |
parent | 1e4fe016bacc7c54366b7915ad38569e01d3b64e (diff) | |
download | vyatta-op-firewall-e6bff7fd27e74bf25737fa22aed6a5a60b7f03bd.tar.gz vyatta-op-firewall-e6bff7fd27e74bf25737fa22aed6a5a60b7f03bd.zip |
Merge pull request #1 from zdc/T1460
T1460: Fixed parsing of rules counters with values more than 10000000
Diffstat (limited to 'scripts/firewall/vyatta-show-firewall.pl')
-rwxr-xr-x | scripts/firewall/vyatta-show-firewall.pl | 11 |
1 files changed, 7 insertions, 4 deletions
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]; |