[PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests

Gang Yan posted 5 patches 7 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/cover.1745395366.git.yangang@kylinos.cn
tools/testing/selftests/net/mptcp/diag.sh     |  33 +++
.../testing/selftests/net/mptcp/mptcp_diag.c  | 228 +++++++++++++++---
2 files changed, 229 insertions(+), 32 deletions(-)
[PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests
Posted by Gang Yan 7 months, 3 weeks ago
The 'subflow_get_info_size' is called only in 'inet_sk_attr_size', and
the only calltrace is that 'tcp_diag_dump_one'->'inet_diag_dump_one_icsk'
->'inet_sk_attr_size'.

So It's necessary to add 'get_subflow_info' in mptcp_diag.c to cover this
function. Given a specific TCP connection, it is possible to judge if
it is a MPTCP subflow by 'INET_ULP_INFO_MPTCP' and print 'subflow_info'.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/524

------
Changelog
  v2:
    - Fix the CI compiling error.
  v3:
    - Set idaig_ext when 'r' is declared.
    - Declare iovlen to 0, and adjust the increment logic.
    - Squash patch 3 into patch 4.
    - Rename 'subflow_addr' to 'subflow_addrs'
    - Remove the comment and declare [ad]ddr on the same line.
    - Set id.idiag_cookie[0/1] when r is declared.
    - Remove the 'id.idiag_if = 0' because the default value is 0.
    - Squash patch 6 into patch 5.
    - Add the example of output in commit message.
    - Adjust the input of 'mptcp_diag -s' to "saddr:sport daddr:dport"
      to save a few lines in diag.sh
    - In diag.sh, use "mptcp_diag -s '$subflow_line'" instead of
      the old version, and call 'ss' only once to ensure the safety.
    - Fix some error/check/warning problems in CI.
    - Put the link of issue into the commit message of patch 5.

Gang Yan (5):
  selftests: mptcp: add struct params in mptcp_diag
  selftests: mptcp: refactor send_query parameters for code clarity
  selftests: mptcp: refactor NLMSG handling with 'proto'
  selftests: mptcp: add helpers to get subflow_info
  selftests: mptcp: add chk_sublfow in diag.sh

 tools/testing/selftests/net/mptcp/diag.sh     |  33 +++
 .../testing/selftests/net/mptcp/mptcp_diag.c  | 228 +++++++++++++++---
 2 files changed, 229 insertions(+), 32 deletions(-)

-- 
2.43.0
Re: [PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests
Posted by MPTCP CI 7 months, 3 weeks ago
Hi Gang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/14663915269

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/0a861e272da4
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=956852


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Re: [PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests
Posted by Matthieu Baerts 7 months, 2 weeks ago
Hi Gang,

On 25/04/2025 08:18, Gang Yan wrote:
> The 'subflow_get_info_size' is called only in 'inet_sk_attr_size', and
> the only calltrace is that 'tcp_diag_dump_one'->'inet_diag_dump_one_icsk'
> ->'inet_sk_attr_size'.
> 
> So It's necessary to add 'get_subflow_info' in mptcp_diag.c to cover this
> function. Given a specific TCP connection, it is possible to judge if
> it is a MPTCP subflow by 'INET_ULP_INFO_MPTCP' and print 'subflow_info'.
> 
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/524
> 
> ------
> Changelog
>   v2:
>     - Fix the CI compiling error.
>   v3:
>     - Set idaig_ext when 'r' is declared.
>     - Declare iovlen to 0, and adjust the increment logic.
>     - Squash patch 3 into patch 4.
>     - Rename 'subflow_addr' to 'subflow_addrs'
>     - Remove the comment and declare [ad]ddr on the same line.
>     - Set id.idiag_cookie[0/1] when r is declared.
>     - Remove the 'id.idiag_if = 0' because the default value is 0.
>     - Squash patch 6 into patch 5.
>     - Add the example of output in commit message.
>     - Adjust the input of 'mptcp_diag -s' to "saddr:sport daddr:dport"
>       to save a few lines in diag.sh
>     - In diag.sh, use "mptcp_diag -s '$subflow_line'" instead of
>       the old version, and call 'ss' only once to ensure the safety.
>     - Fix some error/check/warning problems in CI.
>     - Put the link of issue into the commit message of patch 5.

Thank you for the new version. It looks good to me, just some details
that I can include when applying the patches.

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

> 
> Gang Yan (5):
>   selftests: mptcp: add struct params in mptcp_diag
>   selftests: mptcp: refactor send_query parameters for code clarity
>   selftests: mptcp: refactor NLMSG handling with 'proto'
>   selftests: mptcp: add helpers to get subflow_info
>   selftests: mptcp: add chk_sublfow in diag.sh
> 
>  tools/testing/selftests/net/mptcp/diag.sh     |  33 +++
>  .../testing/selftests/net/mptcp/mptcp_diag.c  | 228 +++++++++++++++---
>  2 files changed, 229 insertions(+), 32 deletions(-)
> 

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests
Posted by Matthieu Baerts 7 months, 2 weeks ago

On 29/04/2025 15:00, Matthieu Baerts wrote:
> Hi Gang,
> 
> On 25/04/2025 08:18, Gang Yan wrote:
>> The 'subflow_get_info_size' is called only in 'inet_sk_attr_size', and
>> the only calltrace is that 'tcp_diag_dump_one'->'inet_diag_dump_one_icsk'
>> ->'inet_sk_attr_size'.
>>
>> So It's necessary to add 'get_subflow_info' in mptcp_diag.c to cover this
>> function. Given a specific TCP connection, it is possible to judge if
>> it is a MPTCP subflow by 'INET_ULP_INFO_MPTCP' and print 'subflow_info'.
>>
>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/524
>>
>> ------
>> Changelog
>>   v2:
>>     - Fix the CI compiling error.
>>   v3:
>>     - Set idaig_ext when 'r' is declared.
>>     - Declare iovlen to 0, and adjust the increment logic.
>>     - Squash patch 3 into patch 4.
>>     - Rename 'subflow_addr' to 'subflow_addrs'
>>     - Remove the comment and declare [ad]ddr on the same line.
>>     - Set id.idiag_cookie[0/1] when r is declared.
>>     - Remove the 'id.idiag_if = 0' because the default value is 0.
>>     - Squash patch 6 into patch 5.
>>     - Add the example of output in commit message.
>>     - Adjust the input of 'mptcp_diag -s' to "saddr:sport daddr:dport"
>>       to save a few lines in diag.sh
>>     - In diag.sh, use "mptcp_diag -s '$subflow_line'" instead of
>>       the old version, and call 'ss' only once to ensure the safety.
>>     - Fix some error/check/warning problems in CI.
>>     - Put the link of issue into the commit message of patch 5.
> 
> Thank you for the new version. It looks good to me, just some details
> that I can include when applying the patches.
> 
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Now in our tree:

New patches for t/upstream:
- f41228c0ba3b: selftests: mptcp: add struct params in mptcp_diag
- c92368e75550: selftests: mptcp: refactor send_query parameters for
code clarity
- c4857ae914a9: selftests: mptcp: refactor NLMSG handling with 'proto'
- 3f3180dba6f5: selftests: mptcp: add helpers to get subflow_info
- c46a1689f413: selftests: mptcp: add chk_sublfow in diag.sh
- Results: 59ef7029a603..e17ea3d6bbc4 (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/563df787b6317c2cd27fad121b1ccdabc8e0372f/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.