]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: revisit anonymous set with single element optimization
authorPablo Neira Ayuso <pablo@netfilter.org>
Sat, 2 Sep 2023 08:37:39 +0000 (10:37 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 2 Sep 2023 19:13:14 +0000 (21:13 +0200)
commitfa17b17ea74a21a44596f3212466ff3d2d3ede8e
treef107b3c5541d19cce826dfc3c8cf39802d9df5bd
parent5bedf4a11e2118841598623ad4bedb6cbb23994f
evaluate: revisit anonymous set with single element optimization

This patch reworks it to perform this optimization from the evaluation
step of the relational expression. Hence, when optimizing for protocol
flags, use OP_EQ instead of OP_IMPLICIT, that is:

tcp flags { syn }

becomes (to represent an exact match):

tcp flags == syn

given OP_IMPLICIT and OP_EQ are not equivalent for flags.

01167c393a12 ("evaluate: do not remove anonymous set with protocol flags
and single element") disabled this optimization, which is enabled again
after this patch.

Fixes: 01167c393a12 ("evaluate: do not remove anonymous set with protocol flags and single element")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c