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