MPTCP Linux Development
 help / color / mirror / Atom feed
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 4/8] mptcp: set error messages for set_flags
Date: Wed, 21 Feb 2024 17:18:44 +0100	[thread overview]
Message-ID: <a716b4b3-c826-4d2c-825c-5f902baa9682@kernel.org> (raw)
In-Reply-To: <c8d6e3ae6b110da7d115b720825758708c9a7687.1708497039.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 21/02/2024 7:31 am, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> In addition to returning the error value, this patch also sets an error
> messages with GENL_SET_ERR_MSG or NL_SET_ERR_MSG_ATTR both for pm_netlink.c
> and pm_userspace.c.

Good idea!

Even if it might be obvious, please *always* explain the reason(s) why
having this is interesting. Here, just one sentence is enough:

  It will help the userspace to identify the issue.

(same for other patches in general: please *always* add the reason(s))

(...)

> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index 7ef3b69852f0..09a60f440fef 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -563,13 +563,17 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
>  	token_val = nla_get_u32(token);
>  
>  	msk = mptcp_token_get_sock(net, token_val);
> -	if (!msk)
> +	if (!msk) {
> +		NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token");
>  		return ret;
> +	}
>  
>  	sk = (struct sock *)msk;
>  
> -	if (!mptcp_pm_is_userspace(msk))
> +	if (!mptcp_pm_is_userspace(msk)) {
> +		GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected");

Maybe just "userspace PM not selected"?

>  		goto set_flags_err;
> +	}
>  
>  	ret = mptcp_pm_parse_entry(attr, info, false, &loc);
>  	if (ret < 0)
> @@ -583,6 +587,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
>  
>  	if (loc.addr.family == AF_UNSPEC ||
>  	    rem.addr.family == AF_UNSPEC) {
> +		GENL_SET_ERR_MSG(info, "address families do not match");

Maybe better with this?

  "invalid address families"

>  		ret = -EINVAL;
>  		goto set_flags_err;
>  	}

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

  reply	other threads:[~2024-02-21 16:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  6:31 [PATCH mptcp-next 0/8] some cleanups Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 1/8] mptcp: make pm_remove_addrs_and_subflows static Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 2/8] mptcp: drop duplicate header inclusions Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 3/8] mptcp: update set_flags interfaces Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 4/8] mptcp: set error messages for set_flags Geliang Tang
2024-02-21 16:18   ` Matthieu Baerts [this message]
2024-02-21  6:31 ` [PATCH mptcp-next 5/8] mptcp: drop lookup_by_id in lookup_addr Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 6/8] mptcp: add use_id parameter for addresses_equal Geliang Tang
2024-02-21 16:19   ` Matthieu Baerts
2024-02-21  6:31 ` [PATCH mptcp-next 7/8] mptcp: add check_id for lookup_anno_list_by_saddr Geliang Tang
2024-02-21 16:20   ` Matthieu Baerts
2024-02-21  6:31 ` [PATCH mptcp-next 8/8] selftests: mptcp: flush userspace addrs list Geliang Tang
2024-02-21 15:47   ` selftests: mptcp: flush userspace addrs list: Tests Results MPTCP CI
2024-02-21 16:21   ` [PATCH mptcp-next 8/8] selftests: mptcp: flush userspace addrs list Matthieu Baerts
2024-02-21 16:18 ` [PATCH mptcp-next 0/8] some cleanups 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=a716b4b3-c826-4d2c-825c-5f902baa9682@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