Skip to content

Commit c3caf11

Browse files
hkchudavem330
authored andcommitted
net-gre-gro: Fix a bug that breaks the forwarding path
Fixed a bug that was introduced by my GRE-GRO patch (bf5a755 net-gre-gro: Add GRE support to the GRO stack) that breaks the forwarding path because various GSO related fields were not set. The bug will cause on the egress path either the GSO code to fail, or a GRE-TSO capable (NETIF_F_GSO_GRE) NICs to choke. The following fix has been tested for both cases. Signed-off-by: H.K. Jerry Chu <hkchu@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b6603fe commit c3caf11

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

net/core/dev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4096,6 +4096,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
40964096
skb->vlan_tci = 0;
40974097
skb->dev = napi->dev;
40984098
skb->skb_iif = 0;
4099+
skb->encapsulation = 0;
4100+
skb_shinfo(skb)->gso_type = 0;
40994101
skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
41004102

41014103
napi->skb = skb;

net/ipv4/af_inet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,9 @@ static int inet_gro_complete(struct sk_buff *skb, int nhoff)
14291429
int proto = iph->protocol;
14301430
int err = -ENOSYS;
14311431

1432+
if (skb->encapsulation)
1433+
skb_set_inner_network_header(skb, nhoff);
1434+
14321435
csum_replace2(&iph->check, iph->tot_len, newlen);
14331436
iph->tot_len = newlen;
14341437

net/ipv4/gre_offload.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff)
263263
int err = -ENOENT;
264264
__be16 type;
265265

266+
skb->encapsulation = 1;
267+
skb_shinfo(skb)->gso_type = SKB_GSO_GRE;
268+
266269
type = greh->protocol;
267270
if (greh->flags & GRE_KEY)
268271
grehlen += GRE_HEADER_SECTION;

net/ipv4/tcp_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff)
309309

310310
th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr,
311311
iph->daddr, 0);
312-
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
312+
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
313313

314314
return tcp_gro_complete(skb);
315315
}

net/ipv6/tcpv6_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int tcp6_gro_complete(struct sk_buff *skb, int thoff)
7373

7474
th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr,
7575
&iph->daddr, 0);
76-
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
76+
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;
7777

7878
return tcp_gro_complete(skb);
7979
}

0 commit comments

Comments
 (0)