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.

Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Joe Damato <joe@dama.to>
Reviewed-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260404230103.2719103-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-04-04 16:01:03 -07:00
parent 2ce8a41113
commit e65d8b6f30
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -70,7 +70,7 @@ def _exchg_udp(cfg, port, test_string):
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 @@ def _test_xdp_native_tx(cfg, bpf_info, payload_lens):
# 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}"