Hi Gang,
On 25/04/2025 08:18, Gang Yan wrote:
> 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: https://github.com/multipath-tcp/mptcp_net-next/issues/524
>
There should not be any empty lines here: "Closes:" should be with the
other tags without any empty lines in between.
> Co-developed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
> tools/testing/selftests/net/mptcp/diag.sh | 33 +++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
> index e7a75341f0f3..621b405e519f 100755
> --- a/tools/testing/selftests/net/mptcp/diag.sh
> +++ b/tools/testing/selftests/net/mptcp/diag.sh
> @@ -225,6 +225,38 @@ chk_dump_one()
> fi
> }
>
> +chk_dump_subflow()
> +{
> + local inet_diag_token
> + local subflow_line
> + local ss_output
> + local ss_token
> + local msg
> +
> + ss_output=$(ss -tniN $ns)
> +
> + subflow_line=$(echo "$ss_output" | \
> + grep -m1 -Eo '[0-9.]+:[0-9].+ +[0-9.]+:[0-9.]+')
> +
> + ss_token=$(echo "$ss_output" | \
> + grep -m1 -Eo 'token:[^ ]+')
(This could go to the previous line)
> +
> + inet_diag_token=$(ip netns exec $ns ./mptcp_diag -s "$subflow_line" | \
> + grep -Eo 'token:[^ ]+')
> +
> + msg="....chk dump_subflow"
> +
> + mptcp_lib_print_title "$msg"
> + if [ -n "$ss_token" ] && [ "$ss_token" == "$inet_diag_token" ]; then
> + mptcp_lib_pr_ok
> + mptcp_lib_result_pass "${msg}"
> + else
> + mptcp_lib_pr_fail "expected $ss_token found $inet_diag_token"
> + mptcp_lib_result_fail "${msg}"
> + ret=${KSFT_FAIL}
> + fi
> +}
> +
> msk_info_get_value()
> {
> local port="${1}"
> @@ -316,6 +348,7 @@ chk_msk_fallback_nr 0 "....chk no fallback"
> chk_msk_inuse 2
> chk_msk_cestab 2
> chk_dump_one
> +chk_dump_subflow
> flush_pids
>
> chk_msk_inuse 0 "2->0"
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.