0001
0002
0003
0004
0005
0006
0007 ALL_TESTS="
0008 bond_cleanup_mode1
0009 bond_cleanup_mode4
0010 bond_listen_lacpdu_multicast_case_down
0011 bond_listen_lacpdu_multicast_case_up
0012 "
0013
0014 REQUIRE_MZ=no
0015 NUM_NETIFS=0
0016 lib_dir=$(dirname "$0")
0017 source "$lib_dir"/../../../net/forwarding/lib.sh
0018
0019 source "$lib_dir"/lag_lib.sh
0020
0021
0022 destroy()
0023 {
0024 local ifnames=(dummy1 dummy2 bond1 mv0)
0025 local ifname
0026
0027 for ifname in "${ifnames[@]}"; do
0028 ip link del "$ifname" &>/dev/null
0029 done
0030 }
0031
0032 cleanup()
0033 {
0034 pre_cleanup
0035
0036 destroy
0037 }
0038
0039
0040
0041
0042
0043 bond_cleanup_mode1()
0044 {
0045 RET=0
0046
0047 test_LAG_cleanup "bonding" "active-backup"
0048 }
0049
0050 bond_cleanup_mode4() {
0051 RET=0
0052
0053 test_LAG_cleanup "bonding" "802.3ad"
0054 }
0055
0056 bond_listen_lacpdu_multicast()
0057 {
0058
0059 local init_state=$1
0060 local lacpdu_mc="01:80:c2:00:00:02"
0061
0062 ip link add dummy1 type dummy
0063 ip link add bond1 "$init_state" type bond mode 802.3ad
0064 ip link set dev dummy1 master bond1
0065 if [ "$init_state" = "down" ]; then
0066 ip link set dev bond1 up
0067 fi
0068
0069 grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
0070 check_err $? "LACPDU multicast address not present on slave (1)"
0071
0072 ip link set dev bond1 down
0073
0074 not grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
0075 check_err $? "LACPDU multicast address still present on slave"
0076
0077 ip link set dev bond1 up
0078
0079 grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
0080 check_err $? "LACPDU multicast address not present on slave (2)"
0081
0082 cleanup
0083
0084 log_test "bonding LACPDU multicast address to slave (from bond $init_state)"
0085 }
0086
0087
0088
0089
0090 bond_listen_lacpdu_multicast_case_down()
0091 {
0092 RET=0
0093
0094 bond_listen_lacpdu_multicast "down"
0095 }
0096
0097 bond_listen_lacpdu_multicast_case_up()
0098 {
0099 RET=0
0100
0101 bond_listen_lacpdu_multicast "up"
0102 }
0103
0104
0105 trap cleanup EXIT
0106
0107 tests_run
0108
0109 exit "$EXIT_STATUS"