Skip to content

Commit 8cc063a

Browse files
gobenjikuba-moo
authored andcommitted
selftests: bonding: Check initial state
The purpose of the test_LAG_cleanup() function is to check that some hardware addresses are removed from underlying devices after they have been unenslaved. The test function simply checks that those addresses are not present at the end. However, if the addresses were never added to begin with due to some error in device setup, the test function currently passes. This is a false positive since in that situation the test did not actually exercise the intended functionality. Add a check that the expected addresses are indeed present after device setup. This makes the test function more robust. I noticed this problem when running the team/dev_addr_lists.sh test on a system without support for dummy and ipv6: tools/testing/selftests/drivers/net/team# ./dev_addr_lists.sh Error: Unknown device type. Error: Unknown device type. This program is not intended to be run as root. RTNETLINK answers: Operation not supported TEST: team cleanup mode lacp [ OK ] Fixes: bbb774d ("net: Add tests for bonding and team address list management") Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com> Link: https://lore.kernel.org/r/20240131140848.360618-3-bpoirier@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7b6fb30 commit 8cc063a

File tree

1 file changed

+11
-0
lines changed
  • tools/testing/selftests/drivers/net/bonding

1 file changed

+11
-0
lines changed

tools/testing/selftests/drivers/net/bonding/lag_lib.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ test_LAG_cleanup()
4848
ip link add mv0 link "$name" up address "$ucaddr" type macvlan
4949
# Used to test dev->mc handling
5050
ip address add "$addr6" dev "$name"
51+
52+
# Check that addresses were added as expected
53+
(grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 ||
54+
grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null
55+
check_err $? "macvlan unicast address not found on a slave"
56+
57+
# mcaddr is added asynchronously by addrconf_dad_work(), use busywait
58+
(busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 ||
59+
grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null
60+
check_err $? "IPv6 solicited-node multicast mac address not found on a slave"
61+
5162
ip link set dev "$name" down
5263
ip link del "$name"
5364

0 commit comments

Comments
 (0)