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,
willemb@google.com
Subject: Re: [PATCH net-next v4 02/12] amt: send the Relay Advertisement over IPv6
Date: Mon, 30 Nov 2026 03:48:30 +0000 [thread overview]
Message-ID: <179601051051.3146.13369414407667117379@kernel.org> (raw)
In-Reply-To: <20261129034652.1853485-3-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · 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] In the new IPv6 Discovery path of amt_discovery_handler()
(drivers/net/amt.c), the only filters are a multicast outer…
--
amt: send the Relay Advertisement over IPv6
This patch adds the 24-byte IPv6 form of the Relay Advertisement and a
new amt_send_ctrl_v6() helper, which routes through amt_route6() and
sends with udp_tunnel6_xmit_skb(). On an IPv6 device,
amt_discovery_handler() now answers a Discovery with this form. The
reply is sourced from the Discovery's outer destination and sent back
to its outer source and UDP source port.
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 3f3205d2df3e8..52ccaca08b5ec 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -3026,6 +3118,29 @@ static bool amt_discovery_handler(struct amt_dev *amt, struct sk_buff *skb)
> if (amtd->reserved || amtd->version)
> return true;
>
> + /* The Advertisement takes the form of the outer IP version, and
> + * RFC 7450 s5.1.2 sources it from the address the Discovery was
> + * sent to, which may be an anycast Relay Discovery Address rather
> + * than local_ipv6.
> + */
> + if (amt_v6(amt)) {
> + struct in6_addr saddr = ipv6_hdr(skb)->saddr;
> + struct in6_addr daddr = ipv6_hdr(skb)->daddr;
> +
> + /* The socket bound to :: also receives a Discovery sent to
> + * a group, and a multicast address can never be a source
> + * (RFC 4291 s2.7), so such a Discovery is not answered. Nor
> + * is one from ::, which has nowhere to be sent.
> + */
> + if (ipv6_addr_is_multicast(&daddr) ||
> + ipv6_addr_any(&saddr))
> + return true;
> +
> + amt_send_advertisement_v6(amt, amtd->nonce, &daddr, &saddr,
> + udph->source);
[Severity: Medium]
Will a Discovery whose outer IPv6 source is one of the relay's own
addresses still be answered here? The only filters are a multicast
destination and a :: source. The outer saddr and udph->source then
become the destination address and port of the reply.
A remote sender that can forge the source address (on the same link, or
on a path without BCP38) could send a Discovery to relay_port. It would
set the source to local_ipv6 or the link-local address of stream_dev
(for example with saddr == daddr), pick a UDP source port P, and choose
the nonce. The reply would then take this path:
amt_discovery_handler()
amt_send_advertisement_v6(amt, nonce, &daddr, &saddr, udph->source)
amt_send_ctrl_v6()
amt_route6()
ip6_dst_lookup_flow() <- local route for a stream_dev address
udp_tunnel6_xmit_skb() <- delivered back to the host over lo
The host would send itself a 24-byte datagram from
<local addr>:relay_port to <local addr>:P. The 4-byte nonce in it is
chosen by the sender. The datagram arrives with iif=lo, so common rules
such as "-i lo -j ACCEPT" (ufw and firewalld defaults) would let it
through. It could then reach local UDP services bound to :: or to that
address, which the sender cannot reach directly.
The IPv6 input path doesn't seem to stop this. It only rejects loopback
and multicast sources:
net/ipv6/ip6_input.c:ip6_rcv_core() {
...
if ((ipv6_addr_loopback(&hdr->saddr) ||
ipv6_addr_loopback(&hdr->daddr)) &&
!(dev->flags & IFF_LOOPBACK) &&
!netif_is_l3_master(dev))
goto err;
...
if (ipv6_addr_is_multicast(&hdr->saddr))
goto err;
...
}
On IPv4, fib_validate_source() treats a local source as martian by
default (accept_local=0). That is why the existing
amt_send_advertisement() path is not exposed in the same way.
amt_discovery_handler() and amt_rcv() still have only these checks at
the end of the series. The path becomes reachable once "amt: add
netlink attributes for an IPv6 outer transport" allows an IPv6 outer
address to be configured.
Would it make sense to drop a Discovery whose outer source is a local
address, for example with ipv6_chk_addr(amt->net, &saddr, NULL, 0) or a
check on the route type? At minimum, could a Discovery with saddr equal
to daddr be dropped?
> + return false;
> + }
> +
> amt_send_advertisement(amt, amtd->nonce, iph->saddr, udph->source);
>
> return false;
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129034652.1853485-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-11-30 3:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 3:46 [PATCH net-next v4 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-11-30 3:48 ` netdev-bot+sashiko [this message]
2026-11-30 6:41 ` Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 05/12] amt: forward multicast data " Omar Ramadan
2026-11-30 3:48 ` netdev-bot+sashiko
2026-11-30 6:41 ` Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 08/12] amt: receive " Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-11-30 3:48 ` netdev-bot+sashiko
2026-11-30 6:41 ` Omar Ramadan
2026-11-29 3:46 ` [PATCH net-next v4 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-11-30 3:48 ` 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=179601051051.3146.13369414407667117379@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 \
--cc=willemb@google.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
all inboxes | Powered by JetHome®