From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 3/4] src: parser_bison: prevent multiple ip daddr/saddr definitions
Date: Thu, 16 Oct 2025 16:59:35 +0200 [thread overview]
Message-ID: <20251016145955.7785-4-fw@strlen.de> (raw)
In-Reply-To: <20251016145955.7785-1-fw@strlen.de>
minor change to the bogon makes it assert because symbolic expression
will have wrong refcount (2) at scope teardown.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/parser_bison.y | 17 +++++++++++++++++
.../bogons/nft-f/tunnel_with_anon_set_assert | 1 +
2 files changed, 18 insertions(+)
diff --git a/src/parser_bison.y b/src/parser_bison.y
index b63c7df18a35..4e028d31c165 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -5070,21 +5070,38 @@ tunnel_config : ID NUM
}
| IP SADDR symbol_expr close_scope_ip
{
+ if (already_set($<obj>0->tunnel.src, &@3, state)) {
+ expr_free($3);
+ YYERROR;
+ }
+
$<obj>0->tunnel.src = $3;
datatype_set($3, &ipaddr_type);
}
| IP DADDR symbol_expr close_scope_ip
{
+ if (already_set($<obj>0->tunnel.dst, &@3, state)) {
+ expr_free($3);
+ YYERROR;
+ }
$<obj>0->tunnel.dst = $3;
datatype_set($3, &ipaddr_type);
}
| IP6 SADDR symbol_expr close_scope_ip6
{
+ if (already_set($<obj>0->tunnel.src, &@3, state)) {
+ expr_free($3);
+ YYERROR;
+ }
$<obj>0->tunnel.src = $3;
datatype_set($3, &ip6addr_type);
}
| IP6 DADDR symbol_expr close_scope_ip6
{
+ if (already_set($<obj>0->tunnel.dst, &@3, state)) {
+ expr_free($3);
+ YYERROR;
+ }
$<obj>0->tunnel.dst = $3;
datatype_set($3, &ip6addr_type);
}
diff --git a/tests/shell/testcases/bogons/nft-f/tunnel_with_anon_set_assert b/tests/shell/testcases/bogons/nft-f/tunnel_with_anon_set_assert
index 6f7b212aefef..d02568944301 100644
--- a/tests/shell/testcases/bogons/nft-f/tunnel_with_anon_set_assert
+++ b/tests/shell/testcases/bogons/nft-f/tunnel_with_anon_set_assert
@@ -3,6 +3,7 @@ define s = { 1.2.3.4, 5.6.7.8 }
table netdev x {
tunnel t {
ip saddr $s
+ ip saddr $s
}
}
--
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 ` [PATCH nft 1/4] evaluate: tunnel: don't assume src is set Florian Westphal
2025-10-16 23:37 ` 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 ` Florian Westphal [this message]
2025-10-16 23:41 ` [PATCH nft 3/4] src: parser_bison: prevent multiple ip daddr/saddr definitions 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-4-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).