Skip to content

Commit 6b1ca88

Browse files
committed
netfilter: nf_tables: skip dead set elements in netlink dump
Delete from packet path relies on the garbage collector to purge elements with NFT_SET_ELEM_DEAD_BIT on. Skip these dead elements from nf_tables_dump_setelem() path, I very rarely see tests/shell/testcases/maps/typeof_maps_add_delete reports [DUMP FAILED] showing a mismatch in the expected output with an element that should not be there. If the netlink dump happens before GC worker run, it might show dead elements in the ruleset listing. nft_rhash_get() already skips dead elements in nft_rhash_cmp(), therefore, it already does not show the element when getting a single element via netlink control plane. Fixes: 5f68718 ("netfilter: nf_tables: GC transaction API to avoid race with control plane") Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 3ce67e3 commit 6b1ca88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5718,7 +5718,7 @@ static int nf_tables_dump_setelem(const struct nft_ctx *ctx,
57185718
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem_priv);
57195719
struct nft_set_dump_args *args;
57205720

5721-
if (nft_set_elem_expired(ext))
5721+
if (nft_set_elem_expired(ext) || nft_set_elem_is_dead(ext))
57225722
return 0;
57235723

57245724
args = container_of(iter, struct nft_set_dump_args, iter);

0 commit comments

Comments
 (0)