]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests: mptcp: add a check for sndbuf of S/C
authorGang Yan <yangang@kylinos.cn>
Mon, 20 Apr 2026 16:19:24 +0000 (18:19 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 23 Apr 2026 11:20:17 +0000 (13:20 +0200)
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>
tools/testing/selftests/net/mptcp/diag.sh

index d847ff1737c30c0eae1cefeb5a83bd3223897707..27cbda68144e82dbcc604d8bfacbdf161f9e76f2 100755 (executable)
@@ -322,6 +322,33 @@ wait_connected()
        done
 }
 
+chk_sndbuf()
+{
+       local server_sndbuf client_sndbuf msg
+       local port=${1}
+
+       msg="....chk sndbuf server/client"
+       server_sndbuf=$(ss -N "${ns}" -inmHM "sport" "${port}" | \
+                       sed -n 's/.*tb\([0-9]\+\).*/\1/p')
+       client_sndbuf=$(ss -N "${ns}" -inmHM "dport" "${port}" | \
+                       sed -n 's/.*tb\([0-9]\+\).*/\1/p')
+
+       mptcp_lib_print_title "${msg}"
+       if [ -z "${server_sndbuf}" ] || [ -z "${client_sndbuf}" ]; then
+               mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} C=${client_sndbuf}"
+               mptcp_lib_result_fail "${msg}"
+               ret=${KSFT_FAIL}
+       elif [ "${server_sndbuf}" != "${client_sndbuf}" ]; then
+               mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} != C=${client_sndbuf}"
+               mptcp_lib_result_fail "${msg}"
+               ret=${KSFT_FAIL}
+       else
+               mptcp_lib_pr_ok
+               mptcp_lib_result_pass "${msg}"
+       fi
+}
+
+
 trap cleanup EXIT
 mptcp_lib_ns_init ns
 
@@ -341,6 +368,7 @@ echo "b" | \
                                127.0.0.1 >/dev/null &
 wait_connected $ns 10000
 chk_msk_nr 2 "after MPC handshake"
+chk_sndbuf 10000
 chk_last_time_info 10000
 chk_msk_remote_key_nr 2 "....chk remote_key"
 chk_msk_fallback_nr 0 "....chk no fallback"