- sdiag_protocol: avoid compilation warning:
mptcp_diag.c: In function 'send_query':
mptcp_diag.c:77:43: warning: unsigned conversion from 'int' to 'unsigned char' changes value from '262' to '6' [-Woverflow]
77 | .sdiag_protocol = IPPROTO_MPTCP,
| ^~~~~~~~~~~~~
=> the real protocol is passed via INET_DIAG_REQ_PROTOCOL.
- printf: follow the same format as ss: hexa only for the token + flags.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Cc: Gang Yan <yangang@kylinos.cn>
---
tools/testing/selftests/net/mptcp/mptcp_diag.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
index 7915ef1fc0611654e0aba36c4121bef2e0f26697..284286c524cfeff5f49b0af1a4da5a376c9e3140 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
@@ -74,7 +74,8 @@ static void send_query(int fd, __u32 token)
},
.r = {
.sdiag_family = AF_INET,
- .sdiag_protocol = IPPROTO_MPTCP,
+ /* Real proto is set via INET_DIAG_REQ_PROTOCOL */
+ .sdiag_protocol = IPPROTO_TCP,
.id.idiag_cookie[0] = token,
}
};
@@ -146,12 +147,12 @@ static void print_info_msg(struct mptcp_info *info)
printf("add_addr_accepted_max: %u\n", info->mptcpi_add_addr_accepted_max);
printf("\nTransmission Info\n");
- printf("write_seq: %llx\n", info->mptcpi_write_seq);
- printf("snd_una: %llx\n", info->mptcpi_snd_una);
- printf("rcv_nxt: %llx\n", info->mptcpi_rcv_nxt);
- printf("last_data_sent: %x\n", info->mptcpi_last_data_sent);
- printf("last_data_recv: %x\n", info->mptcpi_last_data_recv);
- printf("last_ack_recv: %x\n", info->mptcpi_last_ack_recv);
+ printf("write_seq: %llu\n", info->mptcpi_write_seq);
+ printf("snd_una: %llu\n", info->mptcpi_snd_una);
+ printf("rcv_nxt: %llu\n", info->mptcpi_rcv_nxt);
+ printf("last_data_sent: %u\n", info->mptcpi_last_data_sent);
+ printf("last_data_recv: %u\n", info->mptcpi_last_data_recv);
+ printf("last_ack_recv: %u\n", info->mptcpi_last_ack_recv);
printf("retransmits: %u\n", info->mptcpi_retransmits);
printf("retransmit bytes: %llu\n", info->mptcpi_bytes_retrans);
printf("bytes_sent: %llu\n", info->mptcpi_bytes_sent);
---
base-commit: 3716d837622ee1baf6fbe7e6a6a7a3df116e75fe
change-id: 20250224-mptcp-sft-diag-squash-859ea35654a0
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
On Tus, Feb 25, 2025 at 09:51:93AM +0800, Gang Yan wrote:
> On Mon, Feb 24, 2025 at 08:03:05PM +0100, Matthieu Baerts (NGI0) wrote:
> - sdiag_protocol: avoid compilation warning:
>
> mptcp_diag.c: In function 'send_query':
> mptcp_diag.c:77:43: warning: unsigned conversion from 'int' to 'unsigned char' changes value from '262' to '6' [-Woverflow]
> 77 | .sdiag_protocol = IPPROTO_MPTCP,
> | ^~~~~~~~~~~~~
>
> => the real protocol is passed via INET_DIAG_REQ_PROTOCOL.
Thank you for making the modification here. I'm sorry I overlooked this
point when submitting the patch.
>
> - printf: follow the same format as ss: hexa only for the token + flags.
>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Tested-by: Gang Yan <yangang@kylinos.cn>
> ---
> Cc: Gang Yan <yangang@kylinos.cn>
> ---
> tools/testing/selftests/net/mptcp/mptcp_diag.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> index 7915ef1fc0611654e0aba36c4121bef2e0f26697..284286c524cfeff5f49b0af1a4da5a376c9e3140 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> @@ -74,7 +74,8 @@ static void send_query(int fd, __u32 token)
> },
> .r = {
> .sdiag_family = AF_INET,
> - .sdiag_protocol = IPPROTO_MPTCP,
> + /* Real proto is set via INET_DIAG_REQ_PROTOCOL */
> + .sdiag_protocol = IPPROTO_TCP,
> .id.idiag_cookie[0] = token,
> }
> };
> @@ -146,12 +147,12 @@ static void print_info_msg(struct mptcp_info *info)
> printf("add_addr_accepted_max: %u\n", info->mptcpi_add_addr_accepted_max);
>
> printf("\nTransmission Info\n");
> - printf("write_seq: %llx\n", info->mptcpi_write_seq);
> - printf("snd_una: %llx\n", info->mptcpi_snd_una);
> - printf("rcv_nxt: %llx\n", info->mptcpi_rcv_nxt);
> - printf("last_data_sent: %x\n", info->mptcpi_last_data_sent);
> - printf("last_data_recv: %x\n", info->mptcpi_last_data_recv);
> - printf("last_ack_recv: %x\n", info->mptcpi_last_ack_recv);
> + printf("write_seq: %llu\n", info->mptcpi_write_seq);
> + printf("snd_una: %llu\n", info->mptcpi_snd_una);
> + printf("rcv_nxt: %llu\n", info->mptcpi_rcv_nxt);
Judging from the output of the ss command, the three fields 'write_seq',
'snd_una', and 'rcv_nxt' are displayed in hexadecimal format.
But after checking, my 'ss' version is too old (6.1.0). So LGTM.
Thanks for this patch again.
> + printf("last_data_sent: %u\n", info->mptcpi_last_data_sent);
> + printf("last_data_recv: %u\n", info->mptcpi_last_data_recv);
> + printf("last_ack_recv: %u\n", info->mptcpi_last_ack_recv);
> printf("retransmits: %u\n", info->mptcpi_retransmits);
> printf("retransmit bytes: %llu\n", info->mptcpi_bytes_retrans);
> printf("bytes_sent: %llu\n", info->mptcpi_bytes_sent);
>
> ---
> base-commit: 3716d837622ee1baf6fbe7e6a6a7a3df116e75fe
> change-id: 20250224-mptcp-sft-diag-squash-859ea35654a0
>
> Best regards,
> --
> Matthieu Baerts (NGI0) <matttbe@kernel.org>
>
>
Best regards,
Gang Yan <yangang@kylinos.cn>
Hi Gang Yan, On 25/02/2025 05:43, Gang Yan wrote: > On Tus, Feb 25, 2025 at 09:51:93AM +0800, Gang Yan wrote: >> On Mon, Feb 24, 2025 at 08:03:05PM +0100, Matthieu Baerts (NGI0) wrote: >> - sdiag_protocol: avoid compilation warning: >> >> mptcp_diag.c: In function 'send_query': >> mptcp_diag.c:77:43: warning: unsigned conversion from 'int' to 'unsigned char' changes value from '262' to '6' [-Woverflow] >> 77 | .sdiag_protocol = IPPROTO_MPTCP, >> | ^~~~~~~~~~~~~ >> >> => the real protocol is passed via INET_DIAG_REQ_PROTOCOL. > Thank you for making the modification here. I'm sorry I overlooked this > point when submitting the patch. >> >> - printf: follow the same format as ss: hexa only for the token + flags. >> >> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> > Tested-by: Gang Yan <yangang@kylinos.cn> No problem, thank you for having checked! New patches for t/upstream: - 699dad3cb771: Squash to "selftests: mptcp: add a test for mptcp_diag_dump_one" - Results: 3635c12a532c..16bc369672e8 (export) Tests are now in progress: - export: https://github.com/multipath-tcp/mptcp_net-next/commit/e4a8ba485b99c5eaed76adfadfbd6b4fda26bbac/checks Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matthieu,
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/13505946352
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/11387f67c0cd
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=937226
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)
© 2016 - 2026 Red Hat, Inc.