Skip to contentSkip to conversation

selftests: drv-net: adjust to socat changes

PATCH Applied Jakub Kicinski 5 participants 5 messages Apr 4 – Apr 8

Subsystems (4)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 selftests: drv-net: adjust to socat changes

socat v1.8.1.0 now defaults to shut-null, it sends an extra 0-length UDP packet when sender disconnects. This breaks our tests which expect the exact packet sequence.

Add shut-none which was the old default where necessary.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 6 +++---
 tools/testing/selftests/drivers/net/xdp.py                | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh +3 -3
index 02dcdeb723be..a9a01a64b7b3 100644
@@ -251,7 +251,7 @@ function listen_port_and_save_to() {
 
 	# Just wait for 3 seconds
 	timeout 3 ip netns exec "${NAMESPACE}" \
-		socat "${SOCAT_MODE}":"${PORT}",fork "${OUTPUT}" 2> /dev/null
+		socat "${SOCAT_MODE}":"${PORT}",fork,shut-none "${OUTPUT}" 2> /dev/null
 }
 
 # Only validate that the message arrived properly
@@ -360,8 +360,8 @@ function check_for_taskset() {
 
 # This is necessary if running multiple tests in a row
 function pkill_socat() {
-	PROCESS_NAME4="socat UDP-LISTEN:6666,fork ${OUTPUT_FILE}"
-	PROCESS_NAME6="socat UDP6-LISTEN:6666,fork ${OUTPUT_FILE}"
+	PROCESS_NAME4="socat UDP-LISTEN:6666,fork,shut-none ${OUTPUT_FILE}"
+	PROCESS_NAME6="socat UDP6-LISTEN:6666,fork,shut-none ${OUTPUT_FILE}"
 	# socat runs under timeout(1), kill it if it is still alive
 	# do not fail if socat doesn't exist anymore
 	set +e
tools/testing/selftests/drivers/net/xdp.py +2 -2
index d86446569f89..7e635487d517 100755
@@ -70,7 +70,7 @@ from lib.py import bpf_map_set, bpf_map_dump, bpf_prog_map_ids
     cfg.require_cmd("socat", remote=True)
 
     rx_udp_cmd = f"socat -{cfg.addr_ipver} -T 2 -u UDP-RECV:{port},reuseport STDOUT"
-    tx_udp_cmd = f"echo -n {test_string} | socat -t 2 -u STDIN UDP:{cfg.baddr}:{port}"
+    tx_udp_cmd = f"echo -n {test_string} | socat -t 2 -u STDIN UDP:{cfg.baddr}:{port},shut-none"
 
     with bkg(rx_udp_cmd, exit_wait=True) as nc:
         wait_port_listen(port, proto="udp")
@@ -271,7 +271,7 @@ from lib.py import bpf_map_set, bpf_map_dump, bpf_prog_map_ids
         # Writing zero bytes to stdin gets ignored by socat,
         # but with the shut-null flag socat generates a zero sized packet
         # when the socket is closed.
-        tx_cmd_suffix = ",shut-null" if payload_len == 0 else ""
+        tx_cmd_suffix = ",shut-null" if payload_len == 0 else ",shut-none"
         tx_udp = f"echo -n {test_string} | socat -t 2 " + \
                  f"-u STDIN UDP:{cfg.baddr}:{port}{tx_cmd_suffix}"
 
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jakub Kicinski

socat v1.8.1.0 now defaults to shut-null, it sends an extra 0-length UDP packet when sender disconnects. This breaks our tests which expect the exact packet sequence.

Add shut-none which was the old default where necessary.

Quoted 8 lines

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jakub Kicinski
Quoted 14 lines · Jakub Kicinski

socat v1.8.1.0 now defaults to shut-null, it sends an extra 0-length UDP packet when sender disconnects. This breaks our tests which expect the exact packet sequence.

Add shut-none which was the old default where necessary.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

Quoted 4 lines
---
 tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh | 6 +++---
 tools/testing/selftests/drivers/net/xdp.py                | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
#4 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 9 lines · On Sat, 4 Apr 2026 16:01:03 -0700 you wrote:

socat v1.8.1.0 now defaults to shut-null, it sends an extra 0-length UDP packet when sender disconnects. This breaks our tests which expect the exact packet sequence.

Add shut-none which was the old default where necessary.

[...]

Here is the summary with links:
- [net-next] selftests: drv-net: adjust to socat changes

    https://git.kernel.org/netdev/net-next/c/e65d8b6f3092

You are awesome, thank you!

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