Skip to content

Commit a159cbe

Browse files
NicolasDichtelkuba-moo
authored andcommitted
selftests: rtnetlink: check enslaving iface in a bond
The goal is to check the following two sequences: > ip link set dummy0 up > ip link set dummy0 master bond0 down Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/20240108094103.2001224-3-nicolas.dichtel@6wind.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ec4ffd1 commit a159cbe

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tools/testing/selftests/net/rtnetlink.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ALL_TESTS="
2828
kci_test_neigh_get
2929
kci_test_bridge_parent_id
3030
kci_test_address_proto
31+
kci_test_enslave_bonding
3132
"
3233

3334
devdummy="test-dummy0"
@@ -1241,6 +1242,33 @@ kci_test_address_proto()
12411242
return $ret
12421243
}
12431244

1245+
kci_test_enslave_bonding()
1246+
{
1247+
local testns="testns"
1248+
local bond="bond123"
1249+
local dummy="dummy123"
1250+
local ret=0
1251+
1252+
run_cmd ip netns add "$testns"
1253+
if [ $ret -ne 0 ]; then
1254+
end_test "SKIP bonding tests: cannot add net namespace $testns"
1255+
return $ksft_skip
1256+
fi
1257+
1258+
run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr
1259+
run_cmd ip -netns $testns link add dev $dummy type dummy
1260+
run_cmd ip -netns $testns link set dev $dummy up
1261+
run_cmd ip -netns $testns link set dev $dummy master $bond down
1262+
if [ $ret -ne 0 ]; then
1263+
end_test "FAIL: initially up interface added to a bond and set down"
1264+
ip netns del "$testns"
1265+
return 1
1266+
fi
1267+
1268+
end_test "PASS: enslave interface in a bond"
1269+
ip netns del "$testns"
1270+
}
1271+
12441272
kci_test_rtnl()
12451273
{
12461274
local current_test

0 commit comments

Comments
 (0)