aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_output.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2017-10-30 05:04:04 -0400
committerSteffen Klassert <steffen.klassert@secunet.com>2017-10-31 04:20:35 -0400
commit73b9fc49b4c0116a04eda3979f64ed9b540b153c (patch)
tree362ece5f48012511aabacfe60ba66a8104d8c12c /net/xfrm/xfrm_output.c
parent2b06cdf3e688b98fcc9945873b5d42792bd4eee0 (diff)
xfrm: Fix GSO for IPsec with GRE tunnel.
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: f1bd7d659ef0 ("xfrm: Add encapsulation header offsets while SKB is not encrypted") Reported-by: Vicente De Luca <vdeluca@zendesk.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_output.c')
-rw-r--r--net/xfrm/xfrm_output.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 31a2e6d34dba..73ad8c8ef344 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -105,6 +105,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
105 if (xfrm_offload(skb)) { 105 if (xfrm_offload(skb)) {
106 x->type_offload->encap(x, skb); 106 x->type_offload->encap(x, skb);
107 } else { 107 } else {
108 /* Inner headers are invalid now. */
109 skb->encapsulation = 0;
110
108 err = x->type->output(x, skb); 111 err = x->type->output(x, skb);
109 if (err == -EINPROGRESS) 112 if (err == -EINPROGRESS)
110 goto out; 113 goto out;
@@ -208,7 +211,6 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
208 int err; 211 int err;
209 212
210 secpath_reset(skb); 213 secpath_reset(skb);
211 skb->encapsulation = 0;
212 214
213 if (xfrm_dev_offload_ok(skb, x)) { 215 if (xfrm_dev_offload_ok(skb, x)) {
214 struct sec_path *sp; 216 struct sec_path *sp;