From: Sabrina Dubroca <sd@queasysnail.net>
To: Jianbo Liu <jianbol@nvidia.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
steffen.klassert@secunet.com, Cosmin Ratiu <cratiu@nvidia.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next 2/3] xfrm: Check inner packet family directly from skb_dst
Date: Fri, 24 Oct 2025 13:26:40 +0200 [thread overview]
Message-ID: <aPticHQQSugMGgs1@krikkit> (raw)
In-Reply-To: <20251024023931.65002-3-jianbol@nvidia.com>
Some general notes:
- ipsec patches should go through the ipsec/ipsec-next trees
maintained by Steffen, not net/net-next directly, and use
ipsec/ipsec-next in the subject prefix
- this patch looks more like a bugfix, so it should target the ipsec
tree and have a Fixes tag, instead of -next
2025-10-24, 05:31:36 +0300, Jianbo Liu wrote:
> In the output path, xfrm_dev_offload_ok and xfrm_get_inner_ipproto
> need to determine the protocol family of the inner packet (skb) before
> it gets encapsulated.
>
> In xfrm_dev_offload_ok, the code checked x->inner_mode.family. This is
> incorrect because the state's true inner family might be specified in
> x->inner_mode_iaf.family (e.g., for tunnel mode).
I wouldn't say inner_mode_iaf.family is the "true" inner family. AFAIU
it's the other possible inner family for states that accept both
(I got that wrong in 91d8a53db219 ("xfrm: fix offloading of
cross-family tunnels")).
> In xfrm_get_inner_ipproto, the code checked x->outer_mode.family. This
> is also incorrect for tunnel mode, as the inner packet's family can be
> different from the outer header's family.
>
> At both of these call sites, the skb variable holds the original inner
> packet. The most direct and reliable source of truth for its protocol
> family is its destination entry.
(the IP version would also work since it's in the same place for both
v4 and v6, but we have other uses of dst family in xfrm_output so it
should be fine)
> This patch fixes the issue by using
> skb_dst(skb)->ops->family to ensure protocol-specific headers are only
> accessed for the correct packet type.
Do you have an example of problematic setup? I didn't run into that
when I wrote 91d8a53db219.
--
Sabrina
next prev parent reply other threads:[~2025-10-24 11:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 2:31 [PATCH net-next 0/3] xfrm: Correct inner packet family determination Jianbo Liu
2025-10-24 2:31 ` [PATCH net-next 1/3] xfrm: Remove redundant state inner mode check Jianbo Liu
2025-10-24 2:31 ` [PATCH net-next 2/3] xfrm: Check inner packet family directly from skb_dst Jianbo Liu
2025-10-24 11:26 ` Sabrina Dubroca [this message]
2025-10-27 1:50 ` Jianbo Liu
2025-10-24 2:31 ` [PATCH net-next 3/3] xfrm: Determine inner GSO type from packet inner protocol Jianbo Liu
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=aPticHQQSugMGgs1@krikkit \
--to=sd@queasysnail.net \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=jianbol@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.com \
/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).