diff mbox series

[05/10] selftests:mptcp: reduce time to wait for DAD

Message ID 20191116125936.3563275-6-matthieu.baerts@tessares.net
State Accepted, archived
Delegated to: Matthieu Baerts
Headers show
Series selftests: IPv6 by default and time reduction | expand

Commit Message

Matthieu Baerts Nov. 16, 2019, 12:59 p.m. UTC
We can use 'ip addr' to know if everything is setup.

In my test, DAD has already finished when checking the first time.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    to be squashed in "mptcp: add basic kselftest for mptcp"

 .../testing/selftests/net/mptcp/mptcp_connect.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 3274cc1fd145..f413a7f3379c 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -461,9 +461,23 @@  check_mptcp_disabled
 
 check_mptcp_ulp_setsockopt
 
+show_all_ipv6()
+{
+	local ns
+	for ns in "$ns1" "$ns2" "$ns3" "$ns4"; do
+		ip -net "${ns}" -6 addr show scope global
+	done
+}
+
 # Allow DAD to finish
-$ipv6 && sleep 2
+if $ipv6; then
+	for dad in $(seq 20); do
+		show_all_ipv6 | grep -q -e tentative -e temporary || break
+		sleep 0.1
+	done
+fi
 
+echo "INFO: validating network environment with pings"
 for sender in "$ns1" "$ns2" "$ns3" "$ns4";do
 	do_ping "$ns1" $sender 10.0.1.1
 	if $ipv6;then