diff mbox

[net] gre: Use inner mac length when computing tunnel length

Message ID 1414683656-26493-1-git-send-email-therbert@google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Tom Herbert Oct. 30, 2014, 3:40 p.m. UTC
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.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/ipv4/gre_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Duyck Oct. 30, 2014, 3:52 p.m. UTC | #1
On 10/30/2014 08:40 AM, Tom Herbert wrote:
> 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.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>   net/ipv4/gre_offload.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
> index f6e345c..bb5947b 100644
> --- a/net/ipv4/gre_offload.c
> +++ b/net/ipv4/gre_offload.c
> @@ -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.

Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 30, 2014, 11:52 p.m. UTC | #2
From: Tom Herbert <therbert@google.com>
Date: Thu, 30 Oct 2014 08:40:56 -0700

> 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.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>

Applied and queued up for -stable.

Thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index f6e345c..bb5947b 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -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;