From patchwork Thu Sep 26 14:51:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oussama Ghorbel X-Patchwork-Id: 278209 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 EC2E42C016B for ; Fri, 27 Sep 2013 00:52:36 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752643Ab3IZOwe (ORCPT ); Thu, 26 Sep 2013 10:52:34 -0400 Received: from mail-wi0-f194.google.com ([209.85.212.194]:64101 "EHLO mail-wi0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930Ab3IZOwc (ORCPT ); Thu, 26 Sep 2013 10:52:32 -0400 Received: by mail-wi0-f194.google.com with SMTP id hi5so259269wib.9 for ; Thu, 26 Sep 2013 07:52:31 -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=LaMCWv0QjTXBcZ9Wo40wZxRE98xRiM7Ru/OfKpqtb2c=; b=rtjCbSXIMhf/nnSM5ZNKnlIF3yrNc3oJC8XDR4oHtHXbUbdlSTezXuReqGvvEKDZCL HFKctOt7nwpxtFlk8zdcKJz/1EoPJHeHgktYNmTSTN5CV9j50MgJbherZjrSGUv1iUDI uipQ5qzUALjLb8EupEMp7uC11LNY2uBPc3jOukLJ5W4dgFKMsyOgbtzBEhJ7XFWSI3bO Q4Mqa8KixAs8b7o+8tcUtlHuYMR6CDxa453fRiG9zejUn4hw5N8/GD1aZCZrPumGQ8a4 p5QKFqi7d8hgLIftSqA3qLJDkxTqcVJlWVC2tMiMjgsZv6J3jst84erUhKfUyUepMAg9 VnmA== X-Received: by 10.180.13.174 with SMTP id i14mr28089847wic.49.1380207151154; Thu, 26 Sep 2013 07:52:31 -0700 (PDT) Received: from localhost.localdomain ([41.230.40.4]) by mx.google.com with ESMTPSA id e1sm28887775wij.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 07:52:30 -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] IPv6: Allow the MTU of ipip6 tunnel to be set below 1280 Date: Thu, 26 Sep 2013 15:51:48 +0100 Message-Id: <1380207108-20030-1-git-send-email-oghorbell@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 The (inner) MTU of a ipip6 (IPv4-in-IPv6) tunnel cannot be set below 1280, which is the minimum MTU in IPv6. However, there should be no IPv6 on the tunnel interface at all, so the IPv6 rules should not apply. More info at https://bugzilla.kernel.org/show_bug.cgi?id=15530 This patch allows to check the minimum MTU for ipv6 tunnel according to these rules: -In case the tunnel is configured with ipip6 mode the minimum MTU is 68. -In case the tunnel is configured with ip6ip6 or any mode the minimum MTU is 1280. Signed-off-by: Oussama Ghorbel --- net/ipv6/ip6_tunnel.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 1e55866..a66ead2 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1423,8 +1423,14 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) { - if (new_mtu < IPV6_MIN_MTU) { - return -EINVAL; + struct ip6_tnl *t = netdev_priv(dev); + + if (t->parms.proto == IPPROTO_IPIP) { + if (new_mtu < 68) + return -EINVAL; + } else { + if (new_mtu < IPV6_MIN_MTU) + return -EINVAL; } dev->mtu = new_mtu; return 0;