Skip to content

Commit

Permalink
xfrm: Fix GSO for IPsec with GRE tunnel.
Browse files Browse the repository at this point in the history
We reset the encapsulation field of the skb too early
in xfrm_output. As a result, the GRE GSO handler does
not segment the packets. This leads to a performance
drop down. We fix this by resetting the encapsulation
field right before we do the transformation, when
the inner headers become invalid.

Fixes: f1bd7d6 ("xfrm: Add encapsulation header offsets while SKB is not encrypted")
Reported-by: Vicente De Luca <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
klassert committed Oct 31, 2017
1 parent 2b06cdf commit 73b9fc4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/xfrm/xfrm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
if (xfrm_offload(skb)) {
x->type_offload->encap(x, skb);
} else {
/* Inner headers are invalid now. */
skb->encapsulation = 0;

err = x->type->output(x, skb);
if (err == -EINPROGRESS)
goto out;
Expand Down Expand Up @@ -208,7 +211,6 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
int err;

secpath_reset(skb);
skb->encapsulation = 0;

if (xfrm_dev_offload_ok(skb, x)) {
struct sec_path *sp;
Expand Down

0 comments on commit 73b9fc4

Please sign in to comment.