~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/vxlan_fdb_veto.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  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.
  6 
  7 : ${LOCAL_IP:=198.51.100.1}
  8 export LOCAL_IP
  9 
 10 : ${REMOTE_IP_1:=198.51.100.2}
 11 export REMOTE_IP_1
 12 
 13 : ${REMOTE_IP_2:=198.51.100.3}
 14 export REMOTE_IP_2
 15 
 16 : ${UDPCSUM_FLAFS:=noudpcsum}
 17 export UDPCSUM_FLAFS
 18 
 19 : ${MC_IP:=224.0.0.1}
 20 export MC_IP
 21 
 22 lib_dir=$(dirname $0)/../../../net/forwarding
 23 
 24 ALL_TESTS="
 25         fdb_create_veto_test
 26         fdb_replace_veto_test
 27         fdb_append_veto_test
 28         fdb_changelink_veto_test
 29 "
 30 NUM_NETIFS=2
 31 source $lib_dir/lib.sh
 32 
 33 setup_prepare()
 34 {
 35         swp1=${NETIFS[p1]}
 36         swp2=${NETIFS[p2]}
 37 
 38         ip link add dev br0 type bridge mcast_snooping 0
 39 
 40         ip link set dev $swp1 up
 41         ip link set dev $swp1 master br0
 42         ip link set dev $swp2 up
 43 
 44         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
 45                 ttl 20 tos inherit local $LOCAL_IP dstport 4789
 46         ip link set dev vxlan0 master br0
 47 }
 48 
 49 cleanup()
 50 {
 51         pre_cleanup
 52 
 53         ip link set dev vxlan0 nomaster
 54         ip link del dev vxlan0
 55 
 56         ip link set dev $swp2 down
 57         ip link set dev $swp1 nomaster
 58         ip link set dev $swp1 down
 59 
 60         ip link del dev br0
 61 }
 62 
 63 fdb_create_veto_test()
 64 {
 65         RET=0
 66 
 67         bridge fdb add 01:02:03:04:05:06 dev vxlan0 self static \
 68                dst $REMOTE_IP_1 2>/dev/null
 69         check_fail $? "multicast MAC not rejected"
 70 
 71         bridge fdb add 01:02:03:04:05:06 dev vxlan0 self static \
 72                dst $REMOTE_IP_1 2>&1 >/dev/null | grep -q mlxsw_spectrum
 73         check_err $? "multicast MAC rejected without extack"
 74 
 75         log_test "vxlan FDB veto - create"
 76 }
 77 
 78 fdb_replace_veto_test()
 79 {
 80         RET=0
 81 
 82         bridge fdb add 00:01:02:03:04:05 dev vxlan0 self static \
 83                dst $REMOTE_IP_1
 84         check_err $? "valid FDB rejected"
 85 
 86         bridge fdb replace 00:01:02:03:04:05 dev vxlan0 self static \
 87                dst $REMOTE_IP_1 port 1234 2>/dev/null
 88         check_fail $? "FDB with an explicit port not rejected"
 89 
 90         bridge fdb replace 00:01:02:03:04:05 dev vxlan0 self static \
 91                dst $REMOTE_IP_1 port 1234 2>&1 >/dev/null \
 92             | grep -q mlxsw_spectrum
 93         check_err $? "FDB with an explicit port rejected without extack"
 94 
 95         log_test "vxlan FDB veto - replace"
 96 }
 97 
 98 fdb_append_veto_test()
 99 {
100         RET=0
101 
102         bridge fdb add 00:00:00:00:00:00 dev vxlan0 self static \
103                dst $REMOTE_IP_1
104         check_err $? "valid FDB rejected"
105 
106         bridge fdb append 00:00:00:00:00:00 dev vxlan0 self static \
107                dst $REMOTE_IP_2 port 1234 2>/dev/null
108         check_fail $? "FDB with an explicit port not rejected"
109 
110         bridge fdb append 00:00:00:00:00:00 dev vxlan0 self static \
111                dst $REMOTE_IP_2 port 1234 2>&1 >/dev/null \
112             | grep -q mlxsw_spectrum
113         check_err $? "FDB with an explicit port rejected without extack"
114 
115         log_test "vxlan FDB veto - append"
116 }
117 
118 fdb_changelink_veto_test()
119 {
120         RET=0
121 
122         ip link set dev vxlan0 type vxlan \
123            group $MC_IP dev lo 2>/dev/null
124         check_fail $? "FDB with a multicast IP not rejected"
125 
126         ip link set dev vxlan0 type vxlan \
127            group $MC_IP dev lo 2>&1 >/dev/null \
128             | grep -q mlxsw_spectrum
129         check_err $? "FDB with a multicast IP rejected without extack"
130 
131         log_test "vxlan FDB veto - changelink"
132 }
133 
134 trap cleanup EXIT
135 
136 setup_prepare
137 setup_wait
138 
139 tests_run
140 
141 exit $EXIT_STATUS

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php