Skip to content
Commit 1d01d0f4 authored by Alessandro Carminati (Red Hat)'s avatar Alessandro Carminati (Red Hat) Committed by Greg Kroah-Hartman
Browse files

selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh



[ Upstream commit f803bcf9 ]

In some systems, the netcat server can incur in delay to start listening.
When this happens, the test can randomly fail in various points.
This is an example error message:

   # ip gre none gso
   # encap 192.168.1.1 to 192.168.1.2, type gre, mac none len 2000
   # test basic connectivity
   # Ncat: Connection refused.

The issue stems from a race condition between the netcat client and server.
The test author had addressed this problem by implementing a sleep, which
I have removed in this patch.
This patch introduces a function capable of sleeping for up to two seconds.
However, it can terminate the waiting period early if the port is reported
to be listening.

Signed-off-by: default avatarAlessandro Carminati (Red Hat) <alessandro.carminati@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240314105911.213411-1-alessandro.carminati@gmail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 075fc5d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment