Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4NUM_NETIFS=4
5CHECK_TC="yes"
6source lib.sh
7
8h1_create()
9{
10 simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
11}
12
13h1_destroy()
14{
15 simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64
16}
17
18h2_create()
19{
20 simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64
21}
22
23h2_destroy()
24{
25 simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
26}
27
28switch_create()
29{
30 # 10 Seconds ageing time.
31 ip link add dev br0 type bridge vlan_filtering 1 ageing_time 1000 \
32 mcast_snooping 0
33
34 ip link set dev $swp1 master br0
35 ip link set dev $swp2 master br0
36
37 ip link set dev br0 up
38 ip link set dev $swp1 up
39 ip link set dev $swp2 up
40}
41
42switch_destroy()
43{
44 ip link set dev $swp2 down
45 ip link set dev $swp1 down
46
47 ip link del dev br0
48}
49
50setup_prepare()
51{
52 h1=${NETIFS[p1]}
53 swp1=${NETIFS[p2]}
54
55 swp2=${NETIFS[p3]}
56 h2=${NETIFS[p4]}
57
58 vrf_prepare
59
60 h1_create
61 h2_create
62
63 switch_create
64}
65
66cleanup()
67{
68 pre_cleanup
69
70 switch_destroy
71
72 h2_destroy
73 h1_destroy
74
75 vrf_cleanup
76}
77
78trap cleanup EXIT
79
80setup_prepare
81setup_wait
82
83ping_test $h1 192.0.2.2
84ping6_test $h1 2001:db8:1::2
85learning_test "br0" $swp1 $h1 $h2
86flood_test $swp2 $h1 $h2
87
88exit $EXIT_STATUS