]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: remove anon sets with exactly one element
authorFlorian Westphal <fw@strlen.de>
Fri, 25 Jan 2019 15:50:23 +0000 (16:50 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 7 Jun 2021 20:50:55 +0000 (22:50 +0200)
commitfee6bda064037b2abd0510241ac59d5358a7f684
tree850586f9d02d25b82b91dd97445127ab492328f7
parentec1ea13314fa55e43e3034bf43297829b25ba582
evaluate: remove anon sets with exactly one element

Auto-replace lookups in single-element anon sets with a standard compare.

'add rule foo bar meta iif { "lo" }' gets replaced with
'add rule foo bar meta iif "lo"'.

The former is a set lookup, the latter is a comparision.
Comparisions are faster for the one-element case.

Only prefixes, ranges and values are handled at this time.

Anonymous maps are left alone, same for concatenations.

Concatenations could be handled, but it would require more work:
the concatenation would have to be replaced with a singleton value.
Evaluation step rejects concat RHS on a relational expression.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/evaluate.c