Lines Matching +full:local +full:- +full:host

2 # SPDX-License-Identifier: GPL-2.0
14 local rc=$1
15 local expected=$2
16 local msg="$3"
18 if [ ${rc} -eq ${expected} ]; then
19 printf "TEST: %-60s [ OK ]\n" "${msg}"
24 printf "TEST: %-60s [FAIL]\n" "${msg}"
36 local ns
37 local cmd
38 local out
39 local rc
51 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
65 local ns=$1
66 local addr=$2
67 local addr6=$3
69 [ -z "${addr}" ] && addr="-"
70 [ -z "${addr6}" ] && addr6="-"
75 if [ "${addr}" != "-" ]; then
78 if [ "${addr6}" != "-" ]; then
79 ip netns exec ${ns} ip -6 addr add dev lo ${addr6}
83 ip netns exec ${ns} ip -6 ro add unreachable default metric 8192
85 ip netns exec ${ns} sysctl -qw net.ipv4.ip_forward=1
86 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1
87 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.forwarding=1
88 ip netns exec ${ns} sysctl -qw net.ipv6.conf.default.forwarding=1
89 ip netns exec ${ns} sysctl -qw net.ipv6.conf.default.accept_dad=0
95 local ns1=$1
96 local ns1_dev=$2
97 local ns1_addr=$3
98 local ns1_addr6=$4
99 local ns2=$5
100 local ns2_dev=$6
101 local ns2_addr=$7
102 local ns2_addr6=$8
109 if [ "${ns1_addr}" != "-" ]; then
113 if [ "${ns2_addr}" != "-" ]; then
117 if [ "${ns1_addr6}" != "-" ]; then
121 if [ "${ns2_addr6}" != "-" ]; then
131 # ------------------------ N2
133 # ------ ------ N3 ----
134 # | R1 | | R2 |------|H2|
135 # ------ ------ ----
137 # ------------------------ N1
139 # ----
141 # ----
153 # R1's host part of address: 1
154 # R2's host part of address: 2
155 # H1's host part of address: 3
156 # H2's host part of address: 4
163 local ns
165 for ns in host-1 host-2 router-1 router-2
178 set -e
179 create_ns host-1
180 create_ns host-2
181 create_ns router-1
182 create_ns router-2
185 connect_ns router-2 eth3 - 2000:103::2/64 host-2 eth3 - 2000:103::4/64
186 ip netns exec host-2 ip route add default via 2000:103::2
189 connect_ns router-1 eth2 - 2000:102::1/64 router-2 eth2 - 2000:102::2/64
190 ip netns exec router-1 ip route add default via 2000:102::2
192 # Setup N1. host-1 and router-2 connect to a bridge in router-1.
193 ip netns exec router-1 ip link add name ${brdev} type bridge
194 ip netns exec router-1 ip link set ${brdev} up
195 ip netns exec router-1 ip addr add 2000:101::1/64 dev ${brdev}
197 connect_ns host-1 eth0 - 2000:101::3/64 router-1 eth0 - -
198 ip netns exec router-1 ip link set dev eth0 master ${brdev}
199 ip netns exec host-1 ip route add default via 2000:101::1
201 connect_ns router-2 eth1 - 2000:101::2/64 router-1 eth1 - -
202 ip netns exec router-1 ip link set dev eth1 master ${brdev}
205 ip netns exec host-1 ping6 -c5 2000:103::4 >/dev/null 2>&1
212 if [ ! -x "$(command -v traceroute6)" ]; then
219 # traceroute6 host-2 from host-1 (expects 2000:102::2)
220 run_cmd host-1 "traceroute6 2000:103::4 | grep -q 2000:102::2"
232 # ---- 1.0.1.3/24 1.0.1.1/24 ---- 1.0.2.1/24 1.0.2.4/24 ----
233 # |H1|--------------------------|R1|--------------------------|H2|
234 # ---- N1 ---- N2 ----
243 local ns
245 for ns in host-1 host-2 router
256 set -e
257 create_ns host-1
258 create_ns host-2
261 connect_ns host-1 eth0 1.0.1.3/24 - \
262 router eth1 1.0.3.1/24 -
263 ip netns exec host-1 ip route add default via 1.0.1.1
266 ip netns exec router sysctl -qw \
269 connect_ns host-2 eth0 1.0.2.4/24 - \
270 router eth2 1.0.2.1/24 -
271 ip netns exec host-2 ip route add default via 1.0.2.1
274 ip netns exec host-1 ping -c5 1.0.2.4 >/dev/null 2>&1
281 if [ ! -x "$(command -v traceroute)" ]; then
288 # traceroute host-2 from host-1 (expects 1.0.1.1). Takes a while.
289 run_cmd host-1 "traceroute 1.0.2.4 | grep -q 1.0.1.1"
307 declare -i nfail=0
308 declare -i nsuccess=0