Skip to contentSkip to conversation

gre: Use inner mac length when computing tunnel length

PATCH In review Tom Herbert 3 participants 3 messages Oct 30, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gre: Use inner mac length when computing tunnel length

Currently, skb_inner_network_header is used but this does not account for Ethernet header for ETH_P_TEB. Use skb_inner_mac_header which handles TEB and also should work with IP encapsulation in which case inner mac and inner network headers are the same.

Tested: Ran TCP_STREAM over GRE, worked as expected.

---
 net/ipv4/gre_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/gre_offload.c +1 -1
index f6e345c..bb5947b 100644
@@ -47,7 +47,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 
 	greh = (struct gre_base_hdr *)skb_transport_header(skb);
 
-	ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
+	ghl = skb_inner_mac_header(skb) - skb_transport_header(skb);
 	if (unlikely(ghl < sizeof(*greh)))
 		goto out;
 
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Tom Herbert

Currently, skb_inner_network_header is used but this does not account for Ethernet header for ETH_P_TEB. Use skb_inner_mac_header which handles TEB and also should work with IP encapsulation in which case inner mac and inner network headers are the same.

Tested: Ran TCP_STREAM over GRE, worked as expected.

---
  net/ipv4/gre_offload.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/gre_offload.c +0 -0
index f6e345c..bb5947b 100644

net/ipv4/gre_offload.c static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · line 53

Quoted 8 lines
net/ipv4/gre_offload.c +1 -1
@@ -47,7 +47,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 
  	greh = (struct gre_base_hdr *)skb_transport_header(skb);
 
-	ghl = skb_inner_network_header(skb) - skb_transport_header(skb);
+	ghl = skb_inner_mac_header(skb) - skb_transport_header(skb);
  	if (unlikely(ghl < sizeof(*greh)))
  		goto out;
 

This works for me. We probably need to queue this up for stable as well since this bug goes back as far as 3.14.

maintainer
#2 lore raw
In reply to Tom Herbert

From: Tom Herbert <[email protected]>
Date: Thu, 30 Oct 2014 08:40:56 -0700

Quoted 8 lines

Currently, skb_inner_network_header is used but this does not account for Ethernet header for ETH_P_TEB. Use skb_inner_mac_header which handles TEB and also should work with IP encapsulation in which case inner mac and inner network headers are the same.

Tested: Ran TCP_STREAM over GRE, worked as expected.

Applied and queued up for -stable.

Thanks everyone.