|
1 | 1 | #!/bin/bash
|
2 | 2 | # SPDX-License-Identifier: GPL-2.0
|
3 | 3 |
|
4 |
| -ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn" |
| 4 | +ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn other_tpid" |
5 | 5 | NUM_NETIFS=4
|
6 | 6 | CHECK_TC="yes"
|
7 | 7 | source lib.sh
|
@@ -142,6 +142,58 @@ extern_learn()
|
142 | 142 | bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null
|
143 | 143 | }
|
144 | 144 |
|
| 145 | +other_tpid() |
| 146 | +{ |
| 147 | + local mac=de:ad:be:ef:13:37 |
| 148 | + |
| 149 | + # Test that packets with TPID 802.1ad VID 3 + TPID 802.1Q VID 5 are |
| 150 | + # classified as untagged by a bridge with vlan_protocol 802.1Q, and |
| 151 | + # are processed in the PVID of the ingress port (here 1). Not VID 3, |
| 152 | + # and not VID 5. |
| 153 | + RET=0 |
| 154 | + |
| 155 | + tc qdisc add dev $h2 clsact |
| 156 | + tc filter add dev $h2 ingress protocol all pref 1 handle 101 \ |
| 157 | + flower dst_mac $mac action drop |
| 158 | + ip link set $h2 promisc on |
| 159 | + ethtool -K $h2 rx-vlan-filter off rx-vlan-stag-filter off |
| 160 | + |
| 161 | + $MZ -q $h1 -c 1 -b $mac -a own "88:a8 00:03 81:00 00:05 08:00 aa-aa-aa-aa-aa-aa-aa-aa-aa" |
| 162 | + sleep 1 |
| 163 | + |
| 164 | + # Match on 'self' addresses as well, for those drivers which |
| 165 | + # do not push their learned addresses to the bridge software |
| 166 | + # database |
| 167 | + bridge -j fdb show $swp1 | \ |
| 168 | + jq -e ".[] | select(.mac == \"$(mac_get $h1)\") | select(.vlan == 1)" &> /dev/null |
| 169 | + check_err $? "FDB entry was not learned when it should" |
| 170 | + |
| 171 | + log_test "FDB entry in PVID for VLAN-tagged with other TPID" |
| 172 | + |
| 173 | + RET=0 |
| 174 | + tc -j -s filter show dev $h2 ingress \ |
| 175 | + | jq -e ".[] | select(.options.handle == 101) \ |
| 176 | + | select(.options.actions[0].stats.packets == 1)" &> /dev/null |
| 177 | + check_err $? "Packet was not forwarded when it should" |
| 178 | + log_test "Reception of VLAN with other TPID as untagged" |
| 179 | + |
| 180 | + bridge vlan del dev $swp1 vid 1 |
| 181 | + |
| 182 | + $MZ -q $h1 -c 1 -b $mac -a own "88:a8 00:03 81:00 00:05 08:00 aa-aa-aa-aa-aa-aa-aa-aa-aa" |
| 183 | + sleep 1 |
| 184 | + |
| 185 | + RET=0 |
| 186 | + tc -j -s filter show dev $h2 ingress \ |
| 187 | + | jq -e ".[] | select(.options.handle == 101) \ |
| 188 | + | select(.options.actions[0].stats.packets == 1)" &> /dev/null |
| 189 | + check_err $? "Packet was forwarded when should not" |
| 190 | + log_test "Reception of VLAN with other TPID as untagged (no PVID)" |
| 191 | + |
| 192 | + bridge vlan add dev $swp1 vid 1 pvid untagged |
| 193 | + ip link set $h2 promisc off |
| 194 | + tc qdisc del dev $h2 clsact |
| 195 | +} |
| 196 | + |
145 | 197 | trap cleanup EXIT
|
146 | 198 |
|
147 | 199 | setup_prepare
|
|
0 commit comments