From: Matthieu Baerts <matttbe@kernel.org>
To: Gang Yan <yangang@kylinos.cn>, mptcp@lists.linux.dev
Cc: Geliang Tang <geliang@kernel.org>
Subject: Re: [PATCH mptcp-next v3 2/5] selftests: mptcp: refactor send_query parameters for code clarity
Date: Tue, 29 Apr 2025 15:00:29 +0200 [thread overview]
Message-ID: <55d856bb-b924-42ec-a076-d4ed489208d5@kernel.org> (raw)
In-Reply-To: <d96128e4ea99b661656cb2546b217ecdb8695ffc.1745395366.git.yangang@kylinos.cn>
Hi Gang,
On 25/04/2025 08:18, Gang Yan wrote:
> This patch use 'inet_diag_req_v2' instead of 'token' as parameters of
> send_query, and construct the req in 'get_mptcpinfo'. This modification
> can enhance the enhancing clarity of the code, and prepare for the
> dump_subflow_info.
>
> Co-developed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
> .../testing/selftests/net/mptcp/mptcp_diag.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> index ea7cb1128044..c9533883149b 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
(...
> @@ -229,13 +223,20 @@ static void recv_nlmsg(int fd)
>
> static void get_mptcpinfo(__u32 token)
> {
> + struct inet_diag_req_v2 r = {
> + .sdiag_family = AF_INET,
> + /* Real proto is set via INET_DIAG_REQ_PROTOCOL */
> + .sdiag_protocol = IPPROTO_TCP,
> + .idiag_ext = 1 << (INET_DIAG_INFO - 1),
detail: I guess you might want to keep all the equals aligned, no?
> + .id.idiag_cookie[0] = token,
> + };
> int fd;
>
> fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG);
> if (fd < 0)
> die_perror("Netlink socket");
>
> - send_query(fd, token);
> + send_query(fd, &r);
> recv_nlmsg(fd);
>
> close(fd);
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-04-29 13:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 6:18 [PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests Gang Yan
2025-04-25 6:18 ` [PATCH mptcp-next v3 1/5] selftests: mptcp: add struct params in mptcp_diag Gang Yan
2025-04-25 6:18 ` [PATCH mptcp-next v3 2/5] selftests: mptcp: refactor send_query parameters for code clarity Gang Yan
2025-04-29 13:00 ` Matthieu Baerts [this message]
2025-04-25 6:18 ` [PATCH mptcp-next v3 3/5] selftests: mptcp: refactor NLMSG handling with 'proto' Gang Yan
2025-04-25 6:18 ` [PATCH mptcp-next v3 4/5] selftests: mptcp: add helpers to get subflow_info Gang Yan
2025-04-29 13:05 ` Matthieu Baerts
2025-04-25 6:18 ` [PATCH mptcp-next v3 5/5] selftests: mptcp: add chk_sublfow in diag.sh Gang Yan
2025-04-29 13:05 ` Matthieu Baerts
2025-04-25 12:55 ` [PATCH mptcp-next v3 0/5] Add 'dump_subflow' test in selftests MPTCP CI
2025-04-29 13:00 ` Matthieu Baerts
2025-04-29 13:22 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55d856bb-b924-42ec-a076-d4ed489208d5@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=yangang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox