WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / drivers / net / mlxsw / vxlan_fdb_veto.sh
blob749ba3cfda1d1ea08da8d7eeffff54bf2e10d0ba
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # Test vetoing of FDB entries that mlxsw can not offload. This exercises several
5 # different veto vectors to test various rollback scenarios in the vxlan driver.
7 lib_dir=$(dirname $0)/../../../net/forwarding
9 ALL_TESTS="
10 fdb_create_veto_test
11 fdb_replace_veto_test
12 fdb_append_veto_test
13 fdb_changelink_veto_test
15 NUM_NETIFS=2
16 source $lib_dir/lib.sh
18 setup_prepare()
20 swp1=${NETIFS[p1]}
21 swp2=${NETIFS[p2]}
23 ip link add dev br0 type bridge mcast_snooping 0
25 ip link set dev $swp1 up
26 ip link set dev $swp1 master br0
27 ip link set dev $swp2 up
29 ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
30 ttl 20 tos inherit local 198.51.100.1 dstport 4789
31 ip link set dev vxlan0 master br0
34 cleanup()
36 pre_cleanup
38 ip link set dev vxlan0 nomaster
39 ip link del dev vxlan0
41 ip link set dev $swp2 down
42 ip link set dev $swp1 nomaster
43 ip link set dev $swp1 down
45 ip link del dev br0
48 fdb_create_veto_test()
50 RET=0
52 bridge fdb add 01:02:03:04:05:06 dev vxlan0 self static \
53 dst 198.51.100.2 2>/dev/null
54 check_fail $? "multicast MAC not rejected"
56 bridge fdb add 01:02:03:04:05:06 dev vxlan0 self static \
57 dst 198.51.100.2 2>&1 >/dev/null | grep -q mlxsw_spectrum
58 check_err $? "multicast MAC rejected without extack"
60 log_test "vxlan FDB veto - create"
63 fdb_replace_veto_test()
65 RET=0
67 bridge fdb add 00:01:02:03:04:05 dev vxlan0 self static \
68 dst 198.51.100.2
69 check_err $? "valid FDB rejected"
71 bridge fdb replace 00:01:02:03:04:05 dev vxlan0 self static \
72 dst 198.51.100.2 port 1234 2>/dev/null
73 check_fail $? "FDB with an explicit port not rejected"
75 bridge fdb replace 00:01:02:03:04:05 dev vxlan0 self static \
76 dst 198.51.100.2 port 1234 2>&1 >/dev/null \
77 | grep -q mlxsw_spectrum
78 check_err $? "FDB with an explicit port rejected without extack"
80 log_test "vxlan FDB veto - replace"
83 fdb_append_veto_test()
85 RET=0
87 bridge fdb add 00:00:00:00:00:00 dev vxlan0 self static \
88 dst 198.51.100.2
89 check_err $? "valid FDB rejected"
91 bridge fdb append 00:00:00:00:00:00 dev vxlan0 self static \
92 dst 198.51.100.3 port 1234 2>/dev/null
93 check_fail $? "FDB with an explicit port not rejected"
95 bridge fdb append 00:00:00:00:00:00 dev vxlan0 self static \
96 dst 198.51.100.3 port 1234 2>&1 >/dev/null \
97 | grep -q mlxsw_spectrum
98 check_err $? "FDB with an explicit port rejected without extack"
100 log_test "vxlan FDB veto - append"
103 fdb_changelink_veto_test()
105 RET=0
107 ip link set dev vxlan0 type vxlan \
108 group 224.0.0.1 dev lo 2>/dev/null
109 check_fail $? "FDB with a multicast IP not rejected"
111 ip link set dev vxlan0 type vxlan \
112 group 224.0.0.1 dev lo 2>&1 >/dev/null \
113 | grep -q mlxsw_spectrum
114 check_err $? "FDB with a multicast IP rejected without extack"
116 log_test "vxlan FDB veto - changelink"
119 trap cleanup EXIT
121 setup_prepare
122 setup_wait
124 tests_run
126 exit $EXIT_STATUS