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