xref: /linux/tools/testing/selftests/net/forwarding/local_termination.sh (revision dfecb0c5af3b07ebfa84be63a7a21bfc9e29a872)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4ALL_TESTS="standalone vlan_unaware_bridge vlan_aware_bridge test_vlan \
5	   vlan_over_vlan_unaware_bridged_port vlan_over_vlan_aware_bridged_port \
6	   vlan_over_vlan_unaware_bridge vlan_over_vlan_aware_bridge"
7NUM_NETIFS=2
8PING_COUNT=1
9REQUIRE_MTOOLS=yes
10
11source lib.sh
12
13H1_IPV4="192.0.2.1"
14H2_IPV4="192.0.2.2"
15H1_IPV6="2001:db8:1::1"
16H2_IPV6="2001:db8:1::2"
17
18BRIDGE_ADDR="00:00:de:ad:be:ee"
19MACVLAN_ADDR="00:00:de:ad:be:ef"
20UNKNOWN_UC_ADDR1="de:ad:be:ef:ee:03"
21UNKNOWN_UC_ADDR2="de:ad:be:ef:ee:04"
22UNKNOWN_UC_ADDR3="de:ad:be:ef:ee:05"
23JOINED_IPV4_MC_ADDR="225.1.2.3"
24UNKNOWN_IPV4_MC_ADDR1="225.1.2.4"
25UNKNOWN_IPV4_MC_ADDR2="225.1.2.5"
26UNKNOWN_IPV4_MC_ADDR3="225.1.2.6"
27JOINED_IPV6_MC_ADDR="ff2e::0102:0304"
28UNKNOWN_IPV6_MC_ADDR1="ff2e::0102:0305"
29UNKNOWN_IPV6_MC_ADDR2="ff2e::0102:0306"
30UNKNOWN_IPV6_MC_ADDR3="ff2e::0102:0307"
31
32JOINED_MACV4_MC_ADDR="01:00:5e:01:02:03"
33UNKNOWN_MACV4_MC_ADDR1="01:00:5e:01:02:04"
34UNKNOWN_MACV4_MC_ADDR2="01:00:5e:01:02:05"
35UNKNOWN_MACV4_MC_ADDR3="01:00:5e:01:02:06"
36JOINED_MACV6_MC_ADDR="33:33:01:02:03:04"
37UNKNOWN_MACV6_MC_ADDR1="33:33:01:02:03:05"
38UNKNOWN_MACV6_MC_ADDR2="33:33:01:02:03:06"
39UNKNOWN_MACV6_MC_ADDR3="33:33:01:02:03:07"
40
41PTP_1588_L2_SYNC=" \
4201:1b:19:00:00:00 00:00:de:ad:be:ef 88:f7 00 02 \
4300 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
4400 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
4500 00 00 00 00 00 00 00 00 00"
46PTP_1588_L2_FOLLOW_UP=" \
4701:1b:19:00:00:00 00:00:de:ad:be:ef 88:f7 08 02 \
4800 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
4900 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
5000 00 66 83 c5 f1 17 97 ed f0"
51PTP_1588_L2_PDELAY_REQ=" \
5201:80:c2:00:00:0e 00:00:de:ad:be:ef 88:f7 02 02 \
5300 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
5400 00 3e 37 63 ff fe cf 17 0e 00 01 00 06 05 7f \
5500 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
5600 00 00 00"
57PTP_1588_IPV4_SYNC=" \
5801:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
5900 48 0a 9a 40 00 01 11 cb 88 c0 00 02 01 e0 00 \
6001 81 01 3f 01 3f 00 34 9f 41 00 02 00 2c 00 00 \
6102 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
6263 ff fe cf 17 0e 00 01 00 00 00 00 00 00 00 00 \
6300 00 00 00 00 00"
64PTP_1588_IPV4_FOLLOW_UP="
6501:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
6600 48 0a 9b 40 00 01 11 cb 87 c0 00 02 01 e0 00 \
6701 81 01 40 01 40 00 34 eb 8a 08 02 00 2c 00 00 \
6800 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
6963 ff fe cf 17 0e 00 01 00 00 02 00 00 00 66 83 \
70c6 0f 1d 9a 61 87"
71PTP_1588_IPV4_PDELAY_REQ=" \
7201:00:5e:00:00:6b 00:00:de:ad:be:ef 08:00 45 00 \
7300 52 35 a9 40 00 01 11 a1 85 c0 00 02 01 e0 00 \
7400 6b 01 3f 01 3f 00 3e 9a b9 02 02 00 36 00 00 \
7500 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
7663 ff fe cf 17 0e 00 01 00 01 05 7f 00 00 00 00 \
7700 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
78PTP_1588_IPV6_SYNC=" \
7933:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 06 \
807c 2f 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
8100 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
8200 00 00 00 01 81 01 3f 01 3f 00 36 14 76 00 02 \
8300 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
8400 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
8500 00 00 00 00 00 00 00 00 00 00 00"
86PTP_1588_IPV6_FOLLOW_UP=" \
8733:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 0a \
8800 bc 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
8900 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
9000 00 00 00 01 81 01 40 01 40 00 36 f0 47 08 02 \
9100 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
9200 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
9300 00 66 83 c6 2a 32 09 bd 74 00 00"
94PTP_1588_IPV6_PDELAY_REQ=" \
9533:33:00:00:00:6b 00:00:de:ad:be:ef 86:dd 60 0c \
965c fd 00 40 11 01 fe 80 00 00 00 00 00 00 3c 37 \
9763 ff fe cf 17 0e ff 02 00 00 00 00 00 00 00 00 \
9800 00 00 00 00 6b 01 3f 01 3f 00 40 89 1f 02 02 \
9900 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
10000 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \
10100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
10200 00 00 00 00 00"
103LINK_LOCAL_STP_BPDU=" \
10401:80:c2:00:00:00 00:00:de:ad:be:ef 00 26 42 42 03 \
10500 00 00 00 00 80 00 aa bb cc dd ee ff 00 00 00 00 \
10680 00 aa bb cc dd ee ff 80 01 00 00 14 00 02 00 \
1070f 00"
108LINK_LOCAL_LLDP=" \
10901:80:c2:00:00:0e 00:00:de:ad:be:ef 88:cc 02 07 04 \
11000 11 22 33 44 55 04 05 05 65 74 68 30 06 02 00 \
11178 00 00"
112
113# Disable promisc to ensure we don't receive unknown MAC DA packets
114export TCPDUMP_EXTRA_FLAGS="-pl"
115
116h1=${NETIFS[p1]}
117h2=${NETIFS[p2]}
118
119send_raw()
120{
121	local if_name=$1; shift
122	local pkt="$1"; shift
123	local smac=$(mac_get $if_name)
124
125	pkt="${pkt/00:00:de:ad:be:ef/$smac}"
126
127	$MZ -q $if_name "$pkt"
128}
129
130send_uc_ipv4()
131{
132	local if_name=$1
133	local dmac=$2
134
135	ip neigh add $H2_IPV4 lladdr $dmac dev $if_name
136	ping_do $if_name $H2_IPV4
137	ip neigh del $H2_IPV4 dev $if_name
138}
139
140check_rcv()
141{
142	local if_name=$1; shift
143	local type=$1; shift
144	local pattern=$1; shift
145	local should_receive=$1; shift
146	local test_name="$1"; shift
147	local should_fail=
148
149	[ $should_receive = true ] && should_fail=0 || should_fail=1
150	RET=0
151
152	tcpdump_show $if_name | grep -q "$pattern"
153
154	check_err_fail "$should_fail" "$?" "reception"
155
156	log_test "$test_name: $type"
157}
158
159mc_route_prepare()
160{
161	local if_name=$1
162	local vrf_name=$(master_name_get $if_name)
163
164	ip route add 225.100.1.0/24 dev $if_name vrf $vrf_name
165	ip -6 route add ff2e::/64 dev $if_name vrf $vrf_name
166}
167
168mc_route_destroy()
169{
170	local if_name=$1
171	local vrf_name=$(master_name_get $if_name)
172
173	ip route del 225.100.1.0/24 dev $if_name vrf $vrf_name
174	ip -6 route del ff2e::/64 dev $if_name vrf $vrf_name
175}
176
177run_test()
178{
179	local send_if_name=$1; shift
180	local rcv_if_name=$1; shift
181	local skip_ptp=$1; shift
182	local no_unicast_flt=$1; shift
183	local test_name="$1"; shift
184	local smac=$(mac_get $send_if_name)
185	local rcv_dmac=$(mac_get $rcv_if_name)
186	local should_receive
187
188	setup_wait
189
190	tcpdump_start $rcv_if_name
191
192	mc_route_prepare $send_if_name
193	mc_route_prepare $rcv_if_name
194
195	send_uc_ipv4 $send_if_name $rcv_dmac
196	send_uc_ipv4 $send_if_name $MACVLAN_ADDR
197	send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR1
198
199	ip link set dev $rcv_if_name promisc on
200	send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR2
201	mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR2
202	mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR2
203	ip link set dev $rcv_if_name promisc off
204
205	mc_join $rcv_if_name $JOINED_IPV4_MC_ADDR
206	mc_send $send_if_name $JOINED_IPV4_MC_ADDR
207	mc_leave
208
209	mc_join $rcv_if_name $JOINED_IPV6_MC_ADDR
210	mc_send $send_if_name $JOINED_IPV6_MC_ADDR
211	mc_leave
212
213	mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR1
214	mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR1
215
216	ip link set dev $rcv_if_name allmulticast on
217	send_uc_ipv4 $send_if_name $UNKNOWN_UC_ADDR3
218	mc_send $send_if_name $UNKNOWN_IPV4_MC_ADDR3
219	mc_send $send_if_name $UNKNOWN_IPV6_MC_ADDR3
220	ip link set dev $rcv_if_name allmulticast off
221
222	mc_route_destroy $rcv_if_name
223	mc_route_destroy $send_if_name
224
225	ip maddress add 01:80:c2:00:00:00 dev $rcv_if_name
226	send_raw $send_if_name "$LINK_LOCAL_STP_BPDU"
227	ip maddress del 01:80:c2:00:00:00 dev $rcv_if_name
228
229	if [ $skip_ptp = false ]; then
230		ip maddress add 01:80:c2:00:00:0e dev $rcv_if_name
231		send_raw $send_if_name "$LINK_LOCAL_LLDP"
232		ip maddress del 01:80:c2:00:00:0e dev $rcv_if_name
233
234		ip maddress add 01:1b:19:00:00:00 dev $rcv_if_name
235		send_raw $send_if_name "$PTP_1588_L2_SYNC"
236		send_raw $send_if_name "$PTP_1588_L2_FOLLOW_UP"
237		ip maddress del 01:1b:19:00:00:00 dev $rcv_if_name
238
239		ip maddress add 01:80:c2:00:00:0e dev $rcv_if_name
240		send_raw $send_if_name "$PTP_1588_L2_PDELAY_REQ"
241		ip maddress del 01:80:c2:00:00:0e dev $rcv_if_name
242
243		mc_join $rcv_if_name 224.0.1.129
244		send_raw $send_if_name "$PTP_1588_IPV4_SYNC"
245		send_raw $send_if_name "$PTP_1588_IPV4_FOLLOW_UP"
246		mc_leave
247
248		mc_join $rcv_if_name 224.0.0.107
249		send_raw $send_if_name "$PTP_1588_IPV4_PDELAY_REQ"
250		mc_leave
251
252		mc_join $rcv_if_name ff0e::181
253		send_raw $send_if_name "$PTP_1588_IPV6_SYNC"
254		send_raw $send_if_name "$PTP_1588_IPV6_FOLLOW_UP"
255		mc_leave
256
257		mc_join $rcv_if_name ff02::6b
258		send_raw $send_if_name "$PTP_1588_IPV6_PDELAY_REQ"
259		mc_leave
260	fi
261
262	sleep 1
263
264	tcpdump_stop $rcv_if_name
265
266	check_rcv $rcv_if_name "Unicast IPv4 to primary MAC address" \
267		"$smac > $rcv_dmac, ethertype IPv4 (0x0800)" \
268		true "$test_name"
269
270	check_rcv $rcv_if_name "Unicast IPv4 to macvlan MAC address" \
271		"$smac > $MACVLAN_ADDR, ethertype IPv4 (0x0800)" \
272		true "$test_name"
273
274	[ $no_unicast_flt = true ] && should_receive=true || should_receive=false
275	check_rcv $rcv_if_name "Unicast IPv4 to unknown MAC address" \
276		"$smac > $UNKNOWN_UC_ADDR1, ethertype IPv4 (0x0800)" \
277		$should_receive "$test_name"
278
279	check_rcv $rcv_if_name "Unicast IPv4 to unknown MAC address, promisc" \
280		"$smac > $UNKNOWN_UC_ADDR2, ethertype IPv4 (0x0800)" \
281		true "$test_name"
282
283	[ $no_unicast_flt = true ] && should_receive=true || should_receive=false
284	check_rcv $rcv_if_name \
285		"Unicast IPv4 to unknown MAC address, allmulti" \
286		"$smac > $UNKNOWN_UC_ADDR3, ethertype IPv4 (0x0800)" \
287		$should_receive "$test_name"
288
289	check_rcv $rcv_if_name "Multicast IPv4 to joined group" \
290		"$smac > $JOINED_MACV4_MC_ADDR, ethertype IPv4 (0x0800)" \
291		true "$test_name"
292
293	xfail \
294		check_rcv $rcv_if_name \
295			"Multicast IPv4 to unknown group" \
296			"$smac > $UNKNOWN_MACV4_MC_ADDR1, ethertype IPv4 (0x0800)" \
297			false "$test_name"
298
299	check_rcv $rcv_if_name "Multicast IPv4 to unknown group, promisc" \
300		"$smac > $UNKNOWN_MACV4_MC_ADDR2, ethertype IPv4 (0x0800)" \
301		true "$test_name"
302
303	check_rcv $rcv_if_name "Multicast IPv4 to unknown group, allmulti" \
304		"$smac > $UNKNOWN_MACV4_MC_ADDR3, ethertype IPv4 (0x0800)" \
305		true "$test_name"
306
307	check_rcv $rcv_if_name "Multicast IPv6 to joined group" \
308		"$smac > $JOINED_MACV6_MC_ADDR, ethertype IPv6 (0x86dd)" \
309		true "$test_name"
310
311	xfail \
312		check_rcv $rcv_if_name "Multicast IPv6 to unknown group" \
313			"$smac > $UNKNOWN_MACV6_MC_ADDR1, ethertype IPv6 (0x86dd)" \
314			false "$test_name"
315
316	check_rcv $rcv_if_name "Multicast IPv6 to unknown group, promisc" \
317		"$smac > $UNKNOWN_MACV6_MC_ADDR2, ethertype IPv6 (0x86dd)" \
318		true "$test_name"
319
320	check_rcv $rcv_if_name "Multicast IPv6 to unknown group, allmulti" \
321		"$smac > $UNKNOWN_MACV6_MC_ADDR3, ethertype IPv6 (0x86dd)" \
322		true "$test_name"
323
324	check_rcv $rcv_if_name "Link-local STP BPDU" \
325		"> 01:80:c2:00:00:00" \
326		true "$test_name"
327
328	if [ $skip_ptp = false ]; then
329		check_rcv $rcv_if_name "Link-local LLDP" \
330			"> 01:80:c2:00:00:0e" \
331			true "$test_name"
332
333		check_rcv $rcv_if_name "1588v2 over L2 transport, Sync" \
334			"ethertype PTP (0x88f7).* PTPv2.* msg type *: sync msg" \
335			true "$test_name"
336
337		check_rcv $rcv_if_name "1588v2 over L2 transport, Follow-Up" \
338			"ethertype PTP (0x88f7).* PTPv2.* msg type *: follow up msg" \
339			true "$test_name"
340
341		check_rcv $rcv_if_name "1588v2 over L2 transport, Peer Delay Request" \
342			"ethertype PTP (0x88f7).* PTPv2.* msg type *: peer delay req msg" \
343			true "$test_name"
344
345		check_rcv $rcv_if_name "1588v2 over IPv4, Sync" \
346			"ethertype IPv4 (0x0800).* PTPv2.* msg type *: sync msg" \
347			true "$test_name"
348
349		check_rcv $rcv_if_name "1588v2 over IPv4, Follow-Up" \
350			"ethertype IPv4 (0x0800).* PTPv2.* msg type *: follow up msg" \
351			true "$test_name"
352
353		check_rcv $rcv_if_name "1588v2 over IPv4, Peer Delay Request" \
354			"ethertype IPv4 (0x0800).* PTPv2.* msg type *: peer delay req msg" \
355			true "$test_name"
356
357		check_rcv $rcv_if_name "1588v2 over IPv6, Sync" \
358			"ethertype IPv6 (0x86dd).* PTPv2.* msg type *: sync msg" \
359			true "$test_name"
360
361		check_rcv $rcv_if_name "1588v2 over IPv6, Follow-Up" \
362			"ethertype IPv6 (0x86dd).* PTPv2.* msg type *: follow up msg" \
363			true "$test_name"
364
365		check_rcv $rcv_if_name "1588v2 over IPv6, Peer Delay Request" \
366			"ethertype IPv6 (0x86dd).* PTPv2.* msg type *: peer delay req msg" \
367			true "$test_name"
368	fi
369
370	tcpdump_cleanup $rcv_if_name
371}
372
373h1_create()
374{
375	simple_if_init $h1 $H1_IPV4/24 $H1_IPV6/64
376}
377
378h1_destroy()
379{
380	simple_if_fini $h1 $H1_IPV4/24 $H1_IPV6/64
381}
382
383h2_create()
384{
385	simple_if_init $h2 $H2_IPV4/24 $H2_IPV6/64
386}
387
388h2_destroy()
389{
390	simple_if_fini $h2 $H2_IPV4/24 $H2_IPV6/64
391}
392
393h1_vlan_create()
394{
395	simple_if_init $h1
396	vlan_create $h1 100 v$h1 $H1_IPV4/24 $H1_IPV6/64
397}
398
399h1_vlan_destroy()
400{
401	vlan_destroy $h1 100
402	simple_if_fini $h1
403}
404
405h2_vlan_create()
406{
407	simple_if_init $h2
408	vlan_create $h2 100 v$h2 $H2_IPV4/24 $H2_IPV6/64
409}
410
411h2_vlan_destroy()
412{
413	vlan_destroy $h2 100
414	simple_if_fini $h2
415}
416
417bridge_create()
418{
419	local vlan_filtering=$1
420
421	ip link add br0 type bridge vlan_filtering $vlan_filtering
422	ip link set br0 address $BRIDGE_ADDR
423	ip link set br0 up
424
425	ip link set $h2 master br0
426	ip link set $h2 up
427}
428
429bridge_destroy()
430{
431	ip link del br0
432}
433
434macvlan_create()
435{
436	local lower=$1
437
438	ip link add link $lower name macvlan0 type macvlan mode private
439	ip link set macvlan0 address $MACVLAN_ADDR
440	ip link set macvlan0 up
441}
442
443macvlan_destroy()
444{
445	ip link del macvlan0
446}
447
448standalone()
449{
450	local no_unicast_flt=true
451	local skip_ptp=false
452
453	if [ $(has_unicast_flt $h2) = yes ]; then
454		no_unicast_flt=false
455	fi
456
457	h1_create
458	h2_create
459	macvlan_create $h2
460
461	run_test $h1 $h2 $skip_ptp $no_unicast_flt "$h2"
462
463	macvlan_destroy
464	h2_destroy
465	h1_destroy
466}
467
468test_bridge()
469{
470	local no_unicast_flt=true
471	local vlan_filtering=$1
472	local skip_ptp=true
473
474	h1_create
475	bridge_create $vlan_filtering
476	simple_if_init br0 $H2_IPV4/24 $H2_IPV6/64
477	macvlan_create br0
478
479	run_test $h1 br0 $skip_ptp $no_unicast_flt \
480		"vlan_filtering=$vlan_filtering bridge"
481
482	macvlan_destroy
483	simple_if_fini br0 $H2_IPV4/24 $H2_IPV6/64
484	bridge_destroy
485	h1_destroy
486}
487
488vlan_unaware_bridge()
489{
490	test_bridge 0
491}
492
493vlan_aware_bridge()
494{
495	test_bridge 1
496}
497
498test_vlan()
499{
500	local no_unicast_flt=true
501	local skip_ptp=false
502
503	if [ $(has_unicast_flt $h2) = yes ]; then
504		no_unicast_flt=false
505	fi
506
507	h1_vlan_create
508	h2_vlan_create
509	macvlan_create $h2.100
510
511	run_test $h1.100 $h2.100 $skip_ptp $no_unicast_flt "VLAN upper"
512
513	macvlan_destroy
514	h2_vlan_destroy
515	h1_vlan_destroy
516}
517
518vlan_over_bridged_port()
519{
520	local no_unicast_flt=true
521	local vlan_filtering=$1
522	local skip_ptp=false
523
524	# br_manage_promisc() will not force a single vlan_filtering port to
525	# promiscuous mode, so we should still expect unicast filtering to take
526	# place if the device can do it.
527	if [ $(has_unicast_flt $h2) = yes ] && [ $vlan_filtering = 1 ]; then
528		no_unicast_flt=false
529	fi
530
531	h1_vlan_create
532	h2_vlan_create
533	bridge_create $vlan_filtering
534	macvlan_create $h2.100
535
536	run_test $h1.100 $h2.100 $skip_ptp $no_unicast_flt \
537		"VLAN over vlan_filtering=$vlan_filtering bridged port"
538
539	macvlan_destroy
540	bridge_destroy
541	h2_vlan_destroy
542	h1_vlan_destroy
543}
544
545vlan_over_vlan_unaware_bridged_port()
546{
547	vlan_over_bridged_port 0
548}
549
550vlan_over_vlan_aware_bridged_port()
551{
552	vlan_over_bridged_port 1
553}
554
555vlan_over_bridge()
556{
557	local no_unicast_flt=true
558	local vlan_filtering=$1
559	local skip_ptp=true
560
561	h1_vlan_create
562	bridge_create $vlan_filtering
563	simple_if_init br0
564	vlan_create br0 100 vbr0 $H2_IPV4/24 $H2_IPV6/64
565	macvlan_create br0.100
566
567	if [ $vlan_filtering = 1 ]; then
568		bridge vlan add dev $h2 vid 100 master
569		bridge vlan add dev br0 vid 100 self
570	fi
571
572	run_test $h1.100 br0.100 $skip_ptp $no_unicast_flt \
573		"VLAN over vlan_filtering=$vlan_filtering bridge"
574
575	if [ $vlan_filtering = 1 ]; then
576		bridge vlan del dev br0 vid 100 self
577		bridge vlan del dev $h2 vid 100 master
578	fi
579
580	macvlan_destroy
581	vlan_destroy br0 100
582	simple_if_fini br0
583	bridge_destroy
584	h1_vlan_destroy
585}
586
587vlan_over_vlan_unaware_bridge()
588{
589	vlan_over_bridge 0
590}
591
592vlan_over_vlan_aware_bridge()
593{
594	vlan_over_bridge 1
595}
596
597cleanup()
598{
599	pre_cleanup
600
601	ip link set $h2 down
602	ip link set $h1 down
603
604	vrf_cleanup
605}
606
607setup_prepare()
608{
609	vrf_prepare
610	# setup_wait() needs this
611	ip link set $h1 up
612	ip link set $h2 up
613}
614
615trap cleanup EXIT
616
617setup_prepare
618setup_wait
619
620tests_run
621
622exit $EXIT_STATUS
623