From: Xin Long <lucien.xin@gmail.com>
To: netdev@vger.kernel.org
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Sabrina Dubroca <sd@queasysnail.net>
Subject: [PATCH ipsec-next 4/5] esp6: support ipv6 nexthdrs process for beet gso segment
Date: Wed, 1 Apr 2020 16:59:24 +0800 [thread overview]
Message-ID: <585191d693fc74273d314d4dea9a781ccc7712c2.1585731430.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <3f782f13de69081251addd3b7b37d155805feba2.1585731430.git.lucien.xin@gmail.com>
In-Reply-To: <cover.1585731430.git.lucien.xin@gmail.com>
For beet mode, when it's ipv6 inner address with nexthdrs set,
the packet format might be:
----------------------------------------------------
| outer | | dest | | | ESP | ESP |
| IP6 hdr| ESP | opts.| TCP | Data | Trailer | ICV |
----------------------------------------------------
Before doing gso segment in xfrm6_beet_gso_segment(), it should
skip all nexthdrs and get the real transport proto, and set
transport_header properly.
This patch is to fix it by simply calling ipv6_skip_exthdr()
in xfrm6_beet_gso_segment().
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv6/esp6_offload.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index b828508..021f58c 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -173,7 +173,7 @@ static struct sk_buff *xfrm6_beet_gso_segment(struct xfrm_state *x,
struct xfrm_offload *xo = xfrm_offload(skb);
struct sk_buff *segs = ERR_PTR(-EINVAL);
const struct net_offload *ops;
- int proto = xo->proto;
+ u8 proto = xo->proto;
skb->transport_header += x->props.header_len;
@@ -184,7 +184,13 @@ static struct sk_buff *xfrm6_beet_gso_segment(struct xfrm_state *x,
proto = ph->nexthdr;
}
- if (x->sel.family != AF_INET6) {
+ if (x->sel.family == AF_INET6) {
+ int offset = skb_transport_offset(skb);
+ __be16 frag;
+
+ offset = ipv6_skip_exthdr(skb, offset, &proto, &frag);
+ skb->transport_header += offset;
+ } else {
skb->transport_header -=
(sizeof(struct ipv6hdr) - sizeof(struct iphdr));
--
2.1.0
next prev parent reply other threads:[~2020-04-01 9:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 8:59 [PATCH ipsec-next 0/5] xfrm: support ipv6 nexthdrs process in transport and beet modes Xin Long
2020-04-01 8:59 ` [PATCH ipsec-next 1/5] xfrm: allow to accept packets with ipv6 NEXTHDR_HOP in xfrm_input Xin Long
2020-04-01 8:59 ` [PATCH ipsec-next 2/5] xfrm: do pskb_pull properly in __xfrm_transport_prep Xin Long
2020-04-01 8:59 ` [PATCH ipsec-next 3/5] esp6: get the right proto for transport mode in esp6_gso_encap Xin Long
2020-04-01 8:59 ` Xin Long [this message]
2020-04-01 8:59 ` [PATCH ipsec-next 5/5] esp4: support ipv6 nexthdrs process for beet gso segment Xin Long
2020-04-01 9:34 ` [PATCH ipsec-next 0/5] xfrm: support ipv6 nexthdrs process in transport and beet modes Steffen Klassert
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=585191d693fc74273d314d4dea9a781ccc7712c2.1585731430.git.lucien.xin@gmail.com \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
--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).