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 v3 03/12] amt: key relay tunnels on a union amt_addr endpoint
Date: Sat, 28 Nov 2026 09:48:36 +0000 [thread overview]
Message-ID: <179585931643.3135.2851219283955870732@kernel.org> (raw)
In-Reply-To: <20261127094703.3025517-4-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message misdescribes the pre-patch behaviour on an
IPv6 outer transport.
- [Low] The commit message says both `amt_update_handler()` and
`amt_request_handler()` pass the outer-source snapshot "to…
- [Low] The patch changes what the per-source tunnel cap counts.
--
amt: key relay tunnels on a union amt_addr endpoint
This commit stores the relay tunnel endpoint as a union amt_addr instead
of a __be32. It also adds the amt_outer_saddr(), amt_relay_mac() and
amt_same_source() helpers. The per-source tunnel cap now counts IPv6
sources per /64, and amt_v6() is still false for every device, so no
functional change is intended.
> A relay keeps one struct amt_tunnel_list per gateway endpoint and finds
> it by the gateway's IPv4 address, stored as __be32 ip4 and taken from
> ip_hdr(skb)->saddr, together with its UDP source port. On an IPv6 outer
> transport that reads the traffic class and flow label of the IPv6
> header as an address, and the field cannot hold the gateway's address
> anyway.
[Severity: Low]
Is this description of the old read accurate?
In struct iphdr, saddr starts at byte 12. In struct ipv6hdr, version,
traffic class and flow label take bytes 0-3, payload_len bytes 4-5,
nexthdr byte 6 and hop_limit byte 7. The source address then runs from
byte 8 to byte 23.
So ip_hdr(skb)->saddr on an IPv6 header reads bytes 12-15, which are
s6_addr[4..7] of the IPv6 source address. It never reads the traffic
class or the flow label.
The conclusion is still correct, since a __be32 cannot hold an IPv6
gateway address. Could the reason given in the message be corrected?
> amt_outer_saddr() copies the outer source address of a received message
> by value into a zeroed union amt_addr. amt_update_handler() takes that
> snapshot before pskb_may_pull() and iptunnel_pull_header() can
> reallocate the header; amt_request_handler() takes it after its only
> pskb_may_pull() and pulls nothing more. Both pass it to
> amt_tunnel_lookup(), amt_tunnel_get_or_create() and amt_update_tunnel().
[Severity: Low]
Does amt_request_handler() actually call any of these helpers?
Only the Update path does:
amt_update_handler()->amt_update_tunnel()->amt_tunnel_get_or_create()
->amt_tunnel_lookup()
amt_request_handler() walks the tunnel list itself instead:
list_for_each_entry_rcu(tunnel, &amt->tunnel_list, list) {
if (!amt_same_source(amt, &tunnel->addr, &saddr) ||
READ_ONCE(tunnel->dead))
continue;
per_src++;
if (amt_addr_equal(&tunnel->addr, &saddr) &&
tunnel->source_port == udph->source)
have = true;
}
It then uses saddr for amt_relay_mac() and saddr.ip4 for
amt_send_igmp_gq() and amt_send_mld_gq().
That loop is a separate copy of the matching in
amt_tunnel_get_or_create(), and the two have to be kept in sync by hand.
Could the message say that only amt_update_handler() passes the snapshot
to these three helpers?
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 52ccaca08b5ec..83e666a023c12 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -2728,20 +2777,22 @@ static bool amt_membership_query_handler(struct amt_dev *amt,
[ ... ]
> -/* Most tunnels one source address may hold: an eighth of the table, at
> - * least one and at most AMT_MAX_TUNNELS_PER_SRC.
> +/* Most tunnels one source (an IPv4 address or an IPv6 /64) may hold: an
> + * eighth of the table, at least one and at most AMT_MAX_TUNNELS_PER_SRC.
> */
> static u32 amt_max_tunnels_per_src(const struct amt_dev *amt)
> {
> @@ -2759,7 +2810,7 @@ static u32 amt_max_tunnels_per_src(const struct amt_dev *amt)
> * verified source address may hold.
> */
> static struct amt_tunnel_list *amt_tunnel_get_or_create(struct amt_dev *amt,
> - __be32 saddr,
> + union amt_addr *saddr,
> __be16 sport)
> {
> struct amt_tunnel_list *tunnel;
> @@ -2779,9 +2830,11 @@ static struct amt_tunnel_list *amt_tunnel_get_or_create(struct amt_dev *amt,
> * against its address.
> */
> list_for_each_entry(tunnel, &amt->tunnel_list, list) {
> - if (tunnel->ip4 != saddr || READ_ONCE(tunnel->dead))
> + if (!amt_same_source(amt, &tunnel->addr, saddr) ||
> + READ_ONCE(tunnel->dead))
> continue;
[Severity: Low]
This isn't a bug, but the comment on amt_max_tunnels_per_src() now says
the cap counts an IPv4 address or an IPv6 /64. Three other comments
about the same cap still describe it as per-address.
The kernel-doc above amt_tunnel_get_or_create():
* table, amt_max_tunnels_per_src(), additionally limits the tunnels one
* verified source address may hold.
The comment above this loop:
* a tunnel being freed neither stands in for its endpoint nor counts
* against its address.
And in include/net/amt.h:
/* Upper bound of amt_max_tunnels_per_src(), the per-address tunnel cap */
#define AMT_MAX_TUNNELS_PER_SRC 16
amt_same_source() compares only the first AMT_SRC_PREFIX6_LEN bytes for
IPv6, so two gateways at different addresses in the same /64 share one
cap. None of these comments is updated later in the series either. At
the series tip, the AMT_MAX_TUNNELS_PER_SRC comment and the
amt_tunnel_get_or_create() kernel-doc still say per-address.
Could these be updated to match the new definition of a source?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127094703.3025517-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-11-28 9:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 9:46 [PATCH net-next v3 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko [this message]
2026-11-27 9:46 ` [PATCH net-next v3 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:46 ` [PATCH net-next v3 05/12] amt: forward multicast data " Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:46 ` [PATCH net-next v3 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 08/12] amt: receive " Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:47 ` [PATCH net-next v3 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-27 9:47 ` [PATCH net-next v3 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-27 9:47 ` [PATCH net-next v3 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:47 ` [PATCH net-next v3 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-11-28 9: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=179585931643.3135.2851219283955870732@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