]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: allow to re-use existing metered set
authorFlorian Westphal <fw@strlen.de>
Wed, 22 Jan 2025 09:18:04 +0000 (10:18 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 29 Jan 2025 14:23:18 +0000 (15:23 +0100)
commit639a111e91341cffdc6d86b847aa654646c799cf
tree685886580aaee403b0aebcae3c1269ffeb1631b0
parente29b3cd9b094c94ddd7b8c13e0724a252d53e2cf
evaluate: allow to re-use existing metered set

Blamed commit translates old meter syntax (which used to allocate an
anonymous set) to dynamic sets.

A side effect of this is that re-adding a meter rule after chain was
flushed results in an error, unlike anonymous sets named sets are not
impacted by the flush.

Refine this: if a set of the same name exists and is compatible, then
re-use it instead of returning an error.

Also pick up the reproducer kindly provided by the reporter and place it
in the shell test directory.

Fixes: b8f8ddfff733 ("evaluate: translate meter into dynamic set")
Reported-by: Yi Chen <yiche@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/evaluate.c
tests/shell/testcases/sets/dumps/meter_set_reuse.json-nft [new file with mode: 0644]
tests/shell/testcases/sets/dumps/meter_set_reuse.nft [new file with mode: 0644]
tests/shell/testcases/sets/meter_set_reuse [new file with mode: 0755]