drm/atomic-helper: document drm_atomic_helper_check() restrictions
[drm/drm-misc.git] / tools / testing / selftests / net / forwarding / router_vid_1.sh
blob865c9f7d81434f6225d3dc9d7479fd38d38fc03a
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # +--------------------+ +----------------------+
5 # | H1 | | H2 |
6 # | | | |
7 # | $h1.1 + | | + $h2.1 |
8 # | 192.0.2.2/24 | | | | 198.51.100.2/24 |
9 # | 2001:db8:1::2/64 | | | | 2001:db8:2::2/64 |
10 # | | | | | |
11 # | $h1 + | | + $h2 |
12 # | | | | | |
13 # +------------------|-+ +-|--------------------+
14 # | |
15 # +------------------|-------------------------|--------------------+
16 # | SW | | |
17 # | | | |
18 # | $rp1 + + $rp2 |
19 # | | | |
20 # | $rp1.1 + + $rp2.1 |
21 # | 192.0.2.1/24 198.51.100.1/24 |
22 # | 2001:db8:1::1/64 2001:db8:2::1/64 |
23 # | |
24 # +-----------------------------------------------------------------+
26 ALL_TESTS="
27 ping_ipv4
28 ping_ipv6
30 NUM_NETIFS=4
31 source lib.sh
33 h1_create()
35 vrf_create "vrf-h1"
36 ip link set dev vrf-h1 up
38 ip link set dev $h1 up
39 vlan_create $h1 1 vrf-h1 192.0.2.2/24 2001:db8:1::2/64
41 ip route add 198.51.100.0/24 vrf vrf-h1 nexthop via 192.0.2.1
42 ip route add 2001:db8:2::/64 vrf vrf-h1 nexthop via 2001:db8:1::1
45 h1_destroy()
47 ip route del 2001:db8:2::/64 vrf vrf-h1
48 ip route del 198.51.100.0/24 vrf vrf-h1
50 vlan_destroy $h1 1
51 ip link set dev $h1 down
53 ip link set dev vrf-h1 down
54 vrf_destroy "vrf-h1"
57 h2_create()
59 vrf_create "vrf-h2"
60 ip link set dev vrf-h2 up
62 ip link set dev $h2 up
63 vlan_create $h2 1 vrf-h2 198.51.100.2/24 2001:db8:2::2/64
65 ip route add 192.0.2.0/24 vrf vrf-h2 nexthop via 198.51.100.1
66 ip route add 2001:db8:1::/64 vrf vrf-h2 nexthop via 2001:db8:2::1
69 h2_destroy()
71 ip route del 2001:db8:1::/64 vrf vrf-h2
72 ip route del 192.0.2.0/24 vrf vrf-h2
74 vlan_destroy $h2 1
75 ip link set dev $h2 down
77 ip link set dev vrf-h2 down
78 vrf_destroy "vrf-h2"
81 router_create()
83 ip link set dev $rp1 up
84 ip link add link $rp1 name $rp1.1 up type vlan id 1
86 ip address add 192.0.2.1/24 dev $rp1.1
87 ip address add 2001:db8:1::1/64 dev $rp1.1
89 ip link set dev $rp2 up
90 ip link add link $rp2 name $rp2.1 up type vlan id 1
92 ip address add 198.51.100.1/24 dev $rp2.1
93 ip address add 2001:db8:2::1/64 dev $rp2.1
96 router_destroy()
98 ip address del 2001:db8:2::1/64 dev $rp2.1
99 ip address del 198.51.100.1/24 dev $rp2.1
101 ip link del dev $rp2.1
102 ip link set dev $rp2 down
104 ip address del 2001:db8:1::1/64 dev $rp1.1
105 ip address del 192.0.2.1/24 dev $rp1.1
107 ip link del dev $rp1.1
108 ip link set dev $rp1 down
111 setup_prepare()
113 h1=${NETIFS[p1]}
114 rp1=${NETIFS[p2]}
116 rp2=${NETIFS[p3]}
117 h2=${NETIFS[p4]}
119 vrf_prepare
121 h1_create
122 h2_create
124 router_create
126 forwarding_enable
129 cleanup()
131 pre_cleanup
133 forwarding_restore
135 router_destroy
137 h2_destroy
138 h1_destroy
140 vrf_cleanup
143 ping_ipv4()
145 ping_test $h1.1 198.51.100.2
148 ping_ipv6()
150 ping6_test $h1.1 2001:db8:2::2
153 trap cleanup EXIT
155 setup_prepare
156 setup_wait
158 tests_run
160 exit $EXIT_STATUS