From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v7 01/11] mptcp: pm: more precise error messages
Date: Mon, 6 Jan 2025 10:17:08 +0100 [thread overview]
Message-ID: <664bedcc-a172-46b6-8c0e-a023477ce98a@kernel.org> (raw)
In-Reply-To: <702733ca36c469e621a3d4e9173eeda587dba85c.1736150983.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 06/01/2025 09:16, Geliang Tang wrote:
> From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
>
> Some errors reported by the userspace PM were vague: "this or that is
> invalid".
>
> It is easier for the userspace to know which part is wrong, instead of
> having to guess that.
>
> By splitting some error messages, NL_SET_ERR_MSG_ATTR() can be used
> instead of GENL_SET_ERR_MSG() in order to give an additional hint to the
> userspace developers about which attribute is wrong.
>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
If you modify the behaviour of a patch, you can add your 'co-dev' +
'sob' tags.
Also, please add an individual changelog, easier for the reviewers to
spot what has changed.
> ---
> net/mptcp/pm_userspace.c | 39 +++++++++++++++++++++++++++++----------
> 1 file changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index a3d477059b11..40fd2f788196 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
(...)
> @@ -579,17 +591,24 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
> if (ret < 0)
> goto set_flags_err;
>
> + if (loc.addr.family == AF_UNSPEC) {
> + NL_SET_ERR_MSG_ATTR(info->extack, attr,
> + "invalid local address family");
> + ret = -EINVAL;
> + goto set_flags_err;
> + }
> +
> if (attr_rem) {
> ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem);
> if (ret < 0)
> goto set_flags_err;
> - }
>
> - if (loc.addr.family == AF_UNSPEC ||
> - rem.addr.family == AF_UNSPEC) {
> - GENL_SET_ERR_MSG(info, "invalid address families");
> - ret = -EINVAL;
> - goto set_flags_err;
> + if (rem.addr.family == AF_UNSPEC) {
As I mentioned in a previous version, this is changing the behaviour:
this remote attribute is no longer mandatory. I'm still unsure about
making it optional, because mptcp_pm_nl_mp_prio_send_ack() will pick
only one subflow, not all the ones with the specified local address. It
looks better to keep it mandatory.
At least here, you should not move it under "if (attr_rem)".
(and maybe it makes more sense to have this patch after 07/11 ("mptcp:
pm: use NL_SET_ERR_MSG_ATTR when possible"), but that's a detail, fine here)
> + NL_SET_ERR_MSG_ATTR(info->extack, attr_rem,
> + "invalid remote address family");
> + ret = -EINVAL;
> + goto set_flags_err;
> + }
> }
>
> if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-01-06 9:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 8:16 [PATCH mptcp-next v7 00/11] mptcp: use GENL_REQ_ATTR_CHECK in userspace pm Geliang Tang
2025-01-06 8:16 ` [PATCH mptcp-next v7 01/11] mptcp: pm: more precise error messages Geliang Tang
2025-01-06 9:17 ` Matthieu Baerts [this message]
2025-01-06 8:16 ` [PATCH mptcp-next v7 02/11] mptcp: userspace pm set_flags id support Geliang Tang
2025-01-06 9:31 ` Matthieu Baerts
2025-01-06 8:16 ` [PATCH mptcp-next v7 03/11] mptcp: drop skb parameter of set_flags Geliang Tang
2025-01-06 8:16 ` [PATCH mptcp-next v7 04/11] mptcp: change rem type " Geliang Tang
2025-01-06 8:16 ` [PATCH mptcp-next v7 05/11] mptcp: add local & remote parameters for set_flags Geliang Tang
2025-01-06 9:39 ` Matthieu Baerts
2025-01-06 10:01 ` Matthieu Baerts
2025-01-06 8:16 ` [PATCH mptcp-next v7 06/11] mptcp: drop info of userspace_pm_remove_id_zero_address Geliang Tang
2025-01-06 9:48 ` Matthieu Baerts
2025-01-06 8:16 ` [PATCH mptcp-next v7 07/11] mptcp: pm: use NL_SET_ERR_MSG_ATTR when possible Geliang Tang
2025-01-06 9:04 ` Matthieu Baerts
2025-01-06 8:16 ` [PATCH mptcp-next v7 08/11] mptcp: pm: improve error messages Geliang Tang
2025-01-06 9:55 ` Matthieu Baerts
2025-01-06 8:16 ` [PATCH mptcp-next v7 09/11] mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK Geliang Tang
2025-01-06 8:16 ` [PATCH mptcp-next v7 10/11] mptcp: pm: remove duplicated error messages Geliang Tang
2025-01-06 8:16 ` [PATCH mptcp-next v7 11/11] mptcp: pm: mark missing address attributes Geliang Tang
2025-01-06 9:20 ` [PATCH mptcp-next v7 00/11] mptcp: use GENL_REQ_ATTR_CHECK in userspace pm MPTCP CI
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=664bedcc-a172-46b6-8c0e-a023477ce98a@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
/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