Skip to contentSkip to conversation

iptables-nft: fix -Z option

PATCH In review Florian Westphal 2 participants 2 messages Feb 24, 2021 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 iptables-nft: fix -Z option

it zeroes the rule counters, so it needs fully populated cache. Add a test case to cover this.

Fixes 9d07514ac5c7a ("nft: calculate cache requirements from list of commands")
---
 iptables/nft-cmd.c                            |  2 +-
 .../testcases/iptables/0007-zero-counters_0   | 64 +++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100755 iptables/tests/shell/testcases/iptables/0007-zero-counters_0
iptables/nft-cmd.c +1 -1
index 5d33f1f00f57..f2b935c57dab 100644
@@ -185,7 +185,7 @@ int nft_cmd_chain_zero_counters(struct nft_handle *h, const char *chain,
 	if (!cmd)
 		return 0;
 
-	nft_cache_level_set(h, NFT_CL_CHAINS, cmd);
+	nft_cache_level_set(h, NFT_CL_RULES, cmd);
 
 	return 1;
 }
iptables/tests/shell/testcases/iptables/0007-zero-counters_0 new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.26.2