1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4time_start=$(date +%s)
5
6optstring="S:R:d:e:l:r:h4cm:f:t"
7ret=0
8sin=""
9sout=""
10cin=""
11cout=""
12ksft_skip=4
13capture=false
14timeout=30
15ipv6=true
16ethtool_random_on=true
17tc_delay="$((RANDOM%400))"
18tc_loss=$((RANDOM%101))
19tc_reorder=""
20testmode=""
21sndbuf=0
22rcvbuf=0
23options_log=true
24do_tcp=0
25filesize=0
26
27if [ $tc_loss -eq 100 ];then
28	tc_loss=1%
29elif [ $tc_loss -ge 10 ]; then
30	tc_loss=0.$tc_loss%
31elif [ $tc_loss -ge 1 ]; then
32	tc_loss=0.0$tc_loss%
33else
34	tc_loss=""
35fi
36
37usage() {
38	echo "Usage: $0 [ -a ]"
39	echo -e "\t-d: tc/netem delay in milliseconds, e.g. \"-d 10\" (default random)"
40	echo -e "\t-l: tc/netem loss percentage, e.g. \"-l 0.02\" (default random)"
41	echo -e "\t-r: tc/netem reorder mode, e.g. \"-r 25% 50% gap 5\", use "-r 0" to disable reordering (default random)"
42	echo -e "\t-e: ethtool features to disable, e.g.: \"-e tso -e gso\" (default: randomly disable any of tso/gso/gro)"
43	echo -e "\t-4: IPv4 only: disable IPv6 tests (default: test both IPv4 and IPv6)"
44	echo -e "\t-c: capture packets for each test using tcpdump (default: no capture)"
45	echo -e "\t-f: size of file to transfer in bytes (default random)"
46	echo -e "\t-S: set sndbuf value (default: use kernel default)"
47	echo -e "\t-R: set rcvbuf value (default: use kernel default)"
48	echo -e "\t-m: test mode (poll, sendfile; default: poll)"
49	echo -e "\t-t: also run tests with TCP (use twice to non-fallback tcp)"
50}
51
52while getopts "$optstring" option;do
53	case "$option" in
54	"h")
55		usage $0
56		exit 0
57		;;
58	"d")
59		if [ $OPTARG -ge 0 ];then
60			tc_delay="$OPTARG"
61		else
62			echo "-d requires numeric argument, got \"$OPTARG\"" 1>&2
63			exit 1
64		fi
65		;;
66	"e")
67		ethtool_args="$ethtool_args $OPTARG off"
68		ethtool_random_on=false
69		;;
70	"l")
71		tc_loss="$OPTARG"
72		;;
73	"r")
74		tc_reorder="$OPTARG"
75		;;
76	"4")
77		ipv6=false
78		;;
79	"c")
80		capture=true
81		;;
82	"S")
83		if [ $OPTARG -ge 0 ];then
84			sndbuf="$OPTARG"
85		else
86			echo "-S requires numeric argument, got \"$OPTARG\"" 1>&2
87			exit 1
88		fi
89		;;
90	"R")
91		if [ $OPTARG -ge 0 ];then
92			rcvbuf="$OPTARG"
93		else
94			echo "-R requires numeric argument, got \"$OPTARG\"" 1>&2
95			exit 1
96		fi
97		;;
98	"m")
99		testmode="$OPTARG"
100		;;
101	"f")
102		filesize="$OPTARG"
103		;;
104	"t")
105		do_tcp=$((do_tcp+1))
106		;;
107	"?")
108		usage $0
109		exit 1
110		;;
111	esac
112done
113
114sec=$(date +%s)
115rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
116ns1="ns1-$rndh"
117ns2="ns2-$rndh"
118ns3="ns3-$rndh"
119ns4="ns4-$rndh"
120
121TEST_COUNT=0
122
123cleanup()
124{
125	rm -f "$cin" "$cout"
126	rm -f "$sin" "$sout"
127	rm -f "$capout"
128
129	local netns
130	for netns in "$ns1" "$ns2" "$ns3" "$ns4";do
131		ip netns del $netns
132	done
133}
134
135ip -Version > /dev/null 2>&1
136if [ $? -ne 0 ];then
137	echo "SKIP: Could not run test without ip tool"
138	exit $ksft_skip
139fi
140
141sin=$(mktemp)
142sout=$(mktemp)
143cin=$(mktemp)
144cout=$(mktemp)
145capout=$(mktemp)
146trap cleanup EXIT
147
148for i in "$ns1" "$ns2" "$ns3" "$ns4";do
149	ip netns add $i || exit $ksft_skip
150	ip -net $i link set lo up
151done
152
153#  "$ns1"              ns2                    ns3                     ns4
154# ns1eth2    ns2eth1   ns2eth3      ns3eth2   ns3eth4       ns4eth3
155#                           - drop 1% ->            reorder 25%
156#                           <- TSO off -
157
158ip link add ns1eth2 netns "$ns1" type veth peer name ns2eth1 netns "$ns2"
159ip link add ns2eth3 netns "$ns2" type veth peer name ns3eth2 netns "$ns3"
160ip link add ns3eth4 netns "$ns3" type veth peer name ns4eth3 netns "$ns4"
161
162ip -net "$ns1" addr add 10.0.1.1/24 dev ns1eth2
163ip -net "$ns1" addr add dead:beef:1::1/64 dev ns1eth2 nodad
164
165ip -net "$ns1" link set ns1eth2 up
166ip -net "$ns1" route add default via 10.0.1.2
167ip -net "$ns1" route add default via dead:beef:1::2
168
169ip -net "$ns2" addr add 10.0.1.2/24 dev ns2eth1
170ip -net "$ns2" addr add dead:beef:1::2/64 dev ns2eth1 nodad
171ip -net "$ns2" link set ns2eth1 up
172
173ip -net "$ns2" addr add 10.0.2.1/24 dev ns2eth3
174ip -net "$ns2" addr add dead:beef:2::1/64 dev ns2eth3 nodad
175ip -net "$ns2" link set ns2eth3 up
176ip -net "$ns2" route add default via 10.0.2.2
177ip -net "$ns2" route add default via dead:beef:2::2
178ip netns exec "$ns2" sysctl -q net.ipv4.ip_forward=1
179ip netns exec "$ns2" sysctl -q net.ipv6.conf.all.forwarding=1
180
181ip -net "$ns3" addr add 10.0.2.2/24 dev ns3eth2
182ip -net "$ns3" addr add dead:beef:2::2/64 dev ns3eth2 nodad
183ip -net "$ns3" link set ns3eth2 up
184
185ip -net "$ns3" addr add 10.0.3.2/24 dev ns3eth4
186ip -net "$ns3" addr add dead:beef:3::2/64 dev ns3eth4 nodad
187ip -net "$ns3" link set ns3eth4 up
188ip -net "$ns3" route add default via 10.0.2.1
189ip -net "$ns3" route add default via dead:beef:2::1
190ip netns exec "$ns3" sysctl -q net.ipv4.ip_forward=1
191ip netns exec "$ns3" sysctl -q net.ipv6.conf.all.forwarding=1
192
193ip -net "$ns4" addr add 10.0.3.1/24 dev ns4eth3
194ip -net "$ns4" addr add dead:beef:3::1/64 dev ns4eth3 nodad
195ip -net "$ns4" link set ns4eth3 up
196ip -net "$ns4" route add default via 10.0.3.2
197ip -net "$ns4" route add default via dead:beef:3::2
198
199# use TCP syn cookies, even if no flooding was detected.
200ip netns exec "$ns2" sysctl -q net.ipv4.tcp_syncookies=2
201
202set_ethtool_flags() {
203	local ns="$1"
204	local dev="$2"
205	local flags="$3"
206
207	ip netns exec $ns ethtool -K $dev $flags 2>/dev/null
208	[ $? -eq 0 ] && echo "INFO: set $ns dev $dev: ethtool -K $flags"
209}
210
211set_random_ethtool_flags() {
212	local flags=""
213	local r=$RANDOM
214
215	local pick1=$((r & 1))
216	local pick2=$((r & 2))
217	local pick3=$((r & 4))
218
219	[ $pick1 -ne 0 ] && flags="tso off"
220	[ $pick2 -ne 0 ] && flags="$flags gso off"
221	[ $pick3 -ne 0 ] && flags="$flags gro off"
222
223	[ -z "$flags" ] && return
224
225	set_ethtool_flags "$1" "$2" "$flags"
226}
227
228if $ethtool_random_on;then
229	set_random_ethtool_flags "$ns3" ns3eth2
230	set_random_ethtool_flags "$ns4" ns4eth3
231else
232	set_ethtool_flags "$ns3" ns3eth2 "$ethtool_args"
233	set_ethtool_flags "$ns4" ns4eth3 "$ethtool_args"
234fi
235
236print_file_err()
237{
238	ls -l "$1" 1>&2
239	echo "Trailing bytes are: "
240	tail -c 27 "$1"
241}
242
243check_transfer()
244{
245	local in=$1
246	local out=$2
247	local what=$3
248
249	cmp "$in" "$out" > /dev/null 2>&1
250	if [ $? -ne 0 ] ;then
251		echo "[ FAIL ] $what does not match (in, out):"
252		print_file_err "$in"
253		print_file_err "$out"
254
255		return 1
256	fi
257
258	return 0
259}
260
261check_mptcp_disabled()
262{
263	local disabled_ns
264	disabled_ns="ns_disabled-$sech-$(mktemp -u XXXXXX)"
265	ip netns add ${disabled_ns} || exit $ksft_skip
266
267	# net.mptcp.enabled should be enabled by default
268	if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
269		echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t[ FAIL ]"
270		ret=1
271		return 1
272	fi
273	ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0
274
275	local err=0
276	LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -t $timeout -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \
277		grep -q "^socket: Protocol not available$" && err=1
278	ip netns delete ${disabled_ns}
279
280	if [ ${err} -eq 0 ]; then
281		echo -e "New MPTCP socket cannot be blocked via sysctl\t\t[ FAIL ]"
282		ret=1
283		return 1
284	fi
285
286	echo -e "New MPTCP socket can be blocked via sysctl\t\t[ OK ]"
287	return 0
288}
289
290check_mptcp_ulp_setsockopt()
291{
292	local t retval
293	t="ns_ulp-$sech-$(mktemp -u XXXXXX)"
294
295	ip netns add ${t} || exit $ksft_skip
296	if ! ip netns exec ${t} ./mptcp_connect -u -p 10000 -s TCP 127.0.0.1 2>&1; then
297		printf "setsockopt(..., TCP_ULP, \"mptcp\", ...) allowed\t[ FAIL ]\n"
298		retval=1
299		ret=$retval
300	else
301		printf "setsockopt(..., TCP_ULP, \"mptcp\", ...) blocked\t[ OK ]\n"
302		retval=0
303	fi
304	ip netns del ${t}
305	return $retval
306}
307
308# $1: IP address
309is_v6()
310{
311	[ -z "${1##*:*}" ]
312}
313
314do_ping()
315{
316	local listener_ns="$1"
317	local connector_ns="$2"
318	local connect_addr="$3"
319	local ping_args="-q -c 1"
320
321	if is_v6 "${connect_addr}"; then
322		$ipv6 || return 0
323		ping_args="${ping_args} -6"
324	fi
325
326	ip netns exec ${connector_ns} ping ${ping_args} $connect_addr >/dev/null
327	if [ $? -ne 0 ] ; then
328		echo "$listener_ns -> $connect_addr connectivity [ FAIL ]" 1>&2
329		ret=1
330
331		return 1
332	fi
333
334	return 0
335}
336
337# $1: ns, $2: port
338wait_local_port_listen()
339{
340	local listener_ns="${1}"
341	local port="${2}"
342
343	local port_hex i
344
345	port_hex="$(printf "%04X" "${port}")"
346	for i in $(seq 10); do
347		ip netns exec "${listener_ns}" cat /proc/net/tcp* | \
348			awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" &&
349			break
350		sleep 0.1
351	done
352}
353
354do_transfer()
355{
356	local listener_ns="$1"
357	local connector_ns="$2"
358	local cl_proto="$3"
359	local srv_proto="$4"
360	local connect_addr="$5"
361	local local_addr="$6"
362	local extra_args=""
363
364	local port
365	port=$((10000+$TEST_COUNT))
366	TEST_COUNT=$((TEST_COUNT+1))
367
368	if [ "$rcvbuf" -gt 0 ]; then
369		extra_args="$extra_args -R $rcvbuf"
370	fi
371
372	if [ "$sndbuf" -gt 0 ]; then
373		extra_args="$extra_args -S $sndbuf"
374	fi
375
376	if [ -n "$testmode" ]; then
377		extra_args="$extra_args -m $testmode"
378	fi
379
380	if [ -n "$extra_args" ] && $options_log; then
381		options_log=false
382		echo "INFO: extra options: $extra_args"
383	fi
384
385	:> "$cout"
386	:> "$sout"
387	:> "$capout"
388
389	local addr_port
390	addr_port=$(printf "%s:%d" ${connect_addr} ${port})
391	printf "%.3s %-5s -> %.3s (%-20s) %-5s\t" ${connector_ns} ${cl_proto} ${listener_ns} ${addr_port} ${srv_proto}
392
393	if $capture; then
394		local capuser
395		if [ -z $SUDO_USER ] ; then
396			capuser=""
397		else
398			capuser="-Z $SUDO_USER"
399		fi
400
401		local capfile="${rndh}-${connector_ns:0:3}-${listener_ns:0:3}-${cl_proto}-${srv_proto}-${connect_addr}-${port}"
402		local capopt="-i any -s 65535 -B 32768 ${capuser}"
403
404		ip netns exec ${listener_ns}  tcpdump ${capopt} -w "${capfile}-listener.pcap"  >> "${capout}" 2>&1 &
405		local cappid_listener=$!
406
407		ip netns exec ${connector_ns} tcpdump ${capopt} -w "${capfile}-connector.pcap" >> "${capout}" 2>&1 &
408		local cappid_connector=$!
409
410		sleep 1
411	fi
412
413	local stat_synrx_last_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableSYNRX | while read a count c rest ;do  echo $count;done)
414	local stat_ackrx_last_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableACKRX | while read a count c rest ;do  echo $count;done)
415	local stat_cookietx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesSent | while read a count c rest ;do  echo $count;done)
416	local stat_cookierx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesRecv | while read a count c rest ;do  echo $count;done)
417
418	ip netns exec ${listener_ns} ./mptcp_connect -t $timeout -l -p $port -s ${srv_proto} $extra_args $local_addr < "$sin" > "$sout" &
419	local spid=$!
420
421	wait_local_port_listen "${listener_ns}" "${port}"
422
423	local start
424	start=$(date +%s%3N)
425	ip netns exec ${connector_ns} ./mptcp_connect -t $timeout -p $port -s ${cl_proto} $extra_args $connect_addr < "$cin" > "$cout" &
426	local cpid=$!
427
428	wait $cpid
429	local retc=$?
430	wait $spid
431	local rets=$?
432
433	local stop
434	stop=$(date +%s%3N)
435
436	if $capture; then
437		sleep 1
438		kill ${cappid_listener}
439		kill ${cappid_connector}
440	fi
441
442	local duration
443	duration=$((stop-start))
444	duration=$(printf "(duration %05sms)" $duration)
445	if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
446		echo "$duration [ FAIL ] client exit code $retc, server $rets" 1>&2
447		echo "\nnetns ${listener_ns} socket stat for $port:" 1>&2
448		ip netns exec ${listener_ns} ss -nita 1>&2 -o "sport = :$port"
449		echo "\nnetns ${connector_ns} socket stat for $port:" 1>&2
450		ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port"
451
452		cat "$capout"
453		return 1
454	fi
455
456	check_transfer $sin $cout "file received by client"
457	retc=$?
458	check_transfer $cin $sout "file received by server"
459	rets=$?
460
461	local stat_synrx_now_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableSYNRX  | while read a count c rest ;do  echo $count;done)
462	local stat_ackrx_now_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableACKRX  | while read a count c rest ;do  echo $count;done)
463
464	local stat_cookietx_now=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesSent | while read a count c rest ;do  echo $count;done)
465	local stat_cookierx_now=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesRecv | while read a count c rest ;do  echo $count;done)
466
467	expect_synrx=$((stat_synrx_last_l))
468	expect_ackrx=$((stat_ackrx_last_l))
469
470	cookies=$(ip netns exec ${listener_ns} sysctl net.ipv4.tcp_syncookies)
471	cookies=${cookies##*=}
472
473	if [ ${cl_proto} = "MPTCP" ] && [ ${srv_proto} = "MPTCP" ]; then
474		expect_synrx=$((stat_synrx_last_l+1))
475		expect_ackrx=$((stat_ackrx_last_l+1))
476	fi
477	if [ $cookies -eq 2 ];then
478		if [ $stat_cookietx_last -ge $stat_cookietx_now ] ;then
479			echo "${listener_ns} CookieSent: ${cl_proto} -> ${srv_proto}: did not advance"
480		fi
481		if [ $stat_cookierx_last -ge $stat_cookierx_now ] ;then
482			echo "${listener_ns} CookieRecv: ${cl_proto} -> ${srv_proto}: did not advance"
483		fi
484	else
485		if [ $stat_cookietx_last -ne $stat_cookietx_now ] ;then
486			echo "${listener_ns} CookieSent: ${cl_proto} -> ${srv_proto}: changed"
487		fi
488		if [ $stat_cookierx_last -ne $stat_cookierx_now ] ;then
489			echo "${listener_ns} CookieRecv: ${cl_proto} -> ${srv_proto}: changed"
490		fi
491	fi
492
493	if [ $expect_synrx -ne $stat_synrx_now_l ] ;then
494		echo "${listener_ns} SYNRX: ${cl_proto} -> ${srv_proto}: expect ${expect_synrx}, got ${stat_synrx_now_l}"
495	fi
496	if [ $expect_ackrx -ne $stat_ackrx_now_l ] ;then
497		echo "${listener_ns} ACKRX: ${cl_proto} -> ${srv_proto}: expect ${expect_synrx}, got ${stat_synrx_now_l}"
498	fi
499
500	if [ $retc -eq 0 ] && [ $rets -eq 0 ];then
501		echo "$duration [ OK ]"
502		cat "$capout"
503		return 0
504	fi
505
506	cat "$capout"
507	return 1
508}
509
510make_file()
511{
512	local name=$1
513	local who=$2
514	local SIZE=$filesize
515	local ksize
516	local rem
517
518	if [ $SIZE -eq 0 ]; then
519		local MAXSIZE=$((1024 * 1024 * 8))
520		local MINSIZE=$((1024 * 256))
521
522		SIZE=$(((RANDOM * RANDOM + MINSIZE) % MAXSIZE))
523	fi
524
525	ksize=$((SIZE / 1024))
526	rem=$((SIZE - (ksize * 1024)))
527
528	dd if=/dev/urandom of="$name" bs=1024 count=$ksize 2> /dev/null
529	dd if=/dev/urandom conv=notrunc of="$name" bs=1 count=$rem 2> /dev/null
530	echo -e "\nMPTCP_TEST_FILE_END_MARKER" >> "$name"
531
532	echo "Created $name (size $(du -b "$name")) containing data sent by $who"
533}
534
535run_tests_lo()
536{
537	local listener_ns="$1"
538	local connector_ns="$2"
539	local connect_addr="$3"
540	local loopback="$4"
541	local lret=0
542
543	# skip if test programs are running inside same netns for subsequent runs.
544	if [ $loopback -eq 0 ] && [ ${listener_ns} = ${connector_ns} ]; then
545		return 0
546	fi
547
548	# skip if we don't want v6
549	if ! $ipv6 && is_v6 "${connect_addr}"; then
550		return 0
551	fi
552
553	local local_addr
554	if is_v6 "${connect_addr}"; then
555		local_addr="::"
556	else
557		local_addr="0.0.0.0"
558	fi
559
560	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} ${local_addr}
561	lret=$?
562	if [ $lret -ne 0 ]; then
563		ret=$lret
564		return 1
565	fi
566
567	if [ $do_tcp -eq 0 ]; then
568		# don't bother testing fallback tcp except for loopback case.
569		if [ ${listener_ns} != ${connector_ns} ]; then
570			return 0
571		fi
572	fi
573
574	do_transfer ${listener_ns} ${connector_ns} MPTCP TCP ${connect_addr} ${local_addr}
575	lret=$?
576	if [ $lret -ne 0 ]; then
577		ret=$lret
578		return 1
579	fi
580
581	do_transfer ${listener_ns} ${connector_ns} TCP MPTCP ${connect_addr} ${local_addr}
582	lret=$?
583	if [ $lret -ne 0 ]; then
584		ret=$lret
585		return 1
586	fi
587
588	if [ $do_tcp -gt 1 ] ;then
589		do_transfer ${listener_ns} ${connector_ns} TCP TCP ${connect_addr} ${local_addr}
590		lret=$?
591		if [ $lret -ne 0 ]; then
592			ret=$lret
593			return 1
594		fi
595	fi
596
597	return 0
598}
599
600run_tests()
601{
602	run_tests_lo $1 $2 $3 0
603}
604
605make_file "$cin" "client"
606make_file "$sin" "server"
607
608check_mptcp_disabled
609
610check_mptcp_ulp_setsockopt
611
612echo "INFO: validating network environment with pings"
613for sender in "$ns1" "$ns2" "$ns3" "$ns4";do
614	do_ping "$ns1" $sender 10.0.1.1
615	do_ping "$ns1" $sender dead:beef:1::1
616
617	do_ping "$ns2" $sender 10.0.1.2
618	do_ping "$ns2" $sender dead:beef:1::2
619	do_ping "$ns2" $sender 10.0.2.1
620	do_ping "$ns2" $sender dead:beef:2::1
621
622	do_ping "$ns3" $sender 10.0.2.2
623	do_ping "$ns3" $sender dead:beef:2::2
624	do_ping "$ns3" $sender 10.0.3.2
625	do_ping "$ns3" $sender dead:beef:3::2
626
627	do_ping "$ns4" $sender 10.0.3.1
628	do_ping "$ns4" $sender dead:beef:3::1
629done
630
631[ -n "$tc_loss" ] && tc -net "$ns2" qdisc add dev ns2eth3 root netem loss random $tc_loss
632echo -n "INFO: Using loss of $tc_loss "
633test "$tc_delay" -gt 0 && echo -n "delay $tc_delay ms "
634
635if [ -z "${tc_reorder}" ]; then
636	reorder1=$((RANDOM%10))
637	reorder1=$((100 - reorder1))
638	reorder2=$((RANDOM%100))
639
640	if [ $tc_delay -gt 0 ] && [ $reorder1 -lt 100 ] && [ $reorder2 -gt 0 ]; then
641		tc_reorder="reorder ${reorder1}% ${reorder2}%"
642		echo -n "$tc_reorder "
643	fi
644elif [ "$tc_reorder" = "0" ];then
645	tc_reorder=""
646elif [ "$tc_delay" -gt 0 ];then
647	# reordering requires some delay
648	tc_reorder="reorder $tc_reorder"
649	echo -n "$tc_reorder "
650fi
651
652echo "on ns3eth4"
653
654tc -net "$ns3" qdisc add dev ns3eth4 root netem delay ${tc_delay}ms $tc_reorder
655
656for sender in $ns1 $ns2 $ns3 $ns4;do
657	run_tests_lo "$ns1" "$sender" 10.0.1.1 1
658	if [ $ret -ne 0 ] ;then
659		echo "FAIL: Could not even run loopback test" 1>&2
660		exit $ret
661	fi
662	run_tests_lo "$ns1" $sender dead:beef:1::1 1
663	if [ $ret -ne 0 ] ;then
664		echo "FAIL: Could not even run loopback v6 test" 2>&1
665		exit $ret
666	fi
667
668	run_tests "$ns2" $sender 10.0.1.2
669	run_tests "$ns2" $sender dead:beef:1::2
670	run_tests "$ns2" $sender 10.0.2.1
671	run_tests "$ns2" $sender dead:beef:2::1
672
673	run_tests "$ns3" $sender 10.0.2.2
674	run_tests "$ns3" $sender dead:beef:2::2
675	run_tests "$ns3" $sender 10.0.3.2
676	run_tests "$ns3" $sender dead:beef:3::2
677
678	run_tests "$ns4" $sender 10.0.3.1
679	run_tests "$ns4" $sender dead:beef:3::1
680done
681
682time_end=$(date +%s)
683time_run=$((time_end-time_start))
684
685echo "Time: ${time_run} seconds"
686
687exit $ret
688