From patchwork Wed May 26 22:16:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 53666 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C45A5B7D1D for ; Thu, 27 May 2010 08:16:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754543Ab0EZWQN (ORCPT ); Wed, 26 May 2010 18:16:13 -0400 Received: from ringil.hengli.com.au ([216.59.3.182]:42776 "EHLO arnor.apana.org.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753915Ab0EZWQN (ORCPT ); Wed, 26 May 2010 18:16:13 -0400 Received: from gondolin.me.apana.org.au ([192.168.0.6]) by arnor.apana.org.au with esmtp (Exim 4.63 #1 (Debian)) id 1OHOtR-0006ZK-PJ; Thu, 27 May 2010 08:16:05 +1000 Received: from herbert by gondolin.me.apana.org.au with local (Exim 4.69) (envelope-from ) id 1OHOtN-0000sk-P0; Thu, 27 May 2010 08:16:01 +1000 Date: Thu, 27 May 2010 08:16:01 +1000 From: Herbert Xu To: Ralf Baechle Cc: "David S. Miller" , netdev@vger.kernel.org Subject: Re: ipv6: Add GSO support on forwarding path Message-ID: <20100526221601.GA3369@gondor.apana.org.au> References: <20100526102758.GA25914@gondor.apana.org.au> <20100526152019.GA11985@linux-mips.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100526152019.GA11985@linux-mips.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Herbert Xu Thanks, 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);