Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	shuah@kernel.org, horms@kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 05/12] amt: forward multicast data over IPv6
Date: Thu, 26 Nov 2026 19:16:59 +0000	[thread overview]
Message-ID: <179572061952.3135.14503580379845323397@kernel.org> (raw)
In-Reply-To: <20261125191450.2497936-6-omar@blockcast.net>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] When the outer transport is IPv6, amt_tmtu_exceeded()
  (drivers/net/amt.c:1255) checks a GSO inner IPv6 packet with…
- [Low] amt_tmtu() (drivers/net/amt.c:1246) computes dst_mtu(dst) -
  sizeof(struct ipv6hdr) - sizeof(struct udphdr) - sizeof(struct…

--

amt: forward multicast data over IPv6

This patch lets an IPv6 relay send Multicast Data by routing the copy
through amt_udp_xmit() for either outer family. Over IPv6 it routes
first and drops a payload that exceeds the route MTU less the outer
headers. It then sends one Packet Too Big to the source after it has
walked all tunnels.

> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 7e8219a0cdf9e..823367e8232bb 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
> @@ -1237,26 +1237,51 @@ static void amt_req_work(struct work_struct *work)
>  				 msecs_to_jiffies(100));
>  }
>
> +/* RFC 7450 s5.3.3.6: a Multicast Data message sent over IPv6 must not
> + * carry a Fragment header, so a payload larger than the tunnel MTU is
> + * dropped, and an IPv6 source is sent a Packet Too Big. An IPv4 source is
> + * not told, as icmp_send() never answers a multicast datagram. The tunnel
> + * MTU follows the route's path MTU, as on every IPv6 UDP tunnel.
> + */
> +static u32 amt_tmtu(const struct dst_entry *dst)
> +{
> +	return dst_mtu(dst) - sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
> +	       sizeof(struct amt_header_mcast_data);
> +}

[Severity: Low]
Can this u32 subtraction wrap when dst_mtu(dst) is below 50?

ip6_dst_mtu_maybe_forward() returns the raw RTAX_MTU metric when one is
set, and ip_metrics_convert() only clamps RTAX_MTU from above. So an
admin route with something like "mtu 40" is accepted. A large lwtunnel
headroom (for example seg6 with a big SRH) can also push dst_mtu() below
the 50 byte overhead.

In that case tmtu becomes roughly 4G, and amt_tmtu_exceeded() never
fires in amt_send_multicast_data():

	tmtu = amt_tmtu(dst);
	if (amt_tmtu_exceeded(oskb, tmtu)) {

The copy is still dropped later in the IPv6 output path. Because the
patch already leaves out tunnel MTUs below IPV6_MIN_MTU, no Packet Too
Big to the source is lost. However, an skb copy is still made and
pushed through IPv6 output per tunnel per packet. An ICMPv6 Packet Too
Big is generated toward the relay's own address, and tx_dropped is not
counted on the amt device.

Should amt_tmtu() clamp at zero, or should amt_send_multicast_data()
treat a dst_mtu() smaller than the overhead as exceeded?

> +
> +/* True if @skb, the inner packet before encapsulation, or any segment of
> + * it, is larger than @tmtu.
> + */
> +static bool amt_tmtu_exceeded(const struct sk_buff *skb, u32 tmtu)
> +{
> +	if (skb_is_gso(skb))
> +		return !skb_gso_validate_network_len(skb, tmtu);
> +	return skb->len > tmtu;
> +}

[Severity: Medium]
Is the transport header reliable at this point for an inner IPv6 GSO
skb that carries extension headers?

skb_gso_validate_network_len() computes the per-segment length as
(skb_transport_header - skb_network_header) plus
skb_gso_transport_seglen(). Earlier, amt_dev_xmit() calls
ipv6_mc_check_mld(), and ipv6_mc_check_ip6hdr() always resets the
transport header to just past the fixed IPv6 header:

net/ipv6/mcast_snoop.c:ipv6_mc_check_ip6hdr() {
    ...
	skb_set_transport_header(skb, offset);
    ...
}

ipv6_mc_check_exthdrs() then returns -ENOMSG for a non-MLD packet before
it corrects the offset:

	if (ip6h->nexthdr != IPPROTO_HOPOPTS)
		return -ENOMSG;
    ...
	if (nexthdr != IPPROTO_ICMPV6)
		return -ENOMSG;

	if (!skb_set_transport_header_careful(skb, offset))

So for every IPv6 data packet the transport header stays at nh+40, even
when Hop-by-Hop or Destination Options headers come before UDP.

For an SKB_GSO_UDP_L4 skb with such headers, the computed segment length
is short by the length of those extension headers. A segment that is
larger than tmtu by up to that amount passes this check. In that case
*ptb is not lowered, no Packet Too Big reaches the source, and the copy
is encapsulated.

skb_reset_inner_headers() in amt_send_multicast_data() then copies the
same offset into inner_transport_header. The outer
ip6_finish_output_gso() validation would also under-count, so the
oversized segments go out on a path whose route MTU cannot carry them.

This seems to contradict this part of the commit message:

    The device offers software GSO, so a GSO skb is checked
    per segment with skb_gso_validate_network_len(), before the tunnel
    offloads are set up. A payload that does not fit is dropped.

Would it make sense to locate the real upper-layer offset (for example
with ipv6_skip_exthdr()) before validating, or to fix up the transport
header in amt_dev_xmit() for data packets?

[ ... ]

> @@ -1575,8 +1617,10 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev)
>  			}
>  			continue;
>  found:
> -			amt_send_multicast_data(amt, skb, tunnel, v6);
> +			amt_send_multicast_data(amt, skb, tunnel, v6, &ptb);
>  		}
> +		if (ptb && v6)
> +			icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, ptb);
>  	}
>
>  	dev_kfree_skb(skb);

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125191450.2497936-1-omar%40blockcast.net

  reply	other threads:[~2026-11-26 19:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 19:14 [PATCH net-next v2 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-11-26 19:16   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-11-26 19:16   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-26 19:16   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 05/12] amt: forward multicast data " Omar Ramadan
2026-11-26 19:16   ` netdev-bot+sashiko [this message]
2026-11-25 19:14 ` [PATCH net-next v2 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-26 19:17   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 08/12] amt: receive " Omar Ramadan
2026-11-26 19:17   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-11-26 19:17   ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-11-26 19:17   ` netdev-bot+sashiko

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=179572061952.3135.14503580379845323397@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=omar@blockcast.net \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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