🚀 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 Thu, 19 Nov 2026 09:19
Re: [PATCH net-next 6/6] selftests: bonding: Test that Collecting is advertised after notification
#19057
Author: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 09:19
112 lines
12188 bytes
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] collecting_advertise() in tools/testing/selftests/drivers/net/
  bonding/bond_lacp_independent_control.sh can take the wrong…

--

selftests: bonding: Test that Collecting is advertised after notification

This patch adds a collecting_advertise test to
bond_lacp_independent_control.sh. With coupled control disabled, the test
checks that the Collecting bit is only advertised in a transmitted LACPDU
after the Rx state change notification was emitted. It also switches the
partner to a slow LACP rate so that the port is not rate limited when it
enters COLLECTING state.

> diff --git a/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh b/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh
> index a2b83b581e403..b86f39f31d0c3 100755
> --- a/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh
> +++ b/tools/testing/selftests/drivers/net/bonding/bond_lacp_independent_control.sh

[ ... ]

> @@ -162,6 +167,50 @@ collecting_notify()
>  	log_test "Notifications in COLLECTING state"
>  }
>  
> +collecting_advertise()
> +{
> +	local lacpdu_ts notify_ts tmp_dir
> +
> +	RET=0
> +
> +	partner_state_clear 0x18
> +	defer tc filter del dev "$h1" ingress pref 1 handle 101 flower
> +	lacp_state_wait "$h1" 0x0f
> +	check_err $? "Port did not reach ATTACHED state"
> +
> +	tmp_dir=$(mktemp -d)
> +	defer rm -rf "$tmp_dir"
> +	ip -ts -o -d monitor link dev "$h1" > "$tmp_dir"/notify &
> +	defer kill_process $!

[ ... ]

> +	notify_ts=$(grep -m1 -w "ad_actor_oper_port_state $((0x1f))" \
> +		    "$tmp_dir"/notify | sed 's/^\[\([^]]*\)\].*/\1/')
> +	notify_ts=$(date -d "$notify_ts" +%s%6N)
> +	lacpdu_ts=$(head -n1 "$tmp_dir"/lacpdu | cut -d' ' -f1 | tr -d .)
> +	((lacpdu_ts > notify_ts))
> +	check_err $? "Collecting bit advertised before notification"

[Severity: Medium]

Can notify_ts in collecting_advertise() pick up the timestamp of an
unrelated link notification instead of the $h1 one?

The monitor runs as "ip -ts -o -d monitor link dev $h1". In iproute2,
accept_msg() in ipmonitor calls print_headers() for every RTM_NEWLINK.
With -ts, that prints "[<time>] " with no newline.

print_linkinfo() then returns early and prints nothing when
filter.ifindex is set and ifi->ifi_index != filter.ifindex, which is the
case for any device other than $h1. The timestamp of the filtered message
is therefore left at the start of the next printed line.

With -o, the matching line can then look like this:

    [ts_other] [ts_h1] N: $h1: ... ad_actor_oper_port_state 31 ...

The sed above takes the first bracket, ts_other. That timestamp is older
than the real $h1 notification.

Without "bonding: 3ad: Advertise Collecting only after collection is
enabled", the Collecting LACPDU goes out only a short time (at most about
one tick) before the notification. So any RTM_NEWLINK for another device
between the monitor start and the $h1 0x1f notification would make
notify_ts smaller than lacpdu_ts. In that case the check below passes even
though the bug is present:

    ((lacpdu_ts > notify_ts))

That window covers the sleep 1 plus the wait for the partner's next
LACPDU.

The test runs in the init netns, so link events on other host interfaces
can land in that window. Examples are NetworkManager or docker veths,
carrier changes, and IPv6 ifinfo notifications.

One option is to drop the dev filter and grep for the "$h1:" line, so
every printed line has its own timestamp. Another is to take the last
bracketed timestamp on the line instead of the first. Would either of
these make the check more robust?

> +
> +	log_test "Collecting advertised after notification"
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118083442.1061289-1-idosch%40nvidia.com
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