Commit 9b3eb5edf33897dc9128aa27300066153d4f8b9c

Authored by Pravin B Shelar
Committed by David S. Miller
1 parent 83401eb499

gre: Fix GREv4 TCPv6 segmentation.

For ipv6 traffic, GRE can generate packet with strange GSO
bits, e.g. ipv4 packet with SKB_GSO_TCPV6 flag set.  Therefore
following patch relaxes check in inet gso handler to allow
such packet for segmentation.
This patch also fixes wrong skb->protocol set that was done in
gre_gso_segment() handler.

Reported-by: Steinar H. Gunderson <sesse@google.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -1293,6 +1293,7 @@
1293 1293 SKB_GSO_DODGY |
1294 1294 SKB_GSO_TCP_ECN |
1295 1295 SKB_GSO_GRE |
  1296 + SKB_GSO_TCPV6 |
1296 1297 SKB_GSO_UDP_TUNNEL |
1297 1298 0)))
1298 1299 goto out;
... ... @@ -121,6 +121,7 @@
121 121 int ghl = GRE_HEADER_SECTION;
122 122 struct gre_base_hdr *greh;
123 123 int mac_len = skb->mac_len;
  124 + __be16 protocol = skb->protocol;
124 125 int tnl_hlen;
125 126 bool csum;
126 127  
... ... @@ -150,7 +151,7 @@
150 151  
151 152 /* setup inner skb. */
152 153 if (greh->protocol == htons(ETH_P_TEB)) {
153   - struct ethhdr *eth = eth_hdr(skb);
  154 + struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb);
154 155 skb->protocol = eth->h_proto;
155 156 } else {
156 157 skb->protocol = greh->protocol;
... ... @@ -199,6 +200,7 @@
199 200 skb_reset_mac_header(skb);
200 201 skb_set_network_header(skb, mac_len);
201 202 skb->mac_len = mac_len;
  203 + skb->protocol = protocol;
202 204 } while ((skb = skb->next));
203 205 out:
204 206 return segs;