From: Kyle Zeng <kylebot@openai.com>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, Kyle Zeng <kylebot@openai.com>
Subject: [PATCH] netfilter: nf_conntrack: validate template helper protocol
Date: Mon, 10 Aug 2026 15:16:28 -0700 [thread overview]
Message-ID: <20260810221628.34800-1-kylebot@openai.com> (raw)
nftables compatibility metadata is used to select an xt_CT helper when
the conntrack template is created, but it does not constrain the protocol
of packets evaluated by the rule. A template can therefore carry a helper
for one transport protocol into a conntrack for another.
Only copy a helper from a template when its registered transport protocol
matches the new conntrack tuple. This restores the invariant expected by
helper callbacks and matches the protocol validation already performed by
native nftables helper assignment and the OVS helper path.
Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables")
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Kyle Zeng <kylebot@openai.com>
---
net/netfilter/nf_conntrack_helper.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 500509b17..419af6f76 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -205,6 +205,8 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
help = nfct_help(tmpl);
if (help)
helper = rcu_dereference(help->helper);
+ if (helper && helper->tuple.dst.protonum != nf_ct_protonum(ct))
+ helper = NULL;
help = nfct_help(ct);
--
2.53.0
reply other threads:[~2026-08-10 22:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260810221628.34800-1-kylebot@openai.com \
--to=kylebot@openai.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/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