Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp23190pxb; Fri, 15 Jan 2021 04:58:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbyq5yhXCGeJ7cj//MvtrClHABnKxeAzc15QpSIBmGVXcoheE2+f22KthlnW+Q0c3Echus X-Received: by 2002:a05:6402:1bcd:: with SMTP id ch13mr8126744edb.31.1610715508911; Fri, 15 Jan 2021 04:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715508; cv=none; d=google.com; s=arc-20160816; b=prJmX1fBq0s/+ikEEdFRtQtl4tJSd3t+18CCXZCbEv7DY76dM9NUcs1g2DW50nwxdA BiBCItIraItjs+7JWP9/A5QWFfFG5iyCHG6EXHCt5aPB80FVRlmF5govASWFHlvqKifz a5WxMJmefCMH5haJthw19XL/uvEbhbDBvrxC9POjGRr7l5TuvHoTEd/jCKbzQ/2yN/oL EFIQeM9UtbX79+sMjC1tSHfx8LTT0G4w8TpfT3zt86kit8aE4YdfnZ/eCmr8Mpgi9oy6 Qx37n4eGpHbe3tOaOEczatZA70mHikKk+d0oOuo/BtpZyOin7nMpyTv/vH1HCW+kclBh pDQA== 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=zZTZnm45OCXOApSJsGeuguTdRAu0wQaYovM/E00b63Y=; b=jjWrYTOFYAHo/6G28HCqyxoyUnvD6SfT2mKLJ7PksAjq+9yjV/QzToeS3fTBjW7OLr tux9qC/ZRmtrICtSxBHqMYmZELiZkRpvTbOUmHXEkDEQLGoXlrN6CIZiIWqnMF81cpqE 8JL4tGyjuQGk2gzbMoD8FJBUHA8bM4+UXaWgc2LfnCAtIugUMyr0xKv0p3NyahkZ3yg2 Om79TrpODKk+CyDX6LublJglYUip2Mz1Icp7WWKuRNGBSqZN624HlyBQrQc2JmMlFArN 1Mvy+FPg3iOqYEzy9ZvIcivkuxQkaA8mQDI7DBcy/c8sR2uKqWj8t5OdNzxEoWY+ACnm 0c1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BN5zbJze; 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 w11si3809511ejc.533.2021.01.15.04.58.04; Fri, 15 Jan 2021 04:58:28 -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=BN5zbJze; 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 S1732844AbhAOM50 (ORCPT + 99 others); Fri, 15 Jan 2021 07:57:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:40886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387458AbhAOMeQ (ORCPT ); Fri, 15 Jan 2021 07:34:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00C49223E0; Fri, 15 Jan 2021 12:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714041; bh=uh2dK3nnlUxFeYmUJ5NAK8gx46824cSHwA+Q2b8A/Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BN5zbJzeUTZGnVT4k6UVggBlHh9KvmP7BltQsaUjHk6SIk8maHDA362AV6k+t/RNn Cno05sL5EGGE9zAL1+4wjxfey+NuOcxpEcwtkwiF7Je70cle7AxYlc/BnbuM+hDnlw Fru3teE08ZegGq6JkpsEX7Hu/MwtYo+Q63n7hrB8= 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 5.4 12/62] net: fix pmtu check in nopmtudisc mode Date: Fri, 15 Jan 2021 13:27:34 +0100 Message-Id: <20210115121958.996015548@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -765,8 +765,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, - 0, 0, false)) { + 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, 0, 0, false)) { ip_rt_put(rt); goto tx_error; } @@ -794,10 +797,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)