Skip to contentSkip to conversation

selftests: netfilter: Avoid hanging ipvs.sh

PATCH Applied Phil Sutter 2 participants 4 messages Sep 19, 2024

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 selftests: netfilter: Avoid hanging ipvs.sh

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")
---
 tools/testing/selftests/net/netfilter/ipvs.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/net/netfilter/ipvs.sh +4 -0
index 4ceee9fb3949..59d7aecbd887 100755
@@ -107,6 +107,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
 }
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Phil Sutter

If the client can't reach the server, the latter remains listening forever. Kill it after 3s of waiting.

Applied to nf.git, thanks

#2 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

If the client can't reach the server, the latter remains listening forever. Kill it after 3s of waiting.

Applied to nf.git, thanks

Too fast. One of my test machine has not waitpid, there is no usage of waitpid in other existing selftest scripts?

What am I missing here? :)

author reviewer
#3 lore raw
Quoted 9 lines · Pablo Neira Ayuso
Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

If the client can't reach the server, the latter remains listening forever. Kill it after 3s of waiting.

Applied to nf.git, thanks

Too fast. One of my test machine has not waitpid, there is no usage of waitpid in other existing selftest scripts?

Yeah, I only see "wait" being used in other scripts which is a bash-builtin. I needed waitpid for its timeout option.

Quoted 1 line

What am I missing here? :)

My v2 which uses 'timeout' command as used for the client already. :)

Cheers, Phil