]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: bail out if ct saddr/daddr dependency cannot be inserted
authorFlorian Westphal <fw@strlen.de>
Wed, 2 Apr 2025 23:09:22 +0000 (01:09 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Aug 2025 16:47:35 +0000 (18:47 +0200)
commit048f347726804f6e309d2ac5e6af5d54dc6eb90e
tree7dc93393dab106718bdbeae97cd52198935c67d5
parentb8cd08ddaa2f9576ac1037733539394093d143c1
evaluate: bail out if ct saddr/daddr dependency cannot be inserted

commit 7f60519e356833ca007b138c00b9f5de09f21b56 upstream.

If we have an incomplete rule like "ct original saddr" in inet
family, this function generates an error because it can't determine the required protocol
dependency, hinting at missing ip/ip6 keyword.

We should not go on in this case to avoid a redundant followup error:

nft add rule inet f c ct original saddr 1.2.3.4
Error: cannot determine ip protocol version, use "ip saddr" or "ip6 saddr" instead
add rule inet f c ct original saddr 1.2.3.4
                  ^^^^^^^^^^^^^^^^^
Error: Could not parse symbolic invalid expression
add rule inet f c ct original saddr 1.2.3.4

After this change only the first error is shown.

Fixes: 2b29ea5f3c3e ("src: ct: add eval part to inject dependencies for ct saddr/daddr")
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c