Lines Matching +full:local +full:- +full:host
2 # SPDX-License-Identifier: GPL-2.0
15 local rc=$1
16 local expected=$2
17 local msg="$3"
19 if [ ${rc} -eq ${expected} ]; then
20 printf "TEST: %-60s [ OK ]\n" "${msg}"
25 printf "TEST: %-60s [FAIL]\n" "${msg}"
37 local ns
38 local cmd
39 local out
40 local rc
52 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
66 local ns=$1
67 local addr=$2
68 local addr6=$3
70 [ -z "${addr}" ] && addr="-"
71 [ -z "${addr6}" ] && addr6="-"
73 if [ "${addr}" != "-" ]; then
76 if [ "${addr6}" != "-" ]; then
77 ip netns exec ${ns} ip -6 addr add dev lo ${addr6}
81 ip netns exec ${ns} ip -6 ro add unreachable default metric 8192
83 ip netns exec ${ns} sysctl -qw net.ipv4.ip_forward=1
84 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1
85 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.forwarding=1
86 ip netns exec ${ns} sysctl -qw net.ipv6.conf.default.forwarding=1
87 ip netns exec ${ns} sysctl -qw net.ipv6.conf.default.accept_dad=0
93 local ns1=$1
94 local ns1_dev=$2
95 local ns1_addr=$3
96 local ns1_addr6=$4
97 local ns2=$5
98 local ns2_dev=$6
99 local ns2_addr=$7
100 local ns2_addr6=$8
107 if [ "${ns1_addr}" != "-" ]; then
111 if [ "${ns2_addr}" != "-" ]; then
115 if [ "${ns1_addr6}" != "-" ]; then
119 if [ "${ns2_addr6}" != "-" ]; then
129 # ------------------------ N2
131 # ------ ------ N3 ----
132 # | R1 | | R2 |------|H2|
133 # ------ ------ ----
135 # ------------------------ N1
137 # ----
139 # ----
151 # R1's host part of address: 1
152 # R2's host part of address: 2
153 # H1's host part of address: 3
154 # H2's host part of address: 4
171 set -e
179 connect_ns $r2 eth3 - 2000:103::2/64 $h2 eth3 - 2000:103::4/64
183 connect_ns $r1 eth2 - 2000:102::1/64 $r2 eth2 - 2000:102::2/64
186 # Setup N1. host-1 and router-2 connect to a bridge in router-1.
191 connect_ns $h1 eth0 - 2000:101::3/64 $r1 eth0 - -
195 connect_ns $r2 eth1 - 2000:101::2/64 $r1 eth1 - -
199 ip netns exec $h1 ping6 -c5 2000:103::4 >/dev/null 2>&1
206 if [ ! -x "$(command -v traceroute6)" ]; then
213 # traceroute6 host-2 from host-1 (expects 2000:102::2)
214 run_cmd $h1 "traceroute6 2000:103::4 | grep -q 2000:102::2"
226 # ---- 1.0.1.3/24 1.0.1.1/24 ---- 1.0.2.1/24 1.0.2.4/24 ----
227 # |H1|--------------------------|R1|--------------------------|H2|
228 # ---- N1 ---- N2 ----
245 set -e
251 connect_ns $h1 eth0 1.0.1.3/24 - \
252 $router eth1 1.0.3.1/24 -
256 ip netns exec $router sysctl -qw \
259 connect_ns $h2 eth0 1.0.2.4/24 - \
260 $router eth2 1.0.2.1/24 -
264 ip netns exec $h1 ping -c5 1.0.2.4 >/dev/null 2>&1
271 if [ ! -x "$(command -v traceroute)" ]; then
278 # traceroute host-2 from host-1 (expects 1.0.1.1). Takes a while.
279 run_cmd $h1 "traceroute 1.0.2.4 | grep -q 1.0.1.1"
297 declare -i nfail=0
298 declare -i nsuccess=0