Re: [PATCH net-next 2/2] selftests: bonding: test that the ARP monitor keeps UP slaves when it starts
From: Hangbin Liu
Date: Wed Dec 02 2026 - 22:23:40 EST
Hi Ramses,
On Tue, Dec 01, 2026 at 12:20:30PM +0200, Ramses de Norre via B4 Relay wrote:
> From: Ramses de Norre <ramses@xxxxxxxxxxxxxxxx>
>
> Add a test for the two ways the ARP monitor can start after the slaves
> were enslaved: bringing the bond up after enslaving into it while it is
> down, and setting arp_interval on a running bond that uses miimon. In
> both cases the test waits longer than the arp_missed_max window before
> the monitor starts, and checks that the primary stays active and that no
> slave gets a link failure.
>
> Without the previous patch, both cases fail: the first monitor run takes
> both slaves down and the bond comes back on eth1, where it stays with
> primary_reselect=failure.
>
> Signed-off-by: Ramses de Norre <ramses@xxxxxxxxxxxxxxxx>
> ---
> .../testing/selftests/drivers/net/bonding/Makefile | 1 +
> .../drivers/net/bonding/bond_arp_monitor_start.sh | 154 +++++++++++++++++++++
> 2 files changed, 155 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/bonding/Makefile b/tools/testing/selftests/drivers/net/bonding/Makefile
> index 46d9fede59185..12276c942506e 100644
> --- a/tools/testing/selftests/drivers/net/bonding/Makefile
> +++ b/tools/testing/selftests/drivers/net/bonding/Makefile
> @@ -6,6 +6,7 @@ TEST_PROGS := \
> bond-break-lacpdu-tx.sh \
> bond-eth-type-change.sh \
> bond-lladdr-target.sh \
> + bond_arp_monitor_start.sh \
> bond_ipsec_offload.sh \
> bond_lacp_independent_control.sh \
> bond_lacp_prio.sh \
> diff --git a/tools/testing/selftests/drivers/net/bonding/bond_arp_monitor_start.sh b/tools/testing/selftests/drivers/net/bonding/bond_arp_monitor_start.sh
> new file mode 100755
> index 0000000000000..a718292172244
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/bonding/bond_arp_monitor_start.sh
> @@ -0,0 +1,154 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Check that the ARP monitor does not take UP slaves down when it starts
> +# after the slaves were enslaved. That happens when the slaves are enslaved
> +# while the bond is down, or when arp_interval is set on a running bond
> +# that used miimon. The monitor must give the slaves a full arp_missed_max
> +# window from when it starts, not from when they were enslaved.
> +#
> +# +------------------------+
> +# | bond0 192.0.2.1/24 | h_ns
> +# | eth0 eth1 |
> +# +---+-------------+------+
> +# | |
> +# +---+-------------+------+
> +# | sw0 sw1 | sw_ns
> +# | br0 192.0.2.254/24 |
> +# +------------------------+
> +
> +# shellcheck disable=SC2034,SC2329
> +ALL_TESTS="
> + arp_monitor_start_on_open
> + arp_monitor_start_on_interval_set
> +"
> +REQUIRE_MZ=no
> +NUM_NETIFS=0
> +lib_dir=$(dirname "$0")
> +# shellcheck disable=SC1091
> +source "$lib_dir"/../../../net/forwarding/lib.sh
> +
> +require_command jq
> +
[...]
> +
> +trap cleanup EXIT
> +
> +setup_prepare
> +setup_wait
Since we don't need the NUM_NETIFS, there is no need to call setup_wait.
With that, we can include net/lib.sh directly, and remove the
REQUIRE_MZ/NUM_NETIFS setting.
Thanks
Hangbin
> +
> +tests_run
> +
> +exit "$EXIT_STATUS"
>
> --
> 2.56.1
>
>