All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v6 4/7] mptcp: pm: userspace: flags: clearer msg if no remote addr
Date: Mon, 06 Jan 2025 16:46:46 +0800	[thread overview]
Message-ID: <a7048ad95016f7c77dc6ebe053dbfbb994b9d1cc.camel@kernel.org> (raw)
In-Reply-To: <20241230-genl_req_attr_check-v6-4-3ec9103559e7@kernel.org>

On Mon, 2024-12-30 at 14:24 +0100, Matthieu Baerts (NGI0) wrote:
> Since its introduction in commit 892f396c8e68 ("mptcp: netlink: issue
> MP_PRIO signals from userspace PMs"), it was mandatory to specify the
> remote address, because of the 'if (rem->addr.family == AF_UNSPEC)'
> check done later one.
> 
> In theory, this attribute can be optional, but it sounds better to be
> precise to avoid sending the MP_PRIO on the wrong subflow, e.g. if
> there
> are multiple subflows attached to the same local ID. This can be
> relaxed
> later on if there is a need to act on multiple subflows with one
> command.
> 
> For the moment, the check to see if attr_rem is NULL can be removed,
> because mptcp_pm_parse_entry() will do this check as well, no need to
> do
> that differently here.
> 
> While at it, move the parsing after the check linked to the local
> attribute.
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  net/mptcp/pm_userspace.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index
> a8f73b082460ba00f7fa998cf7646368f8201e2e..2f82ac49db35ec34dcc0b9208f4
> ac12edc6ab254 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -601,12 +601,6 @@ int mptcp_userspace_pm_set_flags(struct sk_buff
> *skb, struct genl_info *info)
>  	if (ret < 0)
>  		goto set_flags_err;
>  
> -	if (attr_rem) {
> -		ret = mptcp_pm_parse_entry(attr_rem, info, false,
> &rem);
> -		if (ret < 0)
> -			goto set_flags_err;
> -	}

I did not remove this 'if (attr_rem)' check in v7. I moved this code to
a common place for userspace PM and in-kernel PM. For in-kernel PM,
this check is required.

> -
>  	if (loc.addr.family == AF_UNSPEC) {
>  		NL_SET_ERR_MSG_ATTR(info->extack, attr,
>  				    "invalid local address family");
> @@ -614,6 +608,10 @@ int mptcp_userspace_pm_set_flags(struct sk_buff
> *skb, struct genl_info *info)
>  		goto set_flags_err;
>  	}
>  
> +	ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem);
> +	if (ret < 0)
> +		goto set_flags_err;
> +
>  	if (rem.addr.family == AF_UNSPEC) {
>  		NL_SET_ERR_MSG_ATTR(info->extack, attr_rem,
>  				    "invalid remote address
> family");
> 


  reply	other threads:[~2025-01-06  8:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 13:24 [PATCH mptcp-next v6 0/7] mptcp: use GENL_REQ_ATTR_CHECK in userspace pm Matthieu Baerts (NGI0)
2024-12-30 13:24 ` [PATCH mptcp-next v6 1/7] mptcp: pm: use NL_SET_ERR_MSG_ATTR when possible Matthieu Baerts (NGI0)
2025-01-06  8:27   ` Geliang Tang
2024-12-30 13:24 ` [PATCH mptcp-next v6 2/7] mptcp: pm: more precise error messages Matthieu Baerts (NGI0)
2025-01-06  8:38   ` Geliang Tang
2025-01-06  8:55     ` Matthieu Baerts
2024-12-30 13:24 ` [PATCH mptcp-next v6 3/7] mptcp: pm: improve " Matthieu Baerts (NGI0)
2025-01-06  8:41   ` Geliang Tang
2025-01-06  8:45     ` Matthieu Baerts
2025-01-06  8:55       ` Geliang Tang
2025-01-06  9:03         ` Matthieu Baerts
2024-12-30 13:24 ` [PATCH mptcp-next v6 4/7] mptcp: pm: userspace: flags: clearer msg if no remote addr Matthieu Baerts (NGI0)
2025-01-06  8:46   ` Geliang Tang [this message]
2024-12-30 13:24 ` [PATCH mptcp-next v6 5/7] mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK Matthieu Baerts (NGI0)
2024-12-30 13:24 ` [PATCH mptcp-next v6 6/7] mptcp: pm: remove duplicated error messages Matthieu Baerts (NGI0)
2024-12-30 13:24 ` [PATCH mptcp-next v6 7/7] mptcp: pm: mark missing address attributes Matthieu Baerts (NGI0)
2024-12-30 14:21 ` [PATCH mptcp-next v6 0/7] mptcp: use GENL_REQ_ATTR_CHECK in userspace pm MPTCP CI
2025-01-06  8:24 ` Geliang Tang
2025-01-06  9:08   ` 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=a7048ad95016f7c77dc6ebe053dbfbb994b9d1cc.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=matttbe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.