]> Git Repo - linux.git/commitdiff
selftests: rtnetlink: check enslaving iface in a bond
authorNicolas Dichtel <[email protected]>
Mon, 8 Jan 2024 09:41:03 +0000 (10:41 +0100)
committerJakub Kicinski <[email protected]>
Fri, 12 Jan 2024 00:47:40 +0000 (16:47 -0800)
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]>
tools/testing/selftests/net/rtnetlink.sh

index a10a32952f2167d4042dfbfa54a859770a22ff48..a31be0eaaa50f938ccf760485a7f173b600328e8 100755 (executable)
@@ -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"
@@ -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
This page took 0.056611 seconds and 4 git commands to generate.