]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: net: amt: wait longer for connection before sending packets
authorTaehee Yoo <ap420073@gmail.com>
Tue, 20 Jan 2026 13:39:30 +0000 (13:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Jan 2026 03:20:30 +0000 (19:20 -0800)
Both send_mcast4() and send_mcast6() use sleep 2 to wait for the tunnel
connection between the gateway and the relay, and for the listener
socket to be created in the LISTENER namespace.

However, tests sometimes fail because packets are sent before the
connection is fully established.

Increase the waiting time to make the tests more reliable, and use
wait_local_port_listen() to explicitly wait for the listener socket.

Fixes: c08e8baea78e ("selftests: add amt interface selftest script")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://patch.msgid.link/20260120133930.863845-1-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/amt.sh

index 3ef209cacb8ed31f265ff8de9623d7519c0b3ae8..663744305e521913bcaa6f95e7adc654ae3234a0 100755 (executable)
@@ -73,6 +73,8 @@
 #       +------------------------+
 #==============================================================================
 
+source lib.sh
+
 readonly LISTENER=$(mktemp -u listener-XXXXXXXX)
 readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX)
 readonly RELAY=$(mktemp -u relay-XXXXXXXX)
@@ -246,14 +248,15 @@ test_ipv6_forward()
 
 send_mcast4()
 {
-       sleep 2
+       sleep 5
+       wait_local_port_listen ${LISTENER} 4000 udp
        ip netns exec "${SOURCE}" bash -c \
                'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' &
 }
 
 send_mcast6()
 {
-       sleep 2
+       wait_local_port_listen ${LISTENER} 6000 udp
        ip netns exec "${SOURCE}" bash -c \
                'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' &
 }