]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ipv4/gre_demux.c
ipip: Setup and TX path for ipip/UDP foo-over-udp encapsulation
[karo-tx-linux.git] / net / ipv4 / gre_demux.c
index 0485bf7f8f030d59bc6e9ee499051e99d9ab53d6..4a7b5b2a1ce3ddbd79e9282051020a4509dd7fe5 100644 (file)
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);
 static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                            bool *csum_err)
 {
-       unsigned int ip_hlen = ip_hdrlen(skb);
        const struct gre_base_hdr *greh;
        __be32 *options;
        int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
        if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))
                return -EINVAL;
 
-       greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+       greh = (struct gre_base_hdr *)skb_transport_header(skb);
        if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
                return -EINVAL;
 
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
        if (!pskb_may_pull(skb, hdr_len))
                return -EINVAL;
 
-       greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen);
+       greh = (struct gre_base_hdr *)skb_transport_header(skb);
        tpi->proto = greh->protocol;
 
        options = (__be32 *)(greh + 1);
@@ -125,6 +124,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++;
        }