Lines Matching +full:remote +full:- +full:pid

2 # SPDX-License-Identifier: GPL-2.0
7 # There are four network-namespaces, LISTENER, SOURCE, GATEWAY, RELAY.
15 # +------------------------+
18 # | +------------------+ |
22 # | +------------------+ |
24 # +------------------------+
27 # +-----------------------------------------------------+
30 # |+---------------------------------------------------+|
32 # || +------------------+ +------------------+ ||
34 # || | 192.168.0.1/24 | +--------+---------+ ||
36 # || +------------------+ | ||
37 # |+-------------------------------------|-------------+|
39 # | +--------+---------+ |
42 # | +------------------+ |
44 # +-----------------------------------------------------+
47 # +-----------------------------------------------------+
49 # | +------------------+ |
52 # | +--------+---------+ |
55 # | +------------------+ +--------+---------+ |
57 # | | 172.17.0.1/24 | +------------------+ |
59 # | +------------------+ |
62 # +-----------------------------------------------------+
65 # +------------------------+
67 # | +------------------+ |
71 # | +------------------+ |
73 # +------------------------+
76 readonly LISTENER=$(mktemp -u listener-XXXXXXXX)
77 readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX)
78 readonly RELAY=$(mktemp -u relay-XXXXXXXX)
79 readonly SOURCE=$(mktemp -u source-XXXXXXXX)
80 readonly SMCROUTEDIR="$(mktemp -d)"
89 if [ -f "$SMCROUTEDIR/amt.pid" ]; then
90 smcpid=$(< $SMCROUTEDIR/amt.pid)
93 rm -rf $SMCROUTEDIR
117 ip -netns "${ns}" link set dev lo up
163 ip netns exec "${RELAY}" sysctl net.ipv4.ip_forward=1 -w -q
168 ip netns exec "${RELAY}" iptables -t mangle -I PREROUTING \
169 -d 239.0.0.1 -j TTL --ttl-set 2
170 ip netns exec "${RELAY}" ip6tables -t mangle -I PREROUTING \
171 -j HL --hl-set 2
176 ip netns exec "${RELAY}" smcrouted -P $SMCROUTEDIR/amt.pid
185 REMOTE=$(ip netns exec "${GATEWAY}" \
186 ip -d -j link show amtg | jq .[0].linkinfo.info_data.remote)
187 if [ $REMOTE == "\"10.0.0.2\"" ]; then
188 printf "TEST: %-60s [ OK ]\n" "amt discovery"
190 printf "TEST: %-60s [FAIL]\n" "amt discovery"
197 ip netns exec "${SOURCE}" bash -c \
198 'cat /dev/urandom | head -c 1G | nc -w 1 -u 239.0.0.1 4001'
204 ip netns exec "${SOURCE}" bash -c \
205 'cat /dev/urandom | head -c 1G | nc -w 1 -u ff0e::5:6 6001'
210 ip link help 2>&1 | grep -q amt
211 if [ $? -ne 0 ]; then
219 RESULT4=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP4-LISTEN:4000,readbytes=128 || true)
220 if echo "$RESULT4" | grep -q "172.17.0.2"; then
221 printf "TEST: %-60s [ OK ]\n" "IPv4 amt multicast forwarding"
224 printf "TEST: %-60s [FAIL]\n" "IPv4 amt multicast forwarding"
231 RESULT6=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP6-LISTEN:6000,readbytes=128 || true)
232 if echo "$RESULT6" | grep -q "2001:db8:3::2"; then
233 printf "TEST: %-60s [ OK ]\n" "IPv6 amt multicast forwarding"
236 printf "TEST: %-60s [FAIL]\n" "IPv6 amt multicast forwarding"
244 ip netns exec "${SOURCE}" bash -c \
245 'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' &
251 ip netns exec "${SOURCE}" bash -c \
252 'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' &
259 set -e
268 pid=$!
270 wait $pid || err=$?
271 if [ $err -eq 1 ]; then
275 pid=$!
277 wait $pid || err=$?
278 if [ $err -eq 1 ]; then
282 printf "TEST: %-60s [ OK ]\n" "IPv4 amt traffic forwarding torture"
284 printf "TEST: %-60s [ OK ]\n" "IPv6 amt traffic forwarding torture"
286 if [ "${ERR}" -eq 1 ]; then