🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Tue, 01 Dec 2026 06:46
Re: [PATCH net-next v5 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes
#25018
Author: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:46
177 lines
13725 bytes
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] Four rejection cases in amt_gw_v6.sh only test the kernel rule
  they are named after if iproute2 sends an unspecified or multicast…
- [Low] probe_v6_gateway() in amt_gw_v6.sh also skips on any probe-
  creation error containing "Operation not supported" (line 70).

--

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 IPv6 and
IPv4 gateways and relays read back correctly through amt_fill_info(). It
also checks that each new link-creation rule rejects bad input with the
expected extack message, and 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..f44e95051b74f
> --- /dev/null
> +++ b/tools/testing/selftests/net/amt_gw_v6.sh
> @@ -0,0 +1,221 @@

[ ... ]

> +	if ! add_amt amtprobe mode gateway local "$V6_LOCAL" \
> +	     discovery "$V6_DISC"; then
> +		case "$ADD_ERR" in

[ ... ]

> +		*"Local attribute is required"*|*"expected rather than"*|\
> +		*"IPv6 support is disabled"*|*"Unknown device type"*|\
> +		*"Operation not supported"*)
> +			echo "SKIP: no IPv6 AMT support: $ADD_ERR"
> +			exit "$ksft_skip"
> +			;;
> +		esac
> +		echo "FAIL: cannot create an IPv6 gateway: $ADD_ERR"
> +		exit "$ksft_fail"

[Severity: Low]

Is the "Operation not supported" pattern in probe_v6_gateway() intended?
The commit message lists the probe's skip conditions one by one and then
says:

  "Any other failure to create the probe link is a FAIL."

"Operation not supported" is not in that list.

When amt is missing, __rtnl_newlink() already sets an extack, and the
script matches that message separately:

net/core/rtnetlink.c:__rtnl_newlink() {
    ...
	if (!ops) {
		NL_SET_ERR_MSG(extack, "Unknown device type");
		return -EOPNOTSUPP;
	}
    ...
}

With an iproute2 that supports extended ACK, the strerror match mostly
catches an EOPNOTSUPP that has no extack message. One example is a netdev
notifier failing during register_netdevice() or netdev_upper_dev_link()
in amt_newlink().

This is unlikely on a dummy device in a fresh netns. Still, wouldn't such
a create failure become a SKIP instead of a FAIL? You could either drop
the pattern or list it in the commit message.

[ ... ]

> +expect_reject()
> +{
> +	local desc=$1 want=$2; shift 2
> +
> +	RET=0
> +	add_amt amtbad "$@"
> +	check_fail $? "link was created but should have been rejected"
> +	ip -n "$GW" link del amtbad 2>/dev/null
> +	grep -qi -- "$want" <<< "$ADD_ERR"
> +	check_err $? "rejected for the wrong reason: $ADD_ERR"
> +	log_test "$desc"
> +}

[ ... ]

> +expect_reject "unspecified v6 local is rejected" \
> +	"Invalid Local IPv6" \
> +	mode relay local ::

[ ... ]

> +expect_reject "multicast v6 local is rejected" \
> +	"Invalid Local IPv6" \
> +	mode relay local ff02::1
> +expect_reject "multicast v6 discovery is rejected" \
> +	"must be unicast" \
> +	mode gateway local "$V6_LOCAL" discovery ff02::1

[ ... ]

> +expect_reject "unspecified v6 discovery is rejected" \
> +	"must be unicast" \
> +	mode gateway local "$V6_LOCAL" discovery ::

[Severity: Medium]

Do these four cases only work if iproute2 passes :: or a multicast
address to the kernel unchanged?

expect_reject() passes only if ADD_ERR contains the kernel's extack text.
amt_newlink() is the only source of "Invalid Local IPv6 address" and
"discovery must be unicast". It emits them only when IFLA_AMT_LOCAL_IP6
or IFLA_AMT_DISCOVERY_IP6 actually reaches the kernel.

The existing iproute2 amt parser follows the vxlan pattern and filters
these addresses itself:

  - It rejects multicast addresses through is_addrtype_inet_not_multi(),
    with invarg("invalid local address") or
    invarg("invalid discovery address").
  - It adds the attribute only when is_addrtype_inet_not_unspec() holds,
    so :: is quietly left out.

Suppose the IPv6-capable iproute2 keeps that filtering. Then:

  local ff02::1, discovery ff02::1
    fail with iproute2's own message

  local ::
    the attribute is left out and amt_validate() reports:

drivers/net/amt.c:amt_validate() {
    ...
	if (!data[IFLA_AMT_LOCAL_IP] && !data[IFLA_AMT_LOCAL_IP6]) {
		NL_SET_ERR_MSG_MOD(extack, "Local attribute is required");
    ...
}

  discovery ::
    amt_validate() reports "Discovery attribute of the local family is
    required"

None of these messages match the grep in expect_reject(). Each case
would report "rejected for the wrong reason" and fail on a correct
kernel. The kernel's unspecified and multicast checks would never run.

The IPv6 iproute2 changes are not in this tree, so I could not confirm
whether they keep the filtering.

The commit message says the test checks:

  "an unspecified, loopback, multicast or IPv4-mapped IPv6 local or
  discovery address."

It names only three cases that iproute2 "cannot express". Could the
commit message or the script say which iproute2 behaviour these cases
need? Another option is to skip them when the error comes from iproute2
or from the missing-attribute path.

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

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads