summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorzsdc <taras@sentrium.io>2019-06-20 23:58:47 +0300
committerzsdc <taras@sentrium.io>2019-06-20 23:58:47 +0300
commit1e4fe016bacc7c54366b7915ad38569e01d3b64e (patch)
tree5aa7a2a06fa79081c42909666ee12c3313d596a2 /scripts
parent20ec38b975f0e1deb0fb84fb692d3176d7554fca (diff)
downloadvyatta-op-firewall-1e4fe016bacc7c54366b7915ad38569e01d3b64e.tar.gz
vyatta-op-firewall-1e4fe016bacc7c54366b7915ad38569e01d3b64e.zip
[show firewall rule] T1460: Fixed parsing of rules counters with values more than 10000000
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/firewall/vyatta-show-firewall.pl11
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];