From patchwork Sat Jun 29 14:57:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 255741 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 499902C0095 for ; Sun, 30 Jun 2013 00:56:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752886Ab3F2O4w (ORCPT ); Sat, 29 Jun 2013 10:56:52 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:47299 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752844Ab3F2O4u (ORCPT ); Sat, 29 Jun 2013 10:56:50 -0400 Received: by mail-wi0-f180.google.com with SMTP id c10so1738836wiw.13 for ; Sat, 29 Jun 2013 07:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=kMRRZ9Y1JsOq+GKUTD68b7wF3idHPN+TheFxTc2kFP4=; b=kJ5U8qrryyhVTt3LcTkaczBKjTdNo1NsET7o2ehymqTaxRUXi+zoWBC0NaIbex9NbP c7k0KM6gM30M/wekjlr2TlvDCah6M60zrzMZhl3ExU0VxvD0tkTWZIF+xMTSgCAXNec4 tzizl3Cn/JPWykDRVwQD6Bv6P5dG0VQR8lcqH0INT77D3QP394Bzs7wrZcLfevfNj1fB rT+oqmaC9vA/UcDX2flw+XZj90Fbobh18L7MgeZSjjITCZcQdnlkVIsemrMaGWnCAeGt 7PnxP2Bnar+ajdx0/F7oBGbJBIZZK1yUZg9FbikpgTmL27odwtGc67LJKoFtVzsWPRb7 sR7g== X-Received: by 10.180.211.171 with SMTP id nd11mr6715276wic.17.1372517808640; Sat, 29 Jun 2013 07:56:48 -0700 (PDT) Received: from vostro ([83.145.235.194]) by mx.google.com with ESMTPSA id n5sm17372187eed.9.2013.06.29.07.56.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 29 Jun 2013 07:56:48 -0700 (PDT) Date: Sat, 29 Jun 2013 17:57:01 +0300 From: Timo Teras To: Pravin B Shelar , netdev@vger.kernel.org Subject: ip_tunnel mtu calculation Message-ID: <20130629175701.73c17a16@vostro> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.17; i686-pc-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, I'm reviewing changes since 3.9 to net-next and observed that, the tunnel refactoring had the following change in ip_gre xmit path. In ip_tunnel_xmit() mtu is now calculated as: if (df) mtu = dst_mtu(&rt->dst) - dev->hard_header_len - sizeof(struct iphdr); else mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; And it used to be in ip_gre.c: ipgre_tunnel_xmit(): if (df) mtu = dst_mtu(&rt->dst) - dev->hard_header_len - tunnel->hlen; else mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; I notice that tunnel->hlen is replaced with sizeof(struct iphdr), but in case of GRE those are not the same thing. And the refactored ip_gre.c does not set hard_header_len either. So it would like the mtu is now miscalculated (planning to give a full test-spin for net-next next week). It seems the tunnel->hlen used to be the full length, including sizeof(struct iphdr). But the new, refactored code seems exclude sizeof(struct iphdr) from the tunnel->hlen. So would the following be appropriate? --- 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 --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 394cebc..ac3a9a1 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -564,7 +564,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, if (df) mtu = dst_mtu(&rt->dst) - dev->hard_header_len - - sizeof(struct iphdr); + - tunnel->hlen - sizeof(struct iphdr); else mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;