Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp26379pxb; Fri, 15 Jan 2021 05:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyc/mFTswIIbV6VYnmBqBoEBP8CLibpFwA1ln/ekxSnpRmyvL+nZXBiMsqfcsVViBchKrdM X-Received: by 2002:a17:906:1c17:: with SMTP id k23mr6187914ejg.255.1610715775511; Fri, 15 Jan 2021 05:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715775; cv=none; d=google.com; s=arc-20160816; b=02IcxuEs+D2cdf00HCu1w8d2SA/1dDhJMDi1cCr8Ir6Z3r2v6BpGstb/r3E6A1lnFU icOTuccniVZc+DpMNLQMJEnmDndJ0mVGt2RExMQmP0sGOhYwaLl3vg9qtNYv8vmpVLXa IJa3tg1s1qI7hCz+BscBvZHxy0qqnGmv+Yhm/3k6of0bbm4n6SdadOsxrQxKb9gTEHLD SNyhxJKI5nT5cKAIrbbwOZmEJxbCc6qQevnVO2DMKBd7IOdd2IWkGYZTCC4FjZGIyjvz eLbmXOu8khZu9Kaxnr+f83xTsIwgSd5+ie/iF1WLlwhBR/Vc3mkmFhGygfmI9TZ7juFj m4lA== 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=wV92TBfFZLFwimFIpvmUg/eQaD/C11Aoo3g3q/+zSOo=; b=GAgpSXhRNZDtxF9ZaeKF8dRB2QaDblwq/B6VQun8bfSyv+Tv0e0dtkAq3n1U/WtSVB SaOXcbbRSe76xb2W5WI7rZGu7i1wcDVGhyVFtFZ+tztEKyD7vf0i1JBwz5KB53EzJpmp ba1/JKllQPiB2zDLD4NK7jB4WCmWN4s3/+rIJNmIeZlc1t4FWPA1q772AxkI9YsjbruM WPTKrE+ox4bI92updosrHx/SAt6EJUtd1M+U7y+/S2E8WKtrRHDyRU+6xrt40+WQfM1N GG11agZIZPU8i0OL3sB7NQc0rsjkYm2VgEeb0aFQ8YG0IqhRApC2vTVNf5HEwe2klKL0 ZCRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BoJm7ziH; 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 ce20si4196712edb.138.2021.01.15.05.02.29; Fri, 15 Jan 2021 05:02:55 -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=BoJm7ziH; 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 S2388463AbhAONB1 (ORCPT + 99 others); Fri, 15 Jan 2021 08:01:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:39612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731690AbhAOMdE (ORCPT ); Fri, 15 Jan 2021 07:33:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B48FB2389B; Fri, 15 Jan 2021 12:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713969; bh=Scim1aPc4oiVGk3Rke6ZbBRH9RRT+9jSDNil5DiDENQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BoJm7ziHhsHnVq+L8ymyUwrZrfIkR3FfYov0vBYfswTSuHBCap0KT7B+LFhlXRYuI YOsoejp4VCBoNvCBXLluebw43AqVgM8dcicEM6Uy0qF13YKbX3ljaa1ZEvajEv91If q1R7NaONCUd7EMsY2rSXWcz6zeJspyYRsJ4+WxTQ= 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.19 08/43] net: fix pmtu check in nopmtudisc mode Date: Fri, 15 Jan 2021 13:27:38 +0100 Message-Id: <20210115121957.453437665@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121957.037407908@linuxfoundation.org> References: <20210115121957.037407908@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 @@ -736,7 +736,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) && !tunnel->ignore_df) + 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; } @@ -764,10 +768,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) && !tunnel->ignore_df) - 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)