* [PATCHv2 ipsec] esp6: support ipv6 nexthdrs process for beet gso segment
@ 2020-04-19 8:10 Xin Long
2020-04-22 9:24 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2020-04-19 8:10 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert, Herbert Xu, David S. Miller, Sabrina Dubroca
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().
v1->v2:
- remove skb_transport_offset(), as it will always return 0
in xfrm6_beet_gso_segment(), thank Sabrina's check.
Fixes: 7f9e40eb18a9 ("esp6: add gso_segment for esp6 beet mode")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv6/esp6_offload.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index 8eab2c8..160943b 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -166,7 +166,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;
@@ -177,7 +177,12 @@ 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) {
+ __be16 frag;
+
+ skb->transport_header +=
+ ipv6_skip_exthdr(skb, 0, &proto, &frag);
+ } else {
skb->transport_header -=
(sizeof(struct ipv6hdr) - sizeof(struct iphdr));
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2 ipsec] esp6: support ipv6 nexthdrs process for beet gso segment
2020-04-19 8:10 [PATCHv2 ipsec] esp6: support ipv6 nexthdrs process for beet gso segment Xin Long
@ 2020-04-22 9:24 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2020-04-22 9:24 UTC (permalink / raw)
To: Xin Long; +Cc: netdev, Herbert Xu, David S. Miller, Sabrina Dubroca
On Sun, Apr 19, 2020 at 04:10:00PM +0800, Xin Long wrote:
> 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().
>
> v1->v2:
> - remove skb_transport_offset(), as it will always return 0
> in xfrm6_beet_gso_segment(), thank Sabrina's check.
>
> Fixes: 7f9e40eb18a9 ("esp6: add gso_segment for esp6 beet mode")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied, thanks a lot!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-22 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 8:10 [PATCHv2 ipsec] esp6: support ipv6 nexthdrs process for beet gso segment Xin Long
2020-04-22 9:24 ` Steffen Klassert
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.