Lines Matching +full:local +full:- +full:host
2 # SPDX-License-Identifier: GPL-2.0
5 # Validate a different # exception is generated in h0 for each remote host.
9 # h0 - r1 - h2
25 local rc=$1
26 local expected=$2
27 local msg="$3"
29 if [ ${rc} -eq ${expected} ]; then
30 printf "TEST: %-60s [ OK ]\n" "${msg}"
35 printf "TEST: %-60s [FAIL]\n" "${msg}"
49 local cmd="$*"
50 local out
51 local rc
59 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
73 local ns=${1}
78 ip -netns ${ns} addr add 127.0.0.1/8 dev lo
79 ip -netns ${ns} link set lo up
81 ip netns exec ${ns} sysctl -q -w net.ipv6.conf.all.keep_addr_on_down=1
84 ip netns exec $ns sysctl -q -w net.ipv6.conf.all.forwarding=0
87 ip netns exec $ns sysctl -q -w net.ipv4.ip_forward=1
88 ip netns exec $ns sysctl -q -w net.ipv6.conf.all.forwarding=1
95 local ns
96 local i
98 #set -e
111 ip -netns h${i} li add eth0 type veth peer name r1h${i}
112 ip -netns h${i} li set eth0 up
113 ip -netns h${i} li set r1h${i} netns r1 name eth${i} up
115 ip -netns h${i} addr add dev eth0 172.16.10${i}.1/24
116 ip -netns h${i} -6 addr add dev eth0 2001:db8:10${i}::1/64
117 ip -netns r1 addr add dev eth${i} 172.16.10${i}.254/24
118 ip -netns r1 -6 addr add dev eth${i} 2001:db8:10${i}::64/64
121 ip -netns h0 nexthop add id 4 via 172.16.100.254 dev eth0
122 ip -netns h0 nexthop add id 6 via 2001:db8:100::64 dev eth0
124 # routing from h0 to h1-h3 and back
127 ip -netns h0 ro add 172.16.10${i}.0/24 nhid 4
128 ip -netns h${i} ro add 172.16.100.0/24 via 172.16.10${i}.254
130 ip -netns h0 -6 ro add 2001:db8:10${i}::/64 nhid 6
131 ip -netns h${i} -6 ro add 2001:db8:100::/64 via 2001:db8:10${i}::64
136 echo "host 1 config"
137 ip -netns h0 li sh
138 ip -netns h0 ro sh
139 ip -netns h0 -6 ro sh
155 local hostid=$1
156 local mtu=$2
158 run_cmd ip -netns h${hostid} li set eth0 mtu ${mtu}
159 run_cmd ip -netns r1 li set eth${hostid} mtu ${mtu}
167 local i=$1
168 local mtu=$2
169 local ping_sz=$3
170 local dst="172.16.10${i}.1"
171 local h0=172.16.100.1
172 local r1=172.16.100.254
173 local rc
176 run_cmd ip netns exec h0 ping -s ${ping_sz} -c5 -w5 ${dst}
181 ip -netns h0 ro get ${dst}
187 ip -netns h0 ro get ${dst} | \
188 grep -q "cache .* mtu ${mtu}"
191 log_test $rc 0 "IPv4: host 0 to host ${i}, mtu ${mtu}"
196 local i=$1
197 local mtu=$2
198 local ping_sz=$3
199 local dst="2001:db8:10${i}::1"
200 local h0=2001:db8:100::1
201 local r1=2001:db8:100::64
202 local rc
205 run_cmd ip netns exec h0 ${ping6} -s ${ping_sz} -c5 -w5 ${dst}
210 ip -netns h0 -6 ro get ${dst}
216 ip -netns h0 -6 ro get ${dst} | \
217 grep -q "${dst} from :: via ${r1} dev eth0 src ${h0} .* mtu ${mtu}"
220 log_test $rc 0 "IPv6: host 0 to host ${i}, mtu ${mtu}"
239 cpus="$(seq ${cpus/-/ })"
243 # generate a cached route per-cpu
245 run_cmd taskset -c ${c} ip netns exec h0 ping -c1 -w1 172.16.10${i}.1
246 [ $? -ne 0 ] && printf "\nERROR: ping to h${i} failed\n" && ret=1
248 run_cmd taskset -c ${c} ip netns exec h0 ${ping6} -c1 -w1 2001:db8:10${i}::1
249 [ $? -ne 0 ] && printf "\nERROR: ping6 to h${i} failed\n" && ret=1
251 [ $ret -ne 0 ] && break
253 [ $ret -ne 0 ] && break
256 if [ $ret -eq 0 ]; then
285 ip -netns h0 ro del 172.16.102.0/24 nhid 4
286 ip -netns h0 -6 ro del 2001:db8:102::/64 nhid 6
288 ip -netns h0 nexthop del id 4
289 ip -netns h0 nexthop del id 6