Received: by 10.213.65.68 with SMTP id h4csp240426imn; Fri, 23 Mar 2018 03:41:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+UMTaQCpwkAKskpoNM/HGCIm+oAay3Q06aAwh6H/GArtpg2L1QPMLyA/AB7pZqSxzv2lm X-Received: by 10.99.96.79 with SMTP id u76mr19895344pgb.199.1521801683930; Fri, 23 Mar 2018 03:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521801683; cv=none; d=google.com; s=arc-20160816; b=op8ZujA9oNM86xN/jKGZO4JY6pDnaE7LoX1XkBvCQe2GPfkAuG0mUmEpppsHC8wZCG e1OmhtQGEny9RdERKhoTwiDUpxK3Hm2CxknB2u3Tf/vL/5ESdKVnZ+wlU8HSFTrWHv9V MUgwZpSyUOgaGH0tarHXm0OCt4gSOFGoSM8zNEHJrrSCyki/O15QyDyuSA7irv0RGcln LNBKTTKAnPFGBvZ4X15kYM8SCe8c1eKozeSc0PJStv6v4F6VVXUYr9KuW4IIs6GU0jbM Txylo7JAYKwaDY8EzgZqQnGIcsWkdqRuqCQNIiwLzZDNVeXuRZyPrGzlW4Kj6aOSEm+s gbgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tOf6nbK7CUFqmAaGqPxD9O3+kc+zq7ig/VJBMMhGpoU=; b=cnRk6FXyW2wqeYeyP6DMoKojsQxt3AD5zTaHQxqABEPT7mPmNWHbE6mf5UKl2fGMH0 ofEk1k5MU/bgkJGq1pPtQDMDhOqYY+Dsfna2jKD2iEK85+bY61646eFYsG1AQN+UogkX nTp25hs2Y5s4A44ttkYrrATTSfZnm8W8gTPyxpwdV2l1lpUqMxx+yfnA/Z//lBxFITV1 DV7gagl06Q7tKdLwLAWDJXng13gI7zm6zkcPNGEJ0w0aMvH8Q0HOFZytUeB+WBez+W7Q eE+D5EbTNZEweZIfj3xxkCxj4lLqKnGI9kULCqiDTNWvVkhjEFEkeZHkEHt8SZ4imeta WsEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si5883138pgr.126.2018.03.23.03.41.08; Fri, 23 Mar 2018 03:41:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756367AbeCWKjM (ORCPT + 99 others); Fri, 23 Mar 2018 06:39:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47010 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933741AbeCWKRG (ORCPT ); Fri, 23 Mar 2018 06:17:06 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 38E0CDBB; Fri, 23 Mar 2018 10:17:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Vorel , Alexey Kodanev , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 92/97] ip6_vti: adjust vti mtu according to mtu of lower device Date: Fri, 23 Mar 2018 10:55:19 +0100 Message-Id: <20180323094202.622913188@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kodanev [ Upstream commit 53c81e95df1793933f87748d36070a721f6cb287 ] LTP/udp6_ipsec_vti tests fail when sending large UDP datagrams over ip6_vti that require fragmentation and the underlying device has an MTU smaller than 1500 plus some extra space for headers. This happens because ip6_vti, by default, sets MTU to ETH_DATA_LEN and not updating it depending on a destination address or link parameter. Further attempts to send UDP packets may succeed because pmtu gets updated on ICMPV6_PKT_TOOBIG in vti6_err(). In case the lower device has larger MTU size, e.g. 9000, ip6_vti works but not using the possible maximum size, output packets have 1500 limit. The above cases require manual MTU setup after ip6_vti creation. However ip_vti already updates MTU based on lower device with ip_tunnel_bind_dev(). Here is the example when the lower device MTU is set to 9000: # ip a sh ltp_ns_veth2 ltp_ns_veth2@if7: mtu 9000 ... inet 10.0.0.2/24 scope global ltp_ns_veth2 inet6 fd00::2/64 scope global # ip li add vti6 type vti6 local fd00::2 remote fd00::1 # ip li show vti6 vti6@NONE: mtu 1500 ... link/tunnel6 fd00::2 peer fd00::1 After the patch: # ip li add vti6 type vti6 local fd00::2 remote fd00::1 # ip li show vti6 vti6@NONE: mtu 8832 ... link/tunnel6 fd00::2 peer fd00::1 Reported-by: Petr Vorel Signed-off-by: Alexey Kodanev Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_vti.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -614,6 +614,7 @@ static void vti6_link_config(struct ip6_ { struct net_device *dev = t->dev; struct __ip6_tnl_parm *p = &t->parms; + struct net_device *tdev = NULL; memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); @@ -626,6 +627,25 @@ static void vti6_link_config(struct ip6_ dev->flags |= IFF_POINTOPOINT; else dev->flags &= ~IFF_POINTOPOINT; + + if (p->flags & IP6_TNL_F_CAP_XMIT) { + int strict = (ipv6_addr_type(&p->raddr) & + (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); + struct rt6_info *rt = rt6_lookup(t->net, + &p->raddr, &p->laddr, + p->link, strict); + + if (rt) + tdev = rt->dst.dev; + ip6_rt_put(rt); + } + + if (!tdev && p->link) + tdev = __dev_get_by_index(t->net, p->link); + + if (tdev) + dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, + IPV6_MIN_MTU); } /**