Skip to contentSkip to conversation

selftests: openvswitch: fix tcpdump execution

PATCH Applied Adrian Moreno 3 participants 3 messages Dec 17, 2024 – Dec 19, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: openvswitch: fix tcpdump execution

Fix the way tcpdump is executed by:
- Using the right variable for the namespace. Currently the use of the empty "ns" makes the command fail.
- Waiting until it starts to capture to ensure the interesting traffic is caught on slow systems.
- Using line-buffered output to ensure logs are available when the test is paused with "-p". Otherwise the last chunk of data might only be written when tcpdump is killed.

Fixes 74cc26f416b9 ("selftests: openvswitch: add interface support")
---
 tools/testing/selftests/net/openvswitch/openvswitch.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/net/openvswitch/openvswitch.sh +4 -2
index cc0bfae2bafa..960e1ab4dd04 100755
@@ -171,8 +171,10 @@ ovs_add_netns_and_veths () {
 		ovs_add_if "$1" "$2" "$4" -u || return 1
 	fi
 
-	[ $TRACING -eq 1 ] && ovs_netns_spawn_daemon "$1" "$ns" \
-			tcpdump -i any -s 65535
+	if [ $TRACING -eq 1 ]; then
+		ovs_netns_spawn_daemon "$1" "$3" tcpdump -l -i any -s 6553
+		ovs_wait grep -q "listening on any" ${ovs_dir}/stderr
+	fi
 
 	return 0
 }
Signature · 1 line
2.47.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Adrian Moreno

Fix the way tcpdump is executed by:
- Using the right variable for the namespace. Currently the use of the empty "ns" makes the command fail.
- Waiting until it starts to capture to ensure the interesting traffic is caught on slow systems.
- Using line-buffered output to ensure logs are available when the test is paused with "-p". Otherwise the last chunk of data might only be written when tcpdump is killed.

Fixes 74cc26f416b9 ("selftests: openvswitch: add interface support")

Thank for fixing this, the change looks good to me.

#2 lore raw
In reply to Adrian Moreno
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 17 Dec 2024 22:16:51 +0100 you wrote:

Fix the way tcpdump is executed by:
- Using the right variable for the namespace. Currently the use of the empty "ns" makes the command fail.
- Waiting until it starts to capture to ensure the interesting traffic is caught on slow systems.
- Using line-buffered output to ensure logs are available when the test is paused with "-p". Otherwise the last chunk of data might only be written when tcpdump is killed.

[...]

Here is the summary with links:
- [net] selftests: openvswitch: fix tcpdump execution

    https://git.kernel.org/netdev/net/c/a17975992cc1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html