]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: rename recursion counter to recursion.binop
authorFlorian Westphal <fw@strlen.de>
Fri, 6 Jun 2025 12:12:36 +0000 (14:12 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 22 Jun 2025 17:18:45 +0000 (19:18 +0200)
commit10b44319a53a131ed943e2b6eeb62d197178bf4d
tree6aa9d69e6430cc6c9f229326a5e81beb66e894ed
parent9352fa7fb0a3191d5c811ced9031e7ec3d6d152b
evaluate: rename recursion counter to recursion.binop

The existing recursion counter is used by the binop expression to detect
if we've completely followed all the binops.

We can only chain up to NFT_MAX_EXPR_RECURSION binops, but the evaluation
step can perform constant-folding, so we must recurse until we found the
rightmost (last) binop in the chain.

Then we can check the post-eval chain to see if it is something that can
be serialized later (i.e., if we are within the NFT_MAX_EXPR_RECURSION
after constant folding) or not.

Thus we can't reuse the existing ctx->recursion counter for other
expressions; entering the initial expr_evaluate_binop with
ctx->recursion > 0 would break things.

Therefore rename this to an embedded structure.
This allows us to add a new recursion counter in a followup patch.

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