gre: Add support for checksum unnecessary conversions
authorTom Herbert <therbert@google.com>
Sun, 31 Aug 2014 22:12:44 +0000 (15:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Sep 2014 04:36:28 +0000 (21:36 -0700)
Call skb_checksum_try_convert and skb_gro_checksum_try_convert
after checksum is found present and validated in the GRE header
for normal and GRO paths respectively.

In GRO path, call skb_gro_checksum_try_convert

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/gre_demux.c
net/ipv4/gre_offload.c

index 0485bf7f8f030d59bc6e9ee499051e99d9ab53d6..7e0756da873776aad0e534d0c85ed08629878ed4 100644 (file)
@@ -125,6 +125,10 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                        *csum_err = true;
                        return -EINVAL;
                }
+
+               skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
+                                        null_compute_pseudo);
+
                options++;
        }
 
index a4d7965fb8809de8ed1305d5afa2cf3142030c0b..d3fe2ac05167230985e44a4cfc2150b279717dc0 100644 (file)
@@ -172,10 +172,14 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
        }
 
        /* Don't bother verifying checksum if we're going to flush anyway. */
-       if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush &&
-           skb_gro_checksum_simple_validate(skb))
+       if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush) {
+               if (skb_gro_checksum_simple_validate(skb))
                        goto out_unlock;
 
+               skb_gro_checksum_try_convert(skb, IPPROTO_GRE, 0,
+                                            null_compute_pseudo);
+       }
+
        flush = 0;
 
        for (p = *head; p; p = p->next) {