From 75b9c0feb0b54b040a8c49f160cfc2defe28c045 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 18 Oct 2024 12:35:51 +1100 Subject: test: Explicitly wait for DAD to complete on SLAAC addresses Getting a SLAAC address takes a little while because the kernel must complete Duplicate Address Detection (DAD) before marking the address as ready. In several places we have an explicit 'sleep 2' to wait for that to complete. Fixed length delays are never a great idea, although this one is pretty solid. Still, it would be better to explicitly wait for DAD to complete in case of long delays (which might happen on slow emulated hosts, or with heavy load), and to speed the tests up if DAD completes quicker. Replace the fixed sleeps with a loop waiting for DAD to complete. We do this by looping waiting for all tentative addresses to disappear. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- test/pasta/ndp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/pasta/ndp') diff --git a/test/pasta/ndp b/test/pasta/ndp index d45ff7b..c59627f 100644 --- a/test/pasta/ndp +++ b/test/pasta/ndp @@ -18,7 +18,8 @@ test Interface name nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname' check [ -n "__IFNAME__" ] ns ip link set dev __IFNAME__ up -sleep 2 +# Wait for DAD to complete +ns while ip -j -6 addr show tentative | jq -e '.[].addr_info'; do sleep 0.1; done test SLAAC: prefix nsout ADDR6 ip -j -6 addr show|jq -rM '[.[] | select(.ifname == "__IFNAME__").addr_info[] | select(.scope == "global" and .prefixlen == 64).local] | .[0]' -- cgit v1.2.3