Skip to content

Commit

Permalink
esp6: support ipv6 nexthdrs process for beet gso segment
Browse files Browse the repository at this point in the history
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: 7f9e40e ("esp6: add gso_segment for esp6 beet mode")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Xin Long authored and Steffen Klassert committed Apr 21, 2020
1 parent 9f0cadc commit 25a44ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/ipv6/esp6_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,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;

Expand All @@ -182,7 +182,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));

Expand Down

0 comments on commit 25a44ae

Please sign in to comment.