diff options
author | Daniil Baturin <daniil.baturin@vyatta.com> | 2011-12-14 04:20:00 +0700 |
---|---|---|
committer | Daniil Baturin <daniil.baturin@vyatta.com> | 2011-12-14 04:20:00 +0700 |
commit | 28fa76f1360015672caddca6352d9b2dd9b20dc9 (patch) | |
tree | 99f3be142a61f0017286f46894d33f4da067315a | |
parent | 9176061e8e325f669acc0692e465afd657bd891b (diff) | |
download | vyatta-nat-28fa76f1360015672caddca6352d9b2dd9b20dc9.tar.gz vyatta-nat-28fa76f1360015672caddca6352d9b2dd9b20dc9.zip |
Bug #6617: fix counters flush for rules with logging.
-rwxr-xr-x | scripts/vyatta-clear-nat-counters.pl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/vyatta-clear-nat-counters.pl b/scripts/vyatta-clear-nat-counters.pl index a15da6c..06e67ae 100755 --- a/scripts/vyatta-clear-nat-counters.pl +++ b/scripts/vyatta-clear-nat-counters.pl @@ -89,11 +89,15 @@ sub clear_rule { $iptables_rule = `$cmd`; return "couldn't find an underlying iptables rule" if ! defined $iptables_rule; chomp $iptables_rule; + # Rules with "log" statement and "tcp_udp" rules take more than one line + my @numbers = split(/\n/, $iptables_rule); # clear the counters for that rule - $cmd = "$iptables -t nat -Z $chain $iptables_rule"; - $error = system($cmd); - return "error clearing counters for NAT rule $clirule" if $error; + for my $number (@numbers) { + $cmd = "$iptables -t nat -Z $chain $number"; + $error = system($cmd); + return "error clearing counters for NAT rule $clirule" if $error; + } } return; } |