0001
0002
0003
0004
0005
0006
0007
0008 lib_dir=$(dirname $0)/../../../net/forwarding
0009
0010 ALL_TESTS="
0011 dev_del_test
0012 "
0013 NUM_NETIFS=4
0014 source $lib_dir/tc_common.sh
0015 source $lib_dir/lib.sh
0016 source $lib_dir/devlink_lib.sh
0017
0018 h1_create()
0019 {
0020 simple_if_init $h1
0021 }
0022
0023 h1_destroy()
0024 {
0025 simple_if_fini $h1
0026 }
0027
0028 h2_create()
0029 {
0030 simple_if_init $h2
0031 }
0032
0033 h2_destroy()
0034 {
0035 simple_if_fini $h2
0036 }
0037
0038 switch_create()
0039 {
0040 ip link add dev br0 type bridge vlan_filtering 1 mcast_snooping 0
0041
0042 ip link set dev $swp1 master br0
0043 ip link set dev $swp2 master br0
0044
0045 ip link set dev br0 up
0046 ip link set dev $swp1 up
0047 ip link set dev $swp2 up
0048 }
0049
0050 switch_destroy()
0051 {
0052 ip link set dev $swp2 down
0053 ip link set dev $swp1 down
0054
0055 ip link del dev br0
0056 }
0057
0058 setup_prepare()
0059 {
0060 h1=${NETIFS[p1]}
0061 swp1=${NETIFS[p2]}
0062
0063 swp2=${NETIFS[p3]}
0064 h2=${NETIFS[p4]}
0065
0066 vrf_prepare
0067
0068 h1_create
0069 h2_create
0070
0071 switch_create
0072 }
0073
0074 cleanup()
0075 {
0076 pre_cleanup
0077
0078 switch_destroy
0079
0080 h2_destroy
0081 h1_destroy
0082
0083 vrf_cleanup
0084 }
0085
0086 dev_del_test()
0087 {
0088 local trap_name="source_mac_is_multicast"
0089 local smac=01:02:03:04:05:06
0090 local num_iter=5
0091 local mz_pid
0092 local i
0093
0094 $MZ $h1 -c 0 -p 100 -a $smac -b bcast -t ip -q &
0095 mz_pid=$!
0096
0097
0098
0099
0100 RET=0
0101
0102 for i in $(seq 1 $num_iter); do
0103 log_info "Iteration $i / $num_iter"
0104
0105 devlink_trap_action_set $trap_name "trap"
0106 sleep 1
0107
0108 devlink_reload
0109
0110 sleep 20
0111
0112 cleanup
0113 setup_prepare
0114 setup_wait
0115 done
0116
0117 log_test "Device delete"
0118
0119 kill $mz_pid && wait $mz_pid &> /dev/null
0120 }
0121
0122 trap cleanup EXIT
0123
0124 setup_prepare
0125 setup_wait
0126
0127 tests_run
0128
0129 exit $EXIT_STATUS