Skip to content

Commit d0576eb

Browse files
Dwyane-YanPaolo Abeni
authored andcommitted
selftests: mptcp: add a check for sndbuf of S/C
Add a new chk_sndbuf() helper to diag.sh that extracts the sndbuf (the 'tb' field from 'ss -m' skmem output) for both server and client MPTCP sockets, and verifies they are equal. Without the previous patch, it will fail: ''' 07 ....chk sndbuf server/client [FAIL] sndbuf S=20480 != C=2630656 ''' Signed-off-by: Gang Yan <yangang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260420-net-mptcp-sync-sndbuf-accept-v1-2-e3523e3aeb44@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent fcf04b1 commit d0576eb

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

  • tools/testing/selftests/net/mptcp

tools/testing/selftests/net/mptcp/diag.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,33 @@ wait_connected()
322322
done
323323
}
324324

325+
chk_sndbuf()
326+
{
327+
local server_sndbuf client_sndbuf msg
328+
local port=${1}
329+
330+
msg="....chk sndbuf server/client"
331+
server_sndbuf=$(ss -N "${ns}" -inmHM "sport" "${port}" | \
332+
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
333+
client_sndbuf=$(ss -N "${ns}" -inmHM "dport" "${port}" | \
334+
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
335+
336+
mptcp_lib_print_title "${msg}"
337+
if [ -z "${server_sndbuf}" ] || [ -z "${client_sndbuf}" ]; then
338+
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} C=${client_sndbuf}"
339+
mptcp_lib_result_fail "${msg}"
340+
ret=${KSFT_FAIL}
341+
elif [ "${server_sndbuf}" != "${client_sndbuf}" ]; then
342+
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} != C=${client_sndbuf}"
343+
mptcp_lib_result_fail "${msg}"
344+
ret=${KSFT_FAIL}
345+
else
346+
mptcp_lib_pr_ok
347+
mptcp_lib_result_pass "${msg}"
348+
fi
349+
}
350+
351+
325352
trap cleanup EXIT
326353
mptcp_lib_ns_init ns
327354

@@ -341,6 +368,7 @@ echo "b" | \
341368
127.0.0.1 >/dev/null &
342369
wait_connected $ns 10000
343370
chk_msk_nr 2 "after MPC handshake"
371+
chk_sndbuf 10000
344372
chk_last_time_info 10000
345373
chk_msk_remote_key_nr 2 "....chk remote_key"
346374
chk_msk_fallback_nr 0 "....chk no fallback"

0 commit comments

Comments
 (0)