From patchwork Fri Oct 4 09:52:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oussama Ghorbel X-Patchwork-Id: 280571 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 426012C0092 for ; Fri, 4 Oct 2013 19:54:27 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360Ab3JDJyH (ORCPT ); Fri, 4 Oct 2013 05:54:07 -0400 Received: from mail-ea0-f181.google.com ([209.85.215.181]:46303 "EHLO mail-ea0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183Ab3JDJyC (ORCPT ); Fri, 4 Oct 2013 05:54:02 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so1710510eaj.12 for ; Fri, 04 Oct 2013 02:54:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=xIk7TEQQa4VI+DkktjL2Nna2eS8AshKCCpZzJo50qkA=; b=xNJ/5wFs3Rg0xspXnSK6IuSo7vx3Es+j7Dgi9G4QN0X1W05v3Z+SYDiJkJWx5aknuk FFiHD2nyfirrWnRzSznjIE8IyuNBR93efxv9l1TB+C1hC+ZTAsgygaBsr/R4ge1doetf uQVtl8B3iHj22uSxsNEvULWlKZIdzKZ1QIasKOA0/v/5mNcjQmKeuY8BhOCRGB5niyd8 Lkjq0l/Kj92xndWLRPmPBjXSBCILMuOz0ANg8m+4mEhl6B7KMBu7scdVgmukZ6g3LGbg lW4suk5bsiocSXIhUtnXwrj2Bwv08PmIZuJ/Wpzv3pxVAOBqZyD/QgbUVucx0TLC/yBD Oaug== X-Received: by 10.15.32.136 with SMTP id a8mr1841175eev.71.1380880440754; Fri, 04 Oct 2013 02:54:00 -0700 (PDT) Received: from localhost.localdomain ([41.230.33.36]) by mx.google.com with ESMTPSA id k7sm26096065eeg.13.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 02:54:00 -0700 (PDT) From: Oussama Ghorbel To: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Oussama Ghorbel Subject: [PATCH] Fix the upper MTU limit in ipv6 GRE tunnel Date: Fri, 4 Oct 2013 10:52:13 +0100 Message-Id: <1380880333-3546-1-git-send-email-ou.ghorbel@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Unlike ipv4, the struct member hlen holds the length of the GRE and ipv6 headers. This length is also counted in dev->hard_header_len. Perhaps, it's more clean to modify the hlen to count only the GRE header without ipv6 header as the variable name suggest, but the simple way to fix this without regression risk is simply modify the calculation of the limit in ip6gre_tunnel_change_mtu function. Verified in kernel version v3.11. Signed-off-by: Oussama Ghorbel Acked-by: Hannes Frederic Sowa --- net/ipv6/ip6_gre.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 90747f1..41487ab 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1175,9 +1175,8 @@ done: static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu) { - struct ip6_tnl *tunnel = netdev_priv(dev); if (new_mtu < 68 || - new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen) + new_mtu > 0xFFF8 - dev->hard_header_len) return -EINVAL; dev->mtu = new_mtu; return 0;