Skip to content

Commit 0470860

Browse files
TaeheeYookuba-moo
authored andcommitted
selftests: net: amt: wait longer for connection before sending packets
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: c08e8ba ("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>
1 parent 8215794 commit 0470860

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • tools/testing/selftests/net

tools/testing/selftests/net/amt.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
# +------------------------+
7474
#==============================================================================
7575

76+
source lib.sh
77+
7678
readonly LISTENER=$(mktemp -u listener-XXXXXXXX)
7779
readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX)
7880
readonly RELAY=$(mktemp -u relay-XXXXXXXX)
@@ -246,14 +248,15 @@ test_ipv6_forward()
246248

247249
send_mcast4()
248250
{
249-
sleep 2
251+
sleep 5
252+
wait_local_port_listen ${LISTENER} 4000 udp
250253
ip netns exec "${SOURCE}" bash -c \
251254
'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' &
252255
}
253256

254257
send_mcast6()
255258
{
256-
sleep 2
259+
wait_local_port_listen ${LISTENER} 6000 udp
257260
ip netns exec "${SOURCE}" bash -c \
258261
'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' &
259262
}

0 commit comments

Comments
 (0)