diff options
author | Phil Sutter <phil@nwl.cc> | 2022-06-08 18:15:20 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-06-11 11:47:03 +0200 |
commit | 0e4d9fcb7b79821fae9b9b704ae64db39f0de3a5 (patch) | |
tree | 5a943b1bcc913c5be4f46309f5cd5a73db2af1dd | |
parent | 9d54ddf5cbd6b1ce272972784e3cc056651a819f (diff) |
tests: shell: Extend zero counters test a bit further
Test zeroing a single rule's counters as well.
Signed-off-by: Phil Sutter <phil@nwl.cc>
-rwxr-xr-x | iptables/tests/shell/testcases/iptables/0007-zero-counters_0 | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/iptables/tests/shell/testcases/iptables/0007-zero-counters_0 b/iptables/tests/shell/testcases/iptables/0007-zero-counters_0 index 36da1907..21793472 100755 --- a/iptables/tests/shell/testcases/iptables/0007-zero-counters_0 +++ b/iptables/tests/shell/testcases/iptables/0007-zero-counters_0 @@ -10,6 +10,7 @@ $XT_MULTI iptables-restore -c <<EOF [12:345] -A INPUT -i lo -p icmp -m comment --comment "$COUNTR" [22:123] -A FOO -m comment --comment one [44:123] -A FOO -m comment --comment two +[66:123] -A FOO -m comment --comment three COMMIT EOF EXPECT="*filter @@ -20,6 +21,7 @@ EXPECT="*filter [0:0] -A INPUT -i lo -p icmp -m comment --comment "$COUNTR" [0:0] -A FOO -m comment --comment one [0:0] -A FOO -m comment --comment two +[0:0] -A FOO -m comment --comment three COMMIT" COUNTER=$($XT_MULTI iptables-save -c |grep "comment $COUNTR"| cut -f 1 -d " ") @@ -28,6 +30,18 @@ if [ $COUNTER != "[12:345]" ]; then RC=1 fi +$XT_MULTI iptables -Z FOO 2 +COUNTER=$($XT_MULTI iptables-save -c | grep "comment two"| cut -f 1 -d " ") +if [ $COUNTER != "[0:0]" ]; then + echo "Counter $COUNTER is wrong, should have been zeroed" + RC=1 +fi +COUNTER=$($XT_MULTI iptables-save -c | grep "comment three"| cut -f 1 -d " ") +if [ $COUNTER != "[66:123]" ]; then + echo "Counter $COUNTER is wrong, should not have been zeroed" + RC=1 +fi + $XT_MULTI iptables -Z FOO COUNTER=$($XT_MULTI iptables-save -c |grep "comment $COUNTR"| cut -f 1 -d " ") if [ $COUNTER = "[0:0]" ]; then @@ -60,5 +74,6 @@ fi $XT_MULTI iptables -D INPUT -i lo -p icmp -m comment --comment "$COUNTR" $XT_MULTI iptables -D FOO -m comment --comment one $XT_MULTI iptables -D FOO -m comment --comment two +$XT_MULTI iptables -D FOO -m comment --comment three $XT_MULTI iptables -X FOO exit $RC |