Skip to content

Commit c085531

Browse files
committed
netfilter: nf_tables: do not set up extensions for end interval
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550 Upstream Status: commit 33c7aba Conflicts: net/netfilter/nf_tables_api.c Context only: CS9 already gained the READ_ONCE(), keep that as-is. commit 33c7aba Author: Pablo Neira Ayuso <pablo@netfilter.org> Date: Mon Nov 14 11:31:54 2022 +0100 netfilter: nf_tables: do not set up extensions for end interval Elements with an end interval flag set on do not store extensions. The global set definition is currently setting on the timeout and stateful expression for end interval elements. This leads to skipping end interval elements from the set->ops->walk() path as the expired check bogusly reports true. Moreover, do not set up stateful expressions for elements with end interval flag set on since this is never used. Fixes: 6503842 ("netfilter: nf_tables: allow to specify stateful expression in set definition") Fixes: 8d8540c ("netfilter: nft_set_rbtree: add timeout support") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent 344967d commit c085531

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5918,7 +5918,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
59185918
&timeout);
59195919
if (err)
59205920
return err;
5921-
} else if (set->flags & NFT_SET_TIMEOUT) {
5921+
} else if (set->flags & NFT_SET_TIMEOUT &&
5922+
!(flags & NFT_SET_ELEM_INTERVAL_END)) {
59225923
timeout = READ_ONCE(set->timeout);
59235924
}
59245925

@@ -5984,7 +5985,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
59845985
err = -EOPNOTSUPP;
59855986
goto err_set_elem_expr;
59865987
}
5987-
} else if (set->num_exprs > 0) {
5988+
} else if (set->num_exprs > 0 &&
5989+
!(flags & NFT_SET_ELEM_INTERVAL_END)) {
59885990
err = nft_set_elem_expr_clone(ctx, set, expr_array);
59895991
if (err < 0)
59905992
goto err_set_elem_expr_clone;

0 commit comments

Comments
 (0)