Skip to content

Commit

Permalink
selftests: rtnetlink: check enslaving iface in a bond
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
NicolasDichtel authored and kuba-moo committed Jan 12, 2024
1 parent ec4ffd1 commit a159cbe
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tools/testing/selftests/net/rtnetlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ALL_TESTS="
kci_test_neigh_get
kci_test_bridge_parent_id
kci_test_address_proto
kci_test_enslave_bonding
"

devdummy="test-dummy0"
Expand Down Expand Up @@ -1241,6 +1242,33 @@ kci_test_address_proto()
return $ret
}

kci_test_enslave_bonding()
{
local testns="testns"
local bond="bond123"
local dummy="dummy123"
local ret=0

run_cmd ip netns add "$testns"
if [ $ret -ne 0 ]; then
end_test "SKIP bonding tests: cannot add net namespace $testns"
return $ksft_skip
fi

run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr
run_cmd ip -netns $testns link add dev $dummy type dummy
run_cmd ip -netns $testns link set dev $dummy up
run_cmd ip -netns $testns link set dev $dummy master $bond down
if [ $ret -ne 0 ]; then
end_test "FAIL: initially up interface added to a bond and set down"
ip netns del "$testns"
return 1
fi

end_test "PASS: enslave interface in a bond"
ip netns del "$testns"
}

kci_test_rtnl()
{
local current_test
Expand Down

0 comments on commit a159cbe

Please sign in to comment.