Netdev List
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net] ip_tunnel: fragment IPv6 payload when the tunnel MTU is below IPV6_MIN_MTU
Date: Fri, 04 Dec 2026 12:44:20 +0000	[thread overview]
Message-ID: <179638826057.3146.10849891210543072271@kernel.org> (raw)
In-Reply-To: <20261203-ip-tunnel-ipv6-min-mtu-df-v1-1-ef4b415911a5@jamessawyer.co.uk>

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

      reply	other threads:[~2026-12-04 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:59 [PATCH net] ip_tunnel: fragment IPv6 payload when the tunnel MTU is below IPV6_MIN_MTU James Sawyer via B4 Relay
2026-12-04 12:44 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179638826057.3146.10849891210543072271@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=james@jamessawyer.co.uk \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox