Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation.
@ 2013-05-03  2:14 Pravin B Shelar
  2013-05-03  3:00 ` Eric Dumazet
  2013-05-03 20:11 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Pravin B Shelar @ 2013-05-03  2:14 UTC (permalink / raw)
  To: netdev; +Cc: sesse, Pravin B Shelar, Eric Dumazet

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>
---
Same issue exist in 3.8.
---
 net/ipv4/af_inet.c |    1 +
 net/ipv4/gre.c     |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index c61b3bb..d01be2a 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1293,6 +1293,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
 		       SKB_GSO_DODGY |
 		       SKB_GSO_TCP_ECN |
 		       SKB_GSO_GRE |
+		       SKB_GSO_TCPV6 |
 		       SKB_GSO_UDP_TUNNEL |
 		       0)))
 		goto out;
diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c
index d2d5a99..cc22363 100644
--- a/net/ipv4/gre.c
+++ b/net/ipv4/gre.c
@@ -121,6 +121,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 	int ghl = GRE_HEADER_SECTION;
 	struct gre_base_hdr *greh;
 	int mac_len = skb->mac_len;
+	__be16 protocol = skb->protocol;
 	int tnl_hlen;
 	bool csum;
 
@@ -150,7 +151,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 
 	/* setup inner skb. */
 	if (greh->protocol == htons(ETH_P_TEB)) {
-		struct ethhdr *eth = eth_hdr(skb);
+		struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb);
 		skb->protocol = eth->h_proto;
 	} else {
 		skb->protocol = greh->protocol;
@@ -199,6 +200,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 		skb_reset_mac_header(skb);
 		skb_set_network_header(skb, mac_len);
 		skb->mac_len = mac_len;
+		skb->protocol = protocol;
 	} while ((skb = skb->next));
 out:
 	return segs;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation.
  2013-05-03  2:14 [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation Pravin B Shelar
@ 2013-05-03  3:00 ` Eric Dumazet
  2013-05-03 20:11 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2013-05-03  3:00 UTC (permalink / raw)
  To: Pravin B Shelar; +Cc: netdev, sesse

On Thu, 2013-05-02 at 19:14 -0700, Pravin B Shelar wrote:
> 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>
> ---
> Same issue exist in 3.8.
> ---

Thanks a lot.

I did a quick test and it appears to fix the problem.

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation.
  2013-05-03  2:14 [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation Pravin B Shelar
  2013-05-03  3:00 ` Eric Dumazet
@ 2013-05-03 20:11 ` David Miller
  2013-05-03 22:54   ` Pravin Shelar
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2013-05-03 20:11 UTC (permalink / raw)
  To: pshelar; +Cc: netdev, sesse, eric.dumazet

From: Pravin B Shelar <pshelar@nicira.com>
Date: Thu,  2 May 2013 19:14:19 -0700

> 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>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation.
  2013-05-03 20:11 ` David Miller
@ 2013-05-03 22:54   ` Pravin Shelar
  2013-05-04  3:18     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Pravin Shelar @ 2013-05-03 22:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, sesse, eric.dumazet

On Fri, May 3, 2013 at 1:11 PM, David Miller <davem@davemloft.net> wrote:
> From: Pravin B Shelar <pshelar@nicira.com>
> Date: Thu,  2 May 2013 19:14:19 -0700
>
>> 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>
>
> Applied.

Hi David,

This patch needs to be queued for -stable.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation.
  2013-05-03 22:54   ` Pravin Shelar
@ 2013-05-04  3:18     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-05-04  3:18 UTC (permalink / raw)
  To: pshelar; +Cc: netdev, sesse, eric.dumazet

From: Pravin Shelar <pshelar@nicira.com>
Date: Fri, 3 May 2013 15:54:11 -0700

> On Fri, May 3, 2013 at 1:11 PM, David Miller <davem@davemloft.net> wrote:
>> From: Pravin B Shelar <pshelar@nicira.com>
>> Date: Thu,  2 May 2013 19:14:19 -0700
>>
>>> 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>
>>
>> Applied.
> 
> Hi David,
> 
> This patch needs to be queued for -stable.

Added, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-04  3:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03  2:14 [PATCH net-next] gre: Fix GREv4 TCPv6 segmentation Pravin B Shelar
2013-05-03  3:00 ` Eric Dumazet
2013-05-03 20:11 ` David Miller
2013-05-03 22:54   ` Pravin Shelar
2013-05-04  3:18     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox