diff options
author | Phil Sutter <phil@nwl.cc> | 2018-08-03 15:33:02 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-08-04 23:29:35 +0200 |
commit | a0698de9866d2e0ede5eee961a9da38e0ede7062 (patch) | |
tree | 778633a8c90ba7876e8dacb12c762bcfef6c688f /iptables/tests/shell/testcases/iptables | |
parent | d11b6b8c3cc459eeec6438e2ad35e8ab46b3527f (diff) |
xtables: Do not count rules as chain references
Unlike iptables, nftables counts rules in a chain as references to that
chain. Align output of 'iptables-nft -L' with that of legacy iptables by
counting the number of rules in a chain and subtracting that value from
reference count before printing the chain header.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/tests/shell/testcases/iptables')
-rwxr-xr-x | iptables/tests/shell/testcases/iptables/0001-chain-refs_0 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/iptables/tests/shell/testcases/iptables/0001-chain-refs_0 b/iptables/tests/shell/testcases/iptables/0001-chain-refs_0 new file mode 100755 index 00000000..e55506e8 --- /dev/null +++ b/iptables/tests/shell/testcases/iptables/0001-chain-refs_0 @@ -0,0 +1,14 @@ +#!/bin/bash + +# make sure rules are not counted in references of iptables output + +set -e + +$XT_MULTI iptables -N foo +$XT_MULTI iptables -L | grep 'Chain foo (0 references)' + +$XT_MULTI iptables -A foo -j ACCEPT +$XT_MULTI iptables -L | grep 'Chain foo (0 references)' + +$XT_MULTI iptables -A FORWARD -j foo +$XT_MULTI iptables -L | grep 'Chain foo (1 references)' |