From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388261; b=NxTn28Eqjvx8ivhlq4cEdHgeJzzLNCW9jlxPVXJFmUOkBFelpXjGuh0hTGiR5/AwG0ig JsBSU/VNZVHs/pKUXAHKOEJyDZPOsqn8jOud+KHeyskXrGPfZ5nbS+G8SmMKJEU8Q98c5 K9cbu9cAurzL43OtA4j6c1q4u9SyZ1tS1HS3yKNX+IgCK8C0hLVEb43k48azTQY0OydFp cNHrcDU3o7GXRK4rbG4LNxwEvwFZ2cpxswjBBqaUj+wew6sCHZcZxETcd4buG+7fN/UAN yY0qmmaD9pKT+bqD1xKF8KMOvYEkJqAR6W9Zlx2pb+Gq+KOGZNYZ0Ejm7Fzyckz3j3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388261; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=JlcKtNzkdtL3cd19OeqiDx1fNt4YDoUAZDzvTkjkgR4=; b=ayr+7DxChw6zYygKsvZbuVq1pQhH/g70teDOLSDbjaGDPp0+XOb3hDDhLnwJlzyVf12p DOs63xvtlbFx5yvWwHumjOlCbQqrVCBAbrntt874GXMoUpN1vvxAqGbfOX66bL8pZys7g KPjqdBqiZVRJsVD/K4NzwLilWx/5grmnHmSTh1OBmQmaZtLzkUfmt8+XHIadgrqR2XHjq ttQIA5+OZ8MAkmScEXuIv4vzvpDnXYJ7f+KoY8+sbJ7UH3ymeT8WyFsV3aIQJKHxPVIRL XoYSMb5qg+UPKOdseIerwJLQV/70H0BRpm5ejI8pDCrpmdrSbrCF5P4ORByapvshfaA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c3iKOhYy; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D56A5606A332; Fri, 4 Dec 2026 12:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=c3iKOhYy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109B41F000CE; Fri, 4 Dec 2026 12:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796388261; bh=JlcKtNzkdtL3cd19OeqiDx1fNt4YDoUAZDzvTkjkgR4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=c3iKOhYyZ6seIuvjXTS4TIcJhhU+tRf6D7Kc67VfCyQcqdx9Hn5dFuNrnF4JQeGc5 mALHoOHBFJObfMzjql736Si7fHWn4E+u+bli6QdUlMAHnP+0LXyM2gH1Z5N8lZbQpq aGBfFUTQMWxu/qveB9dLwx/WQPHu5gfyBVdYbLXcFYJ7Zjlpm9H+x9k1TSO9kA8Ofn +WQyzZchutshJEEl3qr3os6fJtKRmHwo5S9GGtJ3G/sNpLutGyDBfFEZhz3dJd/wC9 9AIb+4gx9rEFS6N+t1U69EUVit3D7COXs0qfSr8J9Tr/iWVEDiI3dfKiy4d2Qjy3H5 9uM/CCVp2Q5Xw== Subject: Re: [PATCH net] ip_tunnel: fragment IPv6 payload when the tunnel MTU is below IPV6_MIN_MTU From: netdev-bot+sashiko@kernel.org To: james@jamessawyer.co.uk Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 04 Dec 2026 12:44:20 +0000 Message-ID: <179638826057.3146.10849891210543072271@kernel.org> In-Reply-To: <20261203-ip-tunnel-ipv6-min-mtu-df-v1-1-ef4b415911a5@jamessawyer.co.uk> References: <20261203-ip-tunnel-ipv6-min-mtu-df-v1-1-ef4b415911a5@jamessawyer.co.uk> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The commit message and the new comment in tnl_update_pmtu() (net/ipv4/ip_tunnel.c:556-561) both say the change matches sit. - [Medium] For collect_md GRE/IPIP, ip_md_tunnel_xmit() (net/ipv4/ip_tunnel.c:640-646) sets `df = htons(IP_DF)` from… -- ip_tunnel: fragment IPv6 payload when the tunnel MTU is below IPV6_MIN_MTU This patch changes tnl_update_pmtu() to take df by reference. For IPv6 payloads it now clears df when the computed tunnel MTU is below IPV6_MIN_MTU, so the outer IPv4 packet is fragmented instead of dropped. ip_tunnel_xmit() and ip_md_tunnel_xmit() are both updated to pass &df. > diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c > index 0875474a578a4..6ea2bf14047b3 100644 > --- a/net/ipv4/ip_tunnel.c > +++ b/net/ipv4/ip_tunnel.c [ ... ] > @@ -553,6 +553,13 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, > NULL; > daddr = md ? dst : tunnel->parms.iph.daddr; > > + /* IPv6 cannot signal a path MTU below IPV6_MIN_MTU, so no > + * Packet Too Big can be sent below. Fragment the outer packet > + * instead of dropping it, as sit does. > + */ > + if (mtu < IPV6_MIN_MTU) > + *df = 0; [Severity: Medium] Does this fully match what sit does? The comment and the commit message both cite sit, but ipip6_tunnel_xmit() also raises mtu to IPV6_MIN_MTU before using it: net/ipv6/sit.c:ipip6_tunnel_xmit() { ... if (mtu < IPV6_MIN_MTU) { mtu = IPV6_MIN_MTU; df = 0; } if (parms->iph.daddr) skb_dst_update_pmtu_no_confirm(skb, mtu); if (skb->len > mtu && !skb_is_gso(skb)) { icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); ... } Here mtu stays below 1280. Earlier in tnl_update_pmtu() this call runs with that value: if (skb_valid_dst(skb)) skb_dst_update_pmtu_no_confirm(skb, mtu); __ip6_rt_update_pmtu() returns early when mtu < IPV6_MIN_MTU, so the inner route PMTU is never lowered. The rt6 metric update and the ICMPV6_PKT_TOOBIG branch just below this hunk both require mtu >= IPV6_MIN_MTU, so neither of them runs either. That seems to leave every inner IPv6 packet from 1281 bytes up to the tunnel device MTU (about 1476 for plain GRE) going out as outer IPv4 fragments while the reduced PMTU lasts. This includes full-size TCP and GSO segments, and the sender is never told to use 1280. Is that intended? With sit, only packets of 1280 bytes or less are fragmented. Larger ones get a PTB(1280). The tests in the commit message used 1232-byte UDP payloads, which are exactly 1280-byte IPv6 packets. At that size the two behaviours are the same. Should this also set mtu = IPV6_MIN_MTU before the skb_dst_update_pmtu_no_confirm() call, so the existing PMTU update and PTB paths run as they do in sit? If not, the comment and the commit message should probably not claim parity with sit. [ ... ] > @@ -632,7 +639,7 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, > > if (test_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, key->tun_flags)) > df = htons(IP_DF); > - if (tnl_update_pmtu(dev, skb, rt, df, inner_iph, tunnel_hlen, > + if (tnl_update_pmtu(dev, skb, rt, &df, inner_iph, tunnel_hlen, > key->u.ipv4.dst, true)) { > ip_rt_put(rt); > goto tx_error; [Severity: Medium] For collect_md GRE/IPIP tunnels, can the outer packet now go out without DF even though the tunnel key asked for it? When IP_TUNNEL_DONT_FRAGMENT_BIT is set, df becomes htons(IP_DF). For IPv6 payloads below 1280, the new "*df = 0" in tnl_update_pmtu() then clears it, and iptunnel_xmit() writes the result into iph->frag_off. The uAPI for this flag doesn't mention an exception: include/uapi/linux/openvswitch.h: OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ include/uapi/linux/bpf.h: * **BPF_F_DONT_FRAGMENT** * Add a flag to tunnel metadata indicating that the * packet should not be fragmented. TCA_TUNNEL_KEY_NO_FRAG is also a plain flag. geneve_xmit_skb() still honours the same key flag as given: drivers/net/geneve.c:geneve_xmit_skb() { ... df = test_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, key->tun_flags) ? htons(IP_DF) : 0; ... } So the same request would now give DF on geneve but no DF on GRE/IPIP. The commit message says: For collect_md tunnels this also overrides IP_TUNNEL_DONT_FRAGMENT_BIT in this one case, as sit does. However, sit has no collect_md path for IPv6 payloads and never reads IP_TUNNEL_DONT_FRAGMENT_BIT. The sit precedent doesn't seem to cover the md case. The notes below the commit message raise this as an open question. Would it be better to limit the override to !md? The other option is to document the exception for IPv6 payloads below 1280. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-ip-tunnel-ipv6-min-mtu-df-v1-1-ef4b415911a5%40jamessawyer.co.uk