LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH] selftests: netfilter: Avoid hanging ipvs.sh

To: Simon Horman <horms@xxxxxxxxxxxx>
Subject: [PATCH] selftests: netfilter: Avoid hanging ipvs.sh
Cc: Julian Anastasov <ja@xxxxxx>, lvs-devel@xxxxxxxxxxxxxxx
From: Phil Sutter <phil@xxxxxx>
Date: Fri, 13 Oct 2023 22:01:36 +0200
If the client can't reach the server, the latter remains listening
forever. Kill it after 3s of waiting.

Fixes: 867d2190799ab ("selftests: netfilter: add ipvs test script")
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 tools/testing/selftests/netfilter/ipvs.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/netfilter/ipvs.sh 
b/tools/testing/selftests/netfilter/ipvs.sh
index c3b8f90c497e0..bc5bda5c13000 100755
--- a/tools/testing/selftests/netfilter/ipvs.sh
+++ b/tools/testing/selftests/netfilter/ipvs.sh
@@ -124,6 +124,10 @@ client_connect() {
 }
 
 verify_data() {
+       waitpid -t 3 "${server_pid}"
+       if [ $? -eq 3 ]; then
+               kill "${server_pid}"
+       fi
        wait "${server_pid}"
        cmp "$infile" "$outfile" 2>/dev/null
 }
-- 
2.41.0


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] selftests: netfilter: Avoid hanging ipvs.sh, Phil Sutter <=