Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp30490pxb; Fri, 15 Jan 2021 05:08:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6hOFTkACXAjVgUFt6Ddlha5q0Arph4nIqZfgzj/8SdIYr+oTDkYf/82Q/lZYXdAL3ksRz X-Received: by 2002:a17:906:24d1:: with SMTP id f17mr7680267ejb.21.1610716090759; Fri, 15 Jan 2021 05:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610716090; cv=none; d=google.com; s=arc-20160816; b=z+DIdQujtRt4DNImLWxRnqSfQExDePPDqgUHikbZXFbzoT6ni93k9zzgFhgrh2gfeF 3gUK2bcEj27ZfH1FNyHD+9vJSzPyV53wF8h0at4q3AByTZiOUp4eZkoi8dVokf6aGPx0 4GnhG7V1IEzXM4GSwAubOgUVFpdhOHtbjdzIViJWxvJc08CZwN70lcNIPrNGQMrPjrJ3 bztoO4i0d63mAGuEV7NJHeKG9owcvq+UW6axtYlW+MgaasfVTGqomSfk9t4t+RxLRZue dNqgTygDgK6nNBp42hfTx1XHHNH0xwAU7sqwqUWqG55V3kvrqq7XFv7+NJVNbWJDxTzg OIBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hZooKnJ1zucdwqDtRG2JIoHfxilJiiPgRscVqrOdWTM=; b=CLFAsjYdET1vIUQhx7B9/UdH3XyBUtu5CVn+HARpgjYaUMLBit7vWRdrS2g8AlVb+L 6/0Vfx81brq1OgCrttHc4FM8FiXTplRKAqrp8haDfjFtMmQ9LKJmJ0Wmu1CVeGDq59dA p0/qvYI6R0iuCKzyoEm17Cfn0MlOG+BOQESE1Zfixy1AMCytRGlSsLSAEMJWc3dQ2z27 rLxk1L+rSZB3VQ9jkqDX/Li5uNz1sHEyamUx5SWITewdr120Il1Mu84w0hxSo+8Uesi7 Lq1uIzyYAcdAbvsDbZ0JAA0P245pYl1G0nZRR5Wwks6nmiqknwFPmlE3Oa/VWyBkAcfP OrRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I9Fit96R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp6si3565775ejb.30.2021.01.15.05.07.46; Fri, 15 Jan 2021 05:08:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I9Fit96R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388574AbhAONGb (ORCPT + 99 others); Fri, 15 Jan 2021 08:06:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:37056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732564AbhAOMbU (ORCPT ); Fri, 15 Jan 2021 07:31:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B836C23403; Fri, 15 Jan 2021 12:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713795; bh=etPUrUNQhuJ0dyxHGJHRstf6/2h+tsqNure8SU6DifI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9Fit96RDFF+Rq8HDO9Rn2O8Y0PwEba5iyhyYw3TlLKSWeWnXmXvtCt8Csva5TlAA 8nyu395/OHoTji20u6P2GHsG545DNEXpu9tM6jDybbRsKqr0CZVnDTG5CS+rZvck// bBgYCm0x6/d7kxvY/MznkZmlIzCUsTV0NHSUxeGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Brivio , Florian Westphal , Pablo Neira Ayuso , Jakub Kicinski Subject: [PATCH 4.4 09/18] net: fix pmtu check in nopmtudisc mode Date: Fri, 15 Jan 2021 13:27:37 +0100 Message-Id: <20210115121955.568213908@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121955.112329537@linuxfoundation.org> References: <20210115121955.112329537@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Westphal [ Upstream commit 50c661670f6a3908c273503dfa206dfc7aa54c07 ] For some reason ip_tunnel insist on setting the DF bit anyway when the inner header has the DF bit set, EVEN if the tunnel was configured with 'nopmtudisc'. This means that the script added in the previous commit cannot be made to work by adding the 'nopmtudisc' flag to the ip tunnel configuration. Doing so breaks connectivity even for the without-conntrack/netfilter scenario. When nopmtudisc is set, the tunnel will skip the mtu check, so no icmp error is sent to client. Then, because inner header has DF set, the outer header gets added with DF bit set as well. IP stack then sends an error to itself because the packet exceeds the device MTU. Fixes: 23a3647bc4f93 ("ip_tunnels: Use skb-len to PMTU check.") Cc: Stefano Brivio Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ip_tunnel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -708,7 +708,11 @@ void ip_tunnel_xmit(struct sk_buff *skb, goto tx_error; } - if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) { + df = tnl_params->frag_off; + if (skb->protocol == htons(ETH_P_IP)) + df |= (inner_iph->frag_off & htons(IP_DF)); + + if (tnl_update_pmtu(dev, skb, rt, df, inner_iph)) { ip_rt_put(rt); goto tx_error; } @@ -736,10 +740,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, ttl = ip4_dst_hoplimit(&rt->dst); } - df = tnl_params->frag_off; - if (skb->protocol == htons(ETH_P_IP)) - df |= (inner_iph->frag_off&htons(IP_DF)); - max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr) + rt->dst.header_len + ip_encap_hlen(&tunnel->encap); if (max_headroom > dev->needed_headroom)