Skip to content

Commit 1b772d9

Browse files
Gang Yanintel-lab-lkp
Gang Yan
authored andcommitted
selftests: mptcp: add chk_sublfow in diag.sh
This patch aims to add chk_dump_subflow in diag.sh. The subflow's info can be obtained through "ss -tin", then use the 'mptcp_diag' to verify the token in subflow_info. Closes: multipath-tcp/mptcp_net-next#524 Co-developed-by: Geliang Tang <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Gang Yan <[email protected]>
1 parent 03ca56b commit 1b772d9

File tree

1 file changed

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

1 file changed

+33
-0
lines changed

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

+33
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,38 @@ chk_dump_one()
225225
fi
226226
}
227227

228+
chk_dump_subflow()
229+
{
230+
local inet_diag_token
231+
local subflow_line
232+
local ss_output
233+
local ss_token
234+
local msg
235+
236+
ss_output=$(ss -tniN $ns)
237+
238+
subflow_line=$(echo "$ss_output" | \
239+
grep -m1 -Eo '[0-9.]+:[0-9].+ +[0-9.]+:[0-9.]+')
240+
241+
ss_token=$(echo "$ss_output" | \
242+
grep -m1 -Eo 'token:[^ ]+')
243+
244+
inet_diag_token=$(ip netns exec $ns ./mptcp_diag -s "$subflow_line" | \
245+
grep -Eo 'token:[^ ]+')
246+
247+
msg="....chk dump_subflow"
248+
249+
mptcp_lib_print_title "$msg"
250+
if [ -n "$ss_token" ] && [ "$ss_token" == "$inet_diag_token" ]; then
251+
mptcp_lib_pr_ok
252+
mptcp_lib_result_pass "${msg}"
253+
else
254+
mptcp_lib_pr_fail "expected $ss_token found $inet_diag_token"
255+
mptcp_lib_result_fail "${msg}"
256+
ret=${KSFT_FAIL}
257+
fi
258+
}
259+
228260
msk_info_get_value()
229261
{
230262
local port="${1}"
@@ -316,6 +348,7 @@ chk_msk_fallback_nr 0 "....chk no fallback"
316348
chk_msk_inuse 2
317349
chk_msk_cestab 2
318350
chk_dump_one
351+
chk_dump_subflow
319352
flush_pids
320353

321354
chk_msk_inuse 0 "2->0"

0 commit comments

Comments
 (0)