From a0698de9866d2e0ede5eee961a9da38e0ede7062 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 3 Aug 2018 15:33:02 +0200 Subject: 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 Signed-off-by: Florian Westphal --- iptables/tests/shell/testcases/iptables/0001-chain-refs_0 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 iptables/tests/shell/testcases/iptables/0001-chain-refs_0 (limited to 'iptables/tests/shell/testcases') 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)' -- cgit v1.2.3