1 #!/bin/bash 1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 2 # SPDX-License-Identifier: GPL-2.0 3 # 3 # 4 # Test operations that we expect to report ext 4 # Test operations that we expect to report extended ack. 5 5 6 lib_dir=$(dirname $0)/../../../net/forwarding 6 lib_dir=$(dirname $0)/../../../net/forwarding 7 7 8 ALL_TESTS=" 8 ALL_TESTS=" 9 netdev_pre_up_test 9 netdev_pre_up_test 10 vxlan_vlan_add_test 10 vxlan_vlan_add_test 11 vxlan_bridge_create_test 11 vxlan_bridge_create_test 12 bridge_create_test 12 bridge_create_test 13 " 13 " 14 NUM_NETIFS=2 14 NUM_NETIFS=2 15 source $lib_dir/lib.sh 15 source $lib_dir/lib.sh 16 16 17 setup_prepare() 17 setup_prepare() 18 { 18 { 19 swp1=${NETIFS[p1]} 19 swp1=${NETIFS[p1]} 20 swp2=${NETIFS[p2]} 20 swp2=${NETIFS[p2]} 21 21 22 ip link set dev $swp1 up 22 ip link set dev $swp1 up 23 ip link set dev $swp2 up 23 ip link set dev $swp2 up 24 } 24 } 25 25 26 cleanup() 26 cleanup() 27 { 27 { 28 pre_cleanup 28 pre_cleanup 29 29 30 ip link set dev $swp2 down 30 ip link set dev $swp2 down 31 ip link set dev $swp1 down 31 ip link set dev $swp1 down 32 } 32 } 33 33 34 netdev_pre_up_test() 34 netdev_pre_up_test() 35 { 35 { 36 RET=0 36 RET=0 37 37 38 ip link add name br1 type bridge vlan_ 38 ip link add name br1 type bridge vlan_filtering 0 mcast_snooping 0 39 ip link set dev br1 addrgenmode none 39 ip link set dev br1 addrgenmode none 40 ip link set dev br1 up 40 ip link set dev br1 up 41 ip link add name vx1 up type vxlan id 41 ip link add name vx1 up type vxlan id 1000 \ 42 local 192.0.2.17 remote 192.0. 42 local 192.0.2.17 remote 192.0.2.18 \ 43 dstport 4789 nolearning noudpc 43 dstport 4789 nolearning noudpcsum tos inherit ttl 100 44 44 45 ip link set dev vx1 master br1 45 ip link set dev vx1 master br1 46 check_err $? 46 check_err $? 47 47 48 ip link set dev $swp1 master br1 48 ip link set dev $swp1 master br1 49 check_err $? 49 check_err $? 50 50 51 ip link add name br2 type bridge vlan_ 51 ip link add name br2 type bridge vlan_filtering 0 mcast_snooping 0 52 ip link set dev br2 addrgenmode none 52 ip link set dev br2 addrgenmode none 53 ip link set dev br2 up 53 ip link set dev br2 up 54 ip link add name vx2 up type vxlan id 54 ip link add name vx2 up type vxlan id 2000 \ 55 local 192.0.2.17 remote 192.0. 55 local 192.0.2.17 remote 192.0.2.18 \ 56 dstport 4789 nolearning noudpc 56 dstport 4789 nolearning noudpcsum tos inherit ttl 100 57 57 58 ip link set dev vx2 master br2 58 ip link set dev vx2 master br2 59 check_err $? 59 check_err $? 60 60 61 ip link set dev $swp2 master br2 61 ip link set dev $swp2 master br2 62 check_err $? 62 check_err $? 63 63 64 # Unsupported configuration: mlxsw dem 64 # Unsupported configuration: mlxsw demands that all offloaded VXLAN 65 # devices have the same TTL. 65 # devices have the same TTL. 66 ip link set dev vx2 down 66 ip link set dev vx2 down 67 ip link set dev vx2 type vxlan ttl 200 67 ip link set dev vx2 type vxlan ttl 200 68 68 69 ip link set dev vx2 up &>/dev/null 69 ip link set dev vx2 up &>/dev/null 70 check_fail $? 70 check_fail $? 71 71 72 ip link set dev vx2 up 2>&1 >/dev/null 72 ip link set dev vx2 up 2>&1 >/dev/null | grep -q mlxsw_spectrum 73 check_err $? 73 check_err $? 74 74 75 log_test "extack - NETDEV_PRE_UP" 75 log_test "extack - NETDEV_PRE_UP" 76 76 77 ip link del dev vx2 77 ip link del dev vx2 78 ip link del dev br2 78 ip link del dev br2 79 79 80 ip link del dev vx1 80 ip link del dev vx1 81 ip link del dev br1 81 ip link del dev br1 82 } 82 } 83 83 84 vxlan_vlan_add_test() 84 vxlan_vlan_add_test() 85 { 85 { 86 RET=0 86 RET=0 87 87 88 ip link add name br1 type bridge vlan_ 88 ip link add name br1 type bridge vlan_filtering 1 mcast_snooping 0 89 ip link set dev br1 addrgenmode none 89 ip link set dev br1 addrgenmode none 90 ip link set dev br1 up 90 ip link set dev br1 up 91 91 92 # Unsupported configuration: mlxsw dem 92 # Unsupported configuration: mlxsw demands VXLAN with "noudpcsum". 93 ip link add name vx1 up type vxlan id 93 ip link add name vx1 up type vxlan id 1000 \ 94 local 192.0.2.17 remote 192.0. 94 local 192.0.2.17 remote 192.0.2.18 \ 95 dstport 4789 tos inherit ttl 1 95 dstport 4789 tos inherit ttl 100 96 96 97 ip link set dev vx1 master br1 97 ip link set dev vx1 master br1 98 check_err $? 98 check_err $? 99 99 100 bridge vlan add dev vx1 vid 1 100 bridge vlan add dev vx1 vid 1 101 check_err $? 101 check_err $? 102 102 103 ip link set dev $swp1 master br1 103 ip link set dev $swp1 master br1 104 check_err $? 104 check_err $? 105 105 106 bridge vlan add dev vx1 vid 1 pvid unt 106 bridge vlan add dev vx1 vid 1 pvid untagged 2>&1 >/dev/null \ 107 | grep -q mlxsw_spectrum 107 | grep -q mlxsw_spectrum 108 check_err $? 108 check_err $? 109 109 110 log_test "extack - map VLAN at VXLAN d 110 log_test "extack - map VLAN at VXLAN device" 111 111 112 ip link del dev vx1 112 ip link del dev vx1 113 ip link del dev br1 113 ip link del dev br1 114 } 114 } 115 115 116 vxlan_bridge_create_test() 116 vxlan_bridge_create_test() 117 { 117 { 118 RET=0 118 RET=0 119 119 120 # Unsupported configuration: mlxsw dem 120 # Unsupported configuration: mlxsw demands VXLAN with "noudpcsum". 121 ip link add name vx1 up type vxlan id 121 ip link add name vx1 up type vxlan id 1000 \ 122 local 192.0.2.17 remote 192.0. 122 local 192.0.2.17 remote 192.0.2.18 \ 123 dstport 4789 tos inherit ttl 1 123 dstport 4789 tos inherit ttl 100 124 124 125 # Test with VLAN-aware bridge. 125 # Test with VLAN-aware bridge. 126 ip link add name br1 type bridge vlan_ 126 ip link add name br1 type bridge vlan_filtering 1 mcast_snooping 0 127 ip link set dev br1 addrgenmode none 127 ip link set dev br1 addrgenmode none 128 ip link set dev br1 up 128 ip link set dev br1 up 129 129 130 ip link set dev vx1 master br1 130 ip link set dev vx1 master br1 131 131 132 ip link set dev $swp1 master br1 2>&1 132 ip link set dev $swp1 master br1 2>&1 > /dev/null \ 133 | grep -q mlxsw_spectrum 133 | grep -q mlxsw_spectrum 134 check_err $? 134 check_err $? 135 135 136 # Test with VLAN-unaware bridge. 136 # Test with VLAN-unaware bridge. 137 ip link set dev br1 type bridge vlan_f 137 ip link set dev br1 type bridge vlan_filtering 0 138 138 139 ip link set dev $swp1 master br1 2>&1 139 ip link set dev $swp1 master br1 2>&1 > /dev/null \ 140 | grep -q mlxsw_spectrum 140 | grep -q mlxsw_spectrum 141 check_err $? 141 check_err $? 142 142 143 log_test "extack - bridge creation wit 143 log_test "extack - bridge creation with VXLAN" 144 144 145 ip link del dev br1 145 ip link del dev br1 146 ip link del dev vx1 146 ip link del dev vx1 147 } 147 } 148 148 149 bridge_create_test() 149 bridge_create_test() 150 { 150 { 151 RET=0 151 RET=0 152 152 153 ip link add name br1 type bridge vlan_ 153 ip link add name br1 type bridge vlan_filtering 1 154 ip link set dev br1 addrgenmode none 154 ip link set dev br1 addrgenmode none 155 ip link set dev br1 up 155 ip link set dev br1 up 156 ip link add name br2 type bridge vlan_ 156 ip link add name br2 type bridge vlan_filtering 1 157 ip link set dev br2 addrgenmode none 157 ip link set dev br2 addrgenmode none 158 ip link set dev br2 up 158 ip link set dev br2 up 159 159 160 ip link set dev $swp1 master br1 160 ip link set dev $swp1 master br1 161 check_err $? 161 check_err $? 162 162 163 # Only one VLAN-aware bridge is suppor 163 # Only one VLAN-aware bridge is supported, so this should fail with 164 # an extack. 164 # an extack. 165 ip link set dev $swp2 master br2 2>&1 165 ip link set dev $swp2 master br2 2>&1 > /dev/null \ 166 | grep -q mlxsw_spectrum 166 | grep -q mlxsw_spectrum 167 check_err $? 167 check_err $? 168 168 169 log_test "extack - multiple VLAN-aware 169 log_test "extack - multiple VLAN-aware bridges creation" 170 170 171 ip link del dev br2 171 ip link del dev br2 172 ip link del dev br1 172 ip link del dev br1 173 } 173 } 174 174 175 trap cleanup EXIT 175 trap cleanup EXIT 176 176 177 setup_prepare 177 setup_prepare 178 setup_wait 178 setup_wait 179 179 180 tests_run 180 tests_run 181 181 182 exit $EXIT_STATUS 182 exit $EXIT_STATUS
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.