Skip to content

Commit ba24001

Browse files
Dwyane-Yankuba-moo
authored andcommitted
selftests: mptcp: add a test for mptcp_diag_dump_one
This patch introduces a new 'chk_diag' test in diag.sh. It retrieves the token for a specified MPTCP socket (msk) using the 'ss' command and then accesses the 'mptcp_diag_dump_one' in kernel via ./mptcp_diag to verify if the correct token is returned. Link: multipath-tcp/mptcp_net-next#524 Signed-off-by: Gang Yan <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/20250228-net-next-mptcp-coverage-small-opti-v1-2-f933c4275676@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 00f5e33 commit ba24001

File tree

1 file changed

+27
-0
lines changed
  • tools/testing/selftests/net/mptcp

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,32 @@ chk_msk_cestab()
200200
"${expected}" "${msg}" ""
201201
}
202202

203+
chk_dump_one()
204+
{
205+
local ss_token
206+
local token
207+
local msg
208+
209+
ss_token="$(ss -inmHMN $ns | grep 'token:' |\
210+
head -n 1 |\
211+
sed 's/.*token:\([0-9a-f]*\).*/\1/')"
212+
213+
token="$(ip netns exec $ns ./mptcp_diag -t $ss_token |\
214+
awk -F':[ \t]+' '/^token/ {print $2}')"
215+
216+
msg="....chk dump_one"
217+
218+
mptcp_lib_print_title "$msg"
219+
if [ -n "$ss_token" ] && [ "$ss_token" = "$token" ]; then
220+
mptcp_lib_pr_ok
221+
mptcp_lib_result_pass "${msg}"
222+
else
223+
mptcp_lib_pr_fail "expected $ss_token found $token"
224+
mptcp_lib_result_fail "${msg}"
225+
ret=${KSFT_FAIL}
226+
fi
227+
}
228+
203229
msk_info_get_value()
204230
{
205231
local port="${1}"
@@ -290,6 +316,7 @@ chk_msk_remote_key_nr 2 "....chk remote_key"
290316
chk_msk_fallback_nr 0 "....chk no fallback"
291317
chk_msk_inuse 2
292318
chk_msk_cestab 2
319+
chk_dump_one
293320
flush_pids
294321

295322
chk_msk_inuse 0 "2->0"

0 commit comments

Comments
 (0)