From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 1/4] evaluate: tunnel: don't assume src is set
Date: Thu, 16 Oct 2025 16:59:33 +0200 [thread overview]
Message-ID: <20251016145955.7785-2-fw@strlen.de> (raw)
In-Reply-To: <20251016145955.7785-1-fw@strlen.de>
Included bogon crashes, after fix:
empty_geneve_definition_crash:2:9-16: Error: Could not process rule: Invalid argument
Since this feature is undocumented (hint, hint) I don't know
if there are cases where ip daddr can be elided.
If not, a followup patch should reject empty dst upfront
so users get a more verbose error message.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/evaluate.c | 9 +++++----
.../testcases/bogons/nft-f/empty_geneve_definition_crash | 4 ++++
2 files changed, 9 insertions(+), 4 deletions(-)
create mode 100644 tests/shell/testcases/bogons/nft-f/empty_geneve_definition_crash
diff --git a/src/evaluate.c b/src/evaluate.c
index 0c7d90f8f43b..ac482c83cce2 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -5865,11 +5865,12 @@ static int tunnel_evaluate(struct eval_ctx *ctx, struct obj *obj)
obj->tunnel.dst->dtype->size);
if (expr_evaluate(ctx, &obj->tunnel.dst) < 0)
return -1;
- }
- if (obj->tunnel.src->dtype != obj->tunnel.dst->dtype)
- return __stmt_binary_error(ctx, &obj->location, NULL,
- "specify either ip or ip6 for address");
+ if (obj->tunnel.src &&
+ obj->tunnel.src->dtype != obj->tunnel.dst->dtype)
+ return __stmt_binary_error(ctx, &obj->location, NULL,
+ "specify either ip or ip6 for address");
+ }
return 0;
}
diff --git a/tests/shell/testcases/bogons/nft-f/empty_geneve_definition_crash b/tests/shell/testcases/bogons/nft-f/empty_geneve_definition_crash
new file mode 100644
index 000000000000..d1bc76c56bd5
--- /dev/null
+++ b/tests/shell/testcases/bogons/nft-f/empty_geneve_definition_crash
@@ -0,0 +1,4 @@
+table netdev x {
+ tunnel geneve-t {
+ }
+}
--
2.51.0
next prev parent reply other threads:[~2025-10-16 15:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 14:59 [PATCH nft 0/4] nft tunnel mode parser/eval fixes Florian Westphal
2025-10-16 14:59 ` Florian Westphal [this message]
2025-10-16 23:37 ` [PATCH nft 1/4] evaluate: tunnel: don't assume src is set Fernando Fernandez Mancera
2025-10-16 14:59 ` [PATCH nft 2/4] src: tunnel src/dst must be a symbolic expression Florian Westphal
2025-10-16 23:39 ` Fernando Fernandez Mancera
2025-10-16 14:59 ` [PATCH nft 3/4] src: parser_bison: prevent multiple ip daddr/saddr definitions Florian Westphal
2025-10-16 23:41 ` Fernando Fernandez Mancera
2025-10-16 14:59 ` [PATCH nft 4/4] evaluate: reject tunnel section if another one is already present Florian Westphal
2025-10-16 23:44 ` Fernando Fernandez Mancera
2025-10-16 23:46 ` [PATCH nft 0/4] nft tunnel mode parser/eval fixes Fernando Fernandez Mancera
2025-10-17 9:39 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251016145955.7785-2-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).