Skip to content

Commit ed08076

Browse files
Dwyane-Yanintel-lab-lkp
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. Closes: multipath-tcp/mptcp_net-next#524 Signed-off-by: Gang Yan <[email protected]>
1 parent eb39b19 commit ed08076

File tree

1 file changed

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

1 file changed

+23
-0
lines changed

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

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

203+
chk_dumpone()
204+
{
205+
local ss_token="$(ss -inmHMN $ns | grep 'token:' |\
206+
head -n 1 |\
207+
sed 's/.*token:\([0-9a-f]*\).*/\1/')"
208+
local token="$(ip netns exec $ns ./mptcp_diag -t $ss_token |\
209+
grep 'token:' |\
210+
sed 's/.*token:\([0-9a-f]*\).*/\1/')"
211+
local msg="...chk dumpone"
212+
213+
mptcp_lib_print_title "$msg"
214+
if [ "$ss_token" != "$token" ]; then
215+
mptcp_lib_pr_fail "expected $ss_token found $token"
216+
mptcp_lib_result_fail "${msg}"
217+
ret=${KSFT_FAIL}
218+
else
219+
mptcp_lib_pr_ok
220+
mptcp_lib_result_pass "${msg}"
221+
fi
222+
223+
}
224+
203225
msk_info_get_value()
204226
{
205227
local port="${1}"
@@ -290,6 +312,7 @@ chk_msk_remote_key_nr 2 "....chk remote_key"
290312
chk_msk_fallback_nr 0 "....chk no fallback"
291313
chk_msk_inuse 2
292314
chk_msk_cestab 2
315+
chk_dumpone
293316
flush_pids
294317

295318
chk_msk_inuse 0 "2->0"

0 commit comments

Comments
 (0)