netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ipv6: Add GSO support on forwarding path
@ 2010-05-26 10:27 Herbert Xu
  2010-05-26 15:20 ` Ralf Baechle
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2010-05-26 10:27 UTC (permalink / raw)
  To: Ralf Baechle, David S. Miller, netdev

Hi:

ipv6: Add GSO support on forwarding path

Currently we disallow GSO packets on the IPv6 forward path.
This patch fixes this.

Note that I discovered that our existing GSO MTU checks (e.g.,
IPv4 forwarding) are buggy in that they skip the check altogether, 
hen they really should be checking gso_size instead.

I have also been lazy here in that I haven't bothered to segment
the GSO packet by hand before generating an ICMP message.  Someone
should add that to be 100% correct.

Reported-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7cdfb4d..64f9c5a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2117,6 +2117,13 @@ static inline int skb_is_gso(const struct sk_buff *skb)
 	return skb_shinfo(skb)->gso_size;
 }
 
+static inline int skb_gso_len(const struct sk_buff *skb)
+{
+	return skb_is_gso(skb) ?
+	       skb_shinfo(skb)->gso_size + skb_transport_offset(skb) :
+	       skb->len;
+}
+
 static inline int skb_is_gso_v6(const struct sk_buff *skb)
 {
 	return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cd963f6..8904767 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -507,7 +507,7 @@ int ip6_forward(struct sk_buff *skb)
 	if (mtu < IPV6_MIN_MTU)
 		mtu = IPV6_MIN_MTU;
 
-	if (skb->len > mtu) {
+	if (skb_gso_len(skb) > mtu) {
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-26 10:27 ipv6: Add GSO support on forwarding path Herbert Xu
@ 2010-05-26 15:20 ` Ralf Baechle
  2010-05-26 22:16   ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2010-05-26 15:20 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Wed, May 26, 2010 at 08:27:58PM +1000, Herbert Xu wrote:

> ipv6: Add GSO support on forwarding path
> 
> Currently we disallow GSO packets on the IPv6 forward path.
> This patch fixes this.
> 
> Note that I discovered that our existing GSO MTU checks (e.g.,
> IPv4 forwarding) are buggy in that they skip the check altogether, 
> hen they really should be checking gso_size instead.
> 
> I have also been lazy here in that I haven't bothered to segment
> the GSO packet by hand before generating an ICMP message.  Someone
> should add that to be 100% correct.
> 
> Reported-by: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

I tested this on top of a 2.6.34 release kernel and asked the user
experiencing the problem to re-test and the problem still persists.

Unlike what I told you earlier on IRC my tester can trigger the issue
by going to any page on linux-ax25.org from any XP, Vista or Windows 7
client.

I've got three tcpdumps of the hang occuring on ftp.linux-ax25.org

  /pub/dl1bff.log
  /pub/dl1bff-2.log
  /pub/dl1bff-3.log

The first two were taken with a 2.6.32 Fedora 12 kernel; the 3rd with
a stock 2.6.34 kernel and your patch applied on top.  The issue exists
for quite a while; it has first been noticed with Fedora 11.

  Ralf

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-26 15:20 ` Ralf Baechle
@ 2010-05-26 22:16   ` Herbert Xu
  2010-05-27  9:22     ` Ralf Baechle
  2010-05-27 10:24     ` Herbert Xu
  0 siblings, 2 replies; 8+ messages in thread
From: Herbert Xu @ 2010-05-26 22:16 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David S. Miller, netdev

On Wed, May 26, 2010 at 04:20:19PM +0100, Ralf Baechle wrote:
> 
> I tested this on top of a 2.6.34 release kernel and asked the user
> experiencing the problem to re-test and the problem still persists.

OK, it looks like my patch doesn't work because the transport
header isn't set on the forwarding path.  Here's an updated patch:

ipv6: Add GSO support on forwarding path

Currently we disallow GSO packets on the IPv6 forward path.
This patch fixes this.

Note that I discovered that our existing GSO MTU checks (e.g.,
IPv4 forwarding) are buggy in that they skip the check altogether, 
hen they really should be checking gso_size instead.

I have also been lazy here in that I haven't bothered to segment
the GSO packet by hand before generating an ICMP message.  Someone
should add that to be 100% correct.

Reported-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7cdfb4d..6ec5238 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2117,6 +2117,13 @@ static inline int skb_is_gso(const struct sk_buff *skb)
 	return skb_shinfo(skb)->gso_size;
 }
 
+static inline int skb_gso_len(const struct sk_buff *skb)
+{
+	return skb_is_gso(skb) ?
+	       skb_shinfo(skb)->gso_size +
+	       (skb->csum_start - skb_headroom(skb)) : skb->len;
+}
+
 static inline int skb_is_gso_v6(const struct sk_buff *skb)
 {
 	return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cd963f6..8904767 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -507,7 +507,7 @@ int ip6_forward(struct sk_buff *skb)
 	if (mtu < IPV6_MIN_MTU)
 		mtu = IPV6_MIN_MTU;
 
-	if (skb->len > mtu) {
+	if (skb_gso_len(skb) > mtu) {
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-26 22:16   ` Herbert Xu
@ 2010-05-27  9:22     ` Ralf Baechle
  2010-05-27 10:14       ` Ralf Baechle
  2010-05-27 10:24     ` Herbert Xu
  1 sibling, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2010-05-27  9:22 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Thu, May 27, 2010 at 08:16:01AM +1000, Herbert Xu wrote:

> > I tested this on top of a 2.6.34 release kernel and asked the user
> > experiencing the problem to re-test and the problem still persists.
> 
> OK, it looks like my patch doesn't work because the transport
> header isn't set on the forwarding path.  Here's an updated patch:

Still no improvment.  I've moved all the collected tcpdumps to
ftp://www.linux-ax25.org/pub/traces/ including a README file describing
contents.

  Ralf

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-27  9:22     ` Ralf Baechle
@ 2010-05-27 10:14       ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2010-05-27 10:14 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Thu, May 27, 2010 at 10:22:46AM +0100, Ralf Baechle wrote:

> > > I tested this on top of a 2.6.34 release kernel and asked the user
> > > experiencing the problem to re-test and the problem still persists.
> > 
> > OK, it looks like my patch doesn't work because the transport
> > header isn't set on the forwarding path.  Here's an updated patch:
> 
> Still no improvment.  I've moved all the collected tcpdumps to
> ftp://www.linux-ax25.org/pub/traces/ including a README file describing
> contents.

Uh..  Of course I should have upgraded the host not the client.  And
after having done that things are working fine now.  Thanks!

  Ralf

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-26 22:16   ` Herbert Xu
  2010-05-27  9:22     ` Ralf Baechle
@ 2010-05-27 10:24     ` Herbert Xu
  2010-05-27 11:54       ` Herbert Xu
  1 sibling, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2010-05-27 10:24 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David S. Miller, netdev

On Thu, May 27, 2010 at 08:16:01AM +1000, Herbert Xu wrote:
> 
> OK, it looks like my patch doesn't work because the transport
> header isn't set on the forwarding path.  Here's an updated patch:
> 
> ipv6: Add GSO support on forwarding path

Actually, this patch is still not quite right for the GSO case.
Right now it's only adding the IP header size, not the full header
size.

I need to think a bit more about this.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-27 10:24     ` Herbert Xu
@ 2010-05-27 11:54       ` Herbert Xu
  2010-05-27 23:14         ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2010-05-27 11:54 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David S. Miller, netdev

On Thu, May 27, 2010 at 08:24:29PM +1000, Herbert Xu wrote:
> 
> Actually, this patch is still not quite right for the GSO case.
> Right now it's only adding the IP header size, not the full header
> size.
> 
> I need to think a bit more about this.

Let's do it the old way first, so that it at least works for the
common case.  I'll fix it properly later.

ipv6: Add GSO support on forwarding path

Currently we disallow GSO packets on the IPv6 forward path.
This patch fixes this.

Note that I discovered that our existing GSO MTU checks (e.g.,
IPv4 forwarding) are buggy in that they skip the check altogether, 
hen they really should be checking gso_size + header instead.

I have also been lazy here in that I haven't bothered to segment
the GSO packet by hand before generating an ICMP message.  Someone
should add that to be 100% correct.

Reported-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cd963f6..89425af 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -507,7 +507,7 @@ int ip6_forward(struct sk_buff *skb)
 	if (mtu < IPV6_MIN_MTU)
 		mtu = IPV6_MIN_MTU;
 
-	if (skb->len > mtu) {
+	if (skb->len > mtu && !skb_is_gso(skb)) {
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: ipv6: Add GSO support on forwarding path
  2010-05-27 11:54       ` Herbert Xu
@ 2010-05-27 23:14         ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-05-27 23:14 UTC (permalink / raw)
  To: herbert; +Cc: ralf, netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 27 May 2010 21:54:40 +1000

> On Thu, May 27, 2010 at 08:24:29PM +1000, Herbert Xu wrote:
>> 
>> Actually, this patch is still not quite right for the GSO case.
>> Right now it's only adding the IP header size, not the full header
>> size.
>> 
>> I need to think a bit more about this.
> 
> Let's do it the old way first, so that it at least works for the
> common case.  I'll fix it properly later.
> 
> ipv6: Add GSO support on forwarding path

Ok, applied, thanks Herbert.

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

end of thread, other threads:[~2010-05-27 23:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 10:27 ipv6: Add GSO support on forwarding path Herbert Xu
2010-05-26 15:20 ` Ralf Baechle
2010-05-26 22:16   ` Herbert Xu
2010-05-27  9:22     ` Ralf Baechle
2010-05-27 10:14       ` Ralf Baechle
2010-05-27 10:24     ` Herbert Xu
2010-05-27 11:54       ` Herbert Xu
2010-05-27 23:14         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).