public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: rtnetlink: Fix bridge_parent_id failure on interface state
@ 2025-04-14 17:25 Alok Tiwari
  2025-04-15 11:37 ` Ido Schimmel
  0 siblings, 1 reply; 2+ messages in thread
From: Alok Tiwari @ 2025-04-14 17:25 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, shuah
  Cc: alok.a.tiwari, linux-kernel, netdev, linux-kselftest,
	darren.kenny

The selftest "kci_test_bridge_parent_id" fails with the error:
"Device can not be enslaved while up" when trying to attach interfaces
(`eni10np1`, `eni20np1`) to a bonding device (`test-bond0`) while the
interfaces are in the UP state.

Failure log:
COMMAND: ip link set dev eni10np1 master test-bond0
    Error: Device can not be enslaved while up.
COMMAND: ip link set dev eni20np1 master test-bond0
    Error: Device can not be enslaved while up.
FAIL: bridge_parent_id

This behavior aligns with bonding driver requirements, where a slave
interface must be in the DOWN state before being enslaved. This was
reinforced in upstream commit: 'ec4ffd100ffb ("Revert 'net: rtnetlink:
Enslave device before bringing it up'")'.

This patch updates the test to bring interfaces down explicitly before
adding them to the bonding device:

  ip link set dev <iface> master <bond> down

After applying this fix, the test passes successfully:

Success log:
COMMAND: ip link set dev eni10np1 master test-bond0 down
COMMAND: ip link set dev eni20np1 master test-bond0 down
PASS: bridge_parent_id

Fixes: 9c2a19f71515 ("kselftest: rtnetlink.sh: add verbose flag")
Note: This commit introduced 'run_cmd', which exposed this failure
in the bridge_parent_id test output.
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 tools/testing/selftests/net/rtnetlink.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 2e8243a65b50..ddae704c8faa 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -1103,8 +1103,8 @@ kci_test_bridge_parent_id()
 	dev10=`ls ${sysfsnet}10/net/`
 	dev20=`ls ${sysfsnet}20/net/`
 	run_cmd ip link add name test-bond0 type bond mode 802.3ad
-	run_cmd ip link set dev $dev10 master test-bond0
-	run_cmd ip link set dev $dev20 master test-bond0
+	run_cmd ip link set dev $dev10 master test-bond0 down
+	run_cmd ip link set dev $dev20 master test-bond0 down
 	run_cmd ip link add name test-br0 type bridge
 	run_cmd ip link set dev test-bond0 master test-br0
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-15 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 17:25 [PATCH] selftests: rtnetlink: Fix bridge_parent_id failure on interface state Alok Tiwari
2025-04-15 11:37 ` Ido Schimmel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox