From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>,
<netdev@vger.kernel.org>
Subject: [PATCH 5/5] xfrm: set skb control buffer based on packet offload as well
Date: Wed, 6 Mar 2024 11:04:38 +0100 [thread overview]
Message-ID: <20240306100438.3953516-6-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20240306100438.3953516-1-steffen.klassert@secunet.com>
From: Mike Yu <yumike@google.com>
In packet offload, packets are not encrypted in XFRM stack, so
the next network layer which the packets will be forwarded to
should depend on where the packet came from (either xfrm4_output
or xfrm6_output) rather than the matched SA's family type.
Test: verified IPv6-in-IPv4 packets on Android device with
IPsec packet offload enabled
Signed-off-by: Mike Yu <yumike@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_output.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 662c83beb345..e5722c95b8bb 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -704,9 +704,13 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
{
struct net *net = dev_net(skb_dst(skb)->dev);
struct xfrm_state *x = skb_dst(skb)->xfrm;
+ int family;
int err;
- switch (x->outer_mode.family) {
+ family = (x->xso.type != XFRM_DEV_OFFLOAD_PACKET) ? x->outer_mode.family
+ : skb_dst(skb)->ops->family;
+
+ switch (family) {
case AF_INET:
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
--
2.34.1
prev parent reply other threads:[~2024-03-06 10:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 10:04 [PATCH 0/5] pull request (net): ipsec 2024-03-06 Steffen Klassert
2024-03-06 10:04 ` [PATCH 1/5] xfrm: Clear low order bits of ->flowi4_tos in decode_session4() Steffen Klassert
2024-03-07 5:00 ` patchwork-bot+netdevbpf
2024-03-06 10:04 ` [PATCH 2/5] xfrm: Pass UDP encapsulation in TX packet offload Steffen Klassert
2024-03-11 16:25 ` Paolo Abeni
2024-03-11 17:05 ` Jakub Kicinski
2024-03-12 2:46 ` Jakub Kicinski
2024-03-12 6:20 ` Steffen Klassert
2024-03-12 11:15 ` Leon Romanovsky
2024-03-12 11:20 ` Steffen Klassert
2024-03-12 11:26 ` Leon Romanovsky
2024-03-12 11:36 ` Steffen Klassert
2024-03-06 10:04 ` [PATCH 3/5] xfrm: Avoid clang fortify warning in copy_to_user_tmpl() Steffen Klassert
2024-03-06 10:04 ` [PATCH 4/5] xfrm: fix xfrm child route lookup for packet offload Steffen Klassert
2024-03-06 10:04 ` Steffen Klassert [this message]
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=20240306100438.3953516-6-steffen.klassert@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=netdev@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).