From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] evaluate: don't update cache for anonymous chains
Date: Fri, 21 Mar 2025 12:46:38 +0100 [thread overview]
Message-ID: <20250321114641.9510-1-fw@strlen.de> (raw)
Chain lookup needs a name, not a numerical id.
After patch, loading bogon gives following errors:
Error: No such file or directory chain c {
Error: No symbol type information a b index 1 10.1.26.a
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/evaluate.c | 3 +++
.../bogons/nft-f/null_deref_on_anon_chain_update_crash | 8 ++++++++
2 files changed, 11 insertions(+)
create mode 100644 tests/shell/testcases/bogons/nft-f/null_deref_on_anon_chain_update_crash
diff --git a/src/evaluate.c b/src/evaluate.c
index a27961193da5..09df7f158acc 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -5371,6 +5371,9 @@ static int rule_cache_update(struct eval_ctx *ctx, enum cmd_ops op)
if (!table)
return table_not_found(ctx);
+ if (!rule->handle.chain.name)
+ return chain_not_found(ctx);
+
chain = chain_cache_find(table, rule->handle.chain.name);
if (!chain)
return chain_not_found(ctx);
diff --git a/tests/shell/testcases/bogons/nft-f/null_deref_on_anon_chain_update_crash b/tests/shell/testcases/bogons/nft-f/null_deref_on_anon_chain_update_crash
new file mode 100644
index 000000000000..310486c59ee0
--- /dev/null
+++ b/tests/shell/testcases/bogons/nft-f/null_deref_on_anon_chain_update_crash
@@ -0,0 +1,8 @@
+table ip f {
+ chain c {
+ jump {
+ accept
+ }
+ }
+}
+a b index 1 10.1.26.a
--
2.48.1
next reply other threads:[~2025-03-21 11:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 11:46 Florian Westphal [this message]
2025-03-21 12:53 ` [PATCH nft] evaluate: don't update cache for anonymous chains Pablo Neira Ayuso
2025-03-21 14:31 ` 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=20250321114641.9510-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.