aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/gre_demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/gre_demux.c')
-rw-r--r--net/ipv4/gre_demux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 0485bf7f8f03..4a7b5b2a1ce3 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);
98static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, 98static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
99 bool *csum_err) 99 bool *csum_err)
100{ 100{
101 unsigned int ip_hlen = ip_hdrlen(skb);
102 const struct gre_base_hdr *greh; 101 const struct gre_base_hdr *greh;
103 __be32 *options; 102 __be32 *options;
104 int hdr_len; 103 int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
106 if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr)))) 105 if (unlikely(!pskb_may_pull(skb, sizeof(struct gre_base_hdr))))
107 return -EINVAL; 106 return -EINVAL;
108 107
109 greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen); 108 greh = (struct gre_base_hdr *)skb_transport_header(skb);
110 if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING))) 109 if (unlikely(greh->flags & (GRE_VERSION | GRE_ROUTING)))
111 return -EINVAL; 110 return -EINVAL;
112 111
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
116 if (!pskb_may_pull(skb, hdr_len)) 115 if (!pskb_may_pull(skb, hdr_len))
117 return -EINVAL; 116 return -EINVAL;
118 117
119 greh = (struct gre_base_hdr *)(skb_network_header(skb) + ip_hlen); 118 greh = (struct gre_base_hdr *)skb_transport_header(skb);
120 tpi->proto = greh->protocol; 119 tpi->proto = greh->protocol;
121 120
122 options = (__be32 *)(greh + 1); 121 options = (__be32 *)(greh + 1);
@@ -125,6 +124,10 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
125 *csum_err = true; 124 *csum_err = true;
126 return -EINVAL; 125 return -EINVAL;
127 } 126 }
127
128 skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
129 null_compute_pseudo);
130
128 options++; 131 options++;
129 } 132 }
130 133