From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v3] mptcp: use GENL_REQ_ATTR_CHECK for token
Date: Mon, 16 Dec 2024 12:24:40 +0100 [thread overview]
Message-ID: <93b46bed-cc91-46bc-9cc3-fff79cb3dac9@kernel.org> (raw)
In-Reply-To: <d9c76c6c008c770046f665a4a4e93735fd121399.1734337790.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 16/12/2024 09:31, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> A more general way to check if MPTCP_PM_ATTR_TOKEN exists in 'info'
> is to use GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_TOKEN) instead of
> directly reading info->attrs[MPTCP_PM_ATTR_TOKEN] and then checking
> if it's NULL.
>
> So this patch uses GENL_REQ_ATTR_CHECK() for 'token' in 'info' in
> mptcp_userspace_pm_get_sock().
>
> 'Suggested-by: Jakub Kicinski <kuba@kernel.org>'
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> v3:
> - use GENL_REQ_ATTR_CHECK in mptcp_userspace_pm_get_sock only
> - drop GENL_SET_ERR_MSG as Matt suggested (thanks)
Thank you for the v3. While at it, do you want to do a similar change
everywhere we do:
struct nlattr *X = info->attrs[MPTCP_PM_ATTR_Y]:
if (!X) {
GENL_SET_ERR_MSG(info, "missing ...");
return Z;
}
e.g. in mptcp_pm_nl_announce_doit() (addr), mptcp_pm_nl_remove_doit()
(id), mptcp_pm_nl_subflow_create_doit() (raddr, laddr),
mptcp_pm_nl_subflow_destroy_doit() (raddr, laddr).
(and maybe mptcp_pm_parse_pm_addr_attr(), but it needs more changes
around to pass the attribute ID, probably best not to change that)
Also, do you know if 'pm_nl_ctl' will continue to indicate a helpful
message if such attribute is missing (that's a message more for
userspace app dev)? Or does it need to be modified to display the
missing argument set by GENL_REQ_ATTR_CHECK()?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-12-16 11:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 8:31 [PATCH mptcp-next v3] mptcp: use GENL_REQ_ATTR_CHECK for token Geliang Tang
2024-12-16 9:29 ` MPTCP CI
2024-12-16 11:24 ` Matthieu Baerts [this message]
2024-12-20 9:50 ` Geliang Tang
2024-12-21 10:39 ` 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=93b46bed-cc91-46bc-9cc3-fff79cb3dac9@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@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