From patchwork Fri Jan 13 09:12:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 714891 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 3v0H2k3mR6z9t0H for ; Fri, 13 Jan 2017 20:12:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751329AbdAMJM1 (ORCPT ); Fri, 13 Jan 2017 04:12:27 -0500 Received: from mail-qk0-f175.google.com ([209.85.220.175]:33656 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751146AbdAMJMZ (ORCPT ); Fri, 13 Jan 2017 04:12:25 -0500 Received: by mail-qk0-f175.google.com with SMTP id s140so48104250qke.0 for ; Fri, 13 Jan 2017 01:12:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LWp60ABWZBvi/hkFY50toCRU6c1BybNYZngDxWr35DM=; b=uUpfwvKD+PXYMVT6q24sHmYqy6UGPVTAo6CpOPZBFJJv8e2pojU6+CzbzgxF5Nibsi 8ImluinqnmdFbHyXcpukJ1lNwqqRBJOGAVHQN7kfyZWIpqUkMT3p3h87ITQHSpHoSETp nWrpnc3y9TJNE42/jmkj2APoc22uIGBnhNMk9IW1Wgl9QUvL330KuCt+6fLLmEiKfFve +IQBwEGxcFHgtrcTNf4AHddwGZFpYEoYfkH37sLStTY0PjirSZ98JvHnLFdDQvkcngau ol7D4K6zJUegzziUoe9qBU+0rZij3gk51kvKIEbLCGxz34NUHNiudDKocrlCTOOGZ/fV KVNA== X-Gm-Message-State: AIkVDXLnTaqwLfbJqSdtdsRq+yId7X6wQiA5D/hzHVxN9q+ivNZIYZLTAV3ix9S2Bd50SKnv X-Received: by 10.55.39.193 with SMTP id n184mr17379888qkn.315.1484298744093; Fri, 13 Jan 2017 01:12:24 -0800 (PST) Received: from redhat.com (89-73-147-170.dynamic.chello.pl. [89.73.147.170]) by smtp.gmail.com with ESMTPSA id h40sm5144407qtb.6.2017.01.13.01.12.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 01:12:22 -0800 (PST) From: Jakub Sitnicki To: netdev@vger.kernel.org Cc: "David S. Miller" , Tom Herbert Subject: [PATCH net] ip6_tunnel: Account for tunnel header in tunnel MTU Date: Fri, 13 Jan 2017 10:12:20 +0100 Message-Id: <1484298740-29199-1-git-send-email-jkbs@redhat.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With ip6gre we have a tunnel header which also makes the tunnel MTU smaller. We need to reserve room for it. Previously we were using up space reserved for the Tunnel Encapsulation Limit option header (RFC 2473). Also, after commit b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions") our contract with the caller has changed. Now we check if the packet length exceeds the tunnel MTU after the tunnel header has been pushed, unlike before. This is reflected in the check where we look at the packet length minus the size of the tunnel header, which is already accounted for in tunnel MTU. Fixes: b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions") Signed-off-by: Jakub Sitnicki --- net/ipv6/ip6_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 36d2921..753d6d0 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1108,7 +1108,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield, t->parms.name); goto tx_err_dst_release; } - mtu = dst_mtu(dst) - psh_hlen; + mtu = dst_mtu(dst) - psh_hlen - t->tun_hlen; if (encap_limit >= 0) { max_headroom += 8; mtu -= 8; @@ -1117,7 +1117,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield, mtu = IPV6_MIN_MTU; if (skb_dst(skb) && !t->parms.collect_md) skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); - if (skb->len > mtu && !skb_is_gso(skb)) { + if (skb->len - t->tun_hlen > mtu && !skb_is_gso(skb)) { *pmtu = mtu; err = -EMSGSIZE; goto tx_err_dst_release;