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,
	willemb@google.com
Subject: Re: [PATCH net-next v3 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes
Date: Sat, 28 Nov 2026 09:48:43 +0000	[thread overview]
Message-ID: <179585932383.3135.977907655234165301@kernel.org> (raw)
In-Reply-To: <20261127094703.3025517-13-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] In tools/testing/selftests/net/amt_gw_v6.sh,
  probe_v6_gateway() exits the whole script with $ksft_skip whenever the…
- [Low] The new selftest tools/testing/selftests/net/amt_gw_v6.sh gives a
  reason for adding the IPv6 address with `nodad` (line 158: "# nodad: a…

--

selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes

This adds a netlink-only selftest for the AMT IPv6 attributes
IFLA_AMT_LOCAL_IP6 and IFLA_AMT_DISCOVERY_IP6. It checks that gateway and
relay addresses read back through amt_fill_info(), and that invalid
combinations are rejected with the expected extack message. A probe skips
the test when iproute2 or the kernel lacks IPv6 AMT support.

> diff --git a/tools/testing/selftests/net/amt_gw_v6.sh b/tools/testing/selftests/net/amt_gw_v6.sh
> new file mode 100755
> index 0000000000000..38858cbc9d3b8
> --- /dev/null
> +++ b/tools/testing/selftests/net/amt_gw_v6.sh
> @@ -0,0 +1,210 @@

[ ... ]

> +probe_v6_gateway()
> +{

[ ... ]

> +	if ! add_amt amtprobe mode gateway local "$V6_LOCAL" \
> +	     discovery "$V6_DISC"; then
> +		case "$ADD_ERR" in
> +		*"binary attribute size out of range"*)

[ ... ]

> +	fi
> +	got=$(amt_field amtprobe discovery)
> +	ip -n "$GW" link del amtprobe
> +	if [[ "$got" != *:* ]]; then
> +		# The attributes are exactly four bytes, so this is an iproute2
> +		# that truncated the literal to an IPv4 address, or prints the
> +		# IPv6 one under another key. Four truncated bytes cannot be
> +		# told from a real IPv4 address, and the kernel did what it
> +		# should.
> +		echo "SKIP: iproute2 lacks IPv6 AMT support (read back '$got')"
> +		exit "$ksft_skip"
> +	fi
> +}

[Severity: Medium]
Could this check report a regression in amt_fill_info() as a skip?

With this series, amt_policy uses NLA_POLICY_EXACT_LEN(sizeof(__be32)) for
IFLA_AMT_LOCAL_IP and IFLA_AMT_DISCOVERY_IP. The "binary attribute size out
of range" branch above already catches a 16-byte value in an IPv4
attribute. So if add_amt succeeds here, the kernel has received
IFLA_AMT_DISCOVERY_IP6 and built an IPv6 gateway.

Suppose amt_fill_addr6() stopped emitting this attribute, or emitted the
IPv4 IFLA_AMT_DISCOVERY_IP in its place:

drivers/net/amt.c:amt_fill_addr6() {
    ...
	if (amt->mode == AMT_MODE_GATEWAY &&
	    nla_put_in6_addr(skb, IFLA_AMT_DISCOVERY_IP6, &amt->discovery_ipv6))
		return -EMSGSIZE;
    ...
}

Then got would be '' or '0.0.0.0', and the whole script would exit with
$ksft_skip before test_v6_gateway_roundtrip() runs. That function's check:

	[ "$(amt_field amtg6 discovery)" = "$V6_DISC" ]
	check_err $? "discovery did not read back as $V6_DISC"

can therefore never fail because the readback is missing or IPv4. The
commit message says the test checks that the IPv6 discovery address reads
back through amt_fill_info(), and this check does not fully cover that.

The skip is meant for an older kernel that truncates the address, where
2001:db8:a::2 reads back as 32.1.13.184. Could it match that value instead
of any readback without a colon?

[ ... ]

> +trap cleanup_all_ns EXIT
> +setup_ns GW || exit "$ksft_skip"
> +ip -n "$GW" link add gw_dev type dummy
> +ip -n "$GW" link set gw_dev up
> +ip -n "$GW" addr add "$V4_LOCAL/24" dev gw_dev
> +# nodad: a tentative source address would race link creation.
> +ip -n "$GW" addr add "$V6_LOCAL/64" dev gw_dev nodad

[Severity: Low]
Is the reason in this comment accurate?

amt_newlink() checks only the syntax of IFLA_AMT_LOCAL_IP6. It rejects
loopback, any, multicast and v4-mapped values. It never checks whether the
address is assigned to an interface or still tentative.

The encapsulation socket is created only by
amt_dev_open()->amt_socket_create()->amt_create_sock(), and for IPv6 it
binds to :: in any case. This script never brings an amt device up. So
there seems to be no race between DAD and link creation for nodad to avoid.

Separately, the "Not covered" list in the header comment at the top of the
file names only the two duplicate-argument cases: discovery v4 together
with discovery v6, and local v4 together with local v6. The commit message
lists a third case, a 16-byte IFLA_AMT_LOCAL_IP or IFLA_AMT_DISCOVERY_IP.

Should the header comment list that case as well?

[ ... ]

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

      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
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 [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=179585932383.3135.977907655234165301@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