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 v13 05/14] mptcp: check userspace pm flags
Date: Mon, 19 Feb 2024 15:53:10 +0100	[thread overview]
Message-ID: <59e46854-b8f1-48ee-9a83-25cbbce3330a@kernel.org> (raw)
In-Reply-To: <c600e3c58ad50e778c3357af6b58aa9008b28de6.1708069036.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 16/02/2024 08:42, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Just like MPTCP_PM_ADDR_FLAG_SIGNAL flag is checked in userspace PM
> announce mptcp_pm_nl_announce_doit(), PM flags should be checked in
> mptcp_pm_nl_subflow_create_doit() too.
> 
> If MPTCP_PM_ADDR_FLAG_SUBFLOW flag is not set, there's no flags field
> in the output of dump_addr. This looks a bit strange:
> 
>         id 10 flags  10.0.3.2
> 
> This patch uses mptcp_pm_parse_entry() instead of mptcp_pm_parse_addr()
> to get the PM flags of the entry and check it. MPTCP_PM_ADDR_FLAG_SIGNAL
> flag shouldn't be set here, and if MPTCP_PM_ADDR_FLAG_SUBFLOW flag is
> missing from the netlink attribute, always set this flag.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  net/mptcp/pm_userspace.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index d6b7be3afbe5..73ad286247f1 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -360,11 +360,20 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
>  		goto create_err;
>  	}
>  
> -	err = mptcp_pm_parse_addr(laddr, info, &addr_l);
> +	err = mptcp_pm_parse_entry(laddr, info, true, &local);
>  	if (err < 0) {
>  		NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr");
>  		goto create_err;
>  	}
> +	addr_l = local.addr;

Detail: do we still need addr_l? Can we not use local.addr directly below?

> +
> +	if (local.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
> +		GENL_SET_ERR_MSG(info, "invalid addr flags");
> +		err = -EINVAL;
> +		goto create_err;
> +	}
> +	if (!(local.flags & MPTCP_PM_ADDR_FLAG_SUBFLOW))
> +		local.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW;

(not sure the 'if' is needed: why not always setting it?)

>  
>  	err = mptcp_pm_parse_addr(raddr, info, &addr_r);
>  	if (err < 0) {
> @@ -378,7 +387,6 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
>  		goto create_err;
>  	}
>  
> -	local.addr = addr_l;
>  	err = mptcp_userspace_pm_append_new_local_addr(msk, &local, false);
>  	if (err < 0) {
>  		GENL_SET_ERR_MSG(info, "did not match address and id");

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

  reply	other threads:[~2024-02-19 14:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  7:42 [PATCH mptcp-next v13 00/14] dump for userspace pm Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 01/14] mptcp: export mptcp_genl_family & mptcp_nl_fill_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 02/14] mptcp: implement mptcp_userspace_pm_dump_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 03/14] mptcp: add token for get-addr in yaml Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 04/14] mptcp: dump addrs in userspace pm list Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 05/14] mptcp: check userspace pm flags Geliang Tang
2024-02-19 14:53   ` Matthieu Baerts [this message]
2024-02-16  7:42 ` [PATCH mptcp-next v13 06/14] selftests: mptcp: add userspace pm subflow flag Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 07/14] selftests: mptcp: add token for dump_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 08/14] selftests: mptcp: add check_output helper Geliang Tang
2024-02-19 14:51   ` Matthieu Baerts
2024-02-16  7:42 ` [PATCH mptcp-next v13 09/14] selftests: mptcp: dump userspace addrs list Geliang Tang
2024-02-19 14:55   ` Matthieu Baerts
2024-02-16  7:42 ` [PATCH mptcp-next v13 10/14] mptcp: add userspace_pm_lookup_addr_by_id helper Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 11/14] mptcp: implement mptcp_userspace_pm_get_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 12/14] mptcp: get addr in userspace pm list Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 13/14] selftests: mptcp: add token for get_addr Geliang Tang
2024-02-16  7:42 ` [PATCH mptcp-next v13 14/14] selftests: mptcp: userspace pm get addr tests Geliang Tang
2024-02-16  8:34   ` selftests: mptcp: userspace pm get addr tests: Tests Results MPTCP CI
2024-02-16  9:55   ` MPTCP CI
2024-02-16 10:14   ` MPTCP CI
2024-02-16 10:24     ` Matthieu Baerts
2024-02-16 11:08   ` MPTCP CI
2024-02-16 11:31   ` MPTCP CI
2024-02-16 20:33   ` MPTCP CI
2024-02-19 14:56   ` [PATCH mptcp-next v13 14/14] selftests: mptcp: userspace pm get addr tests Matthieu Baerts
2024-02-16 19:31 ` [PATCH mptcp-next v13 00/14] dump for userspace pm Mat Martineau
2024-02-19 14:52 ` 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=59e46854-b8f1-48ee-9a83-25cbbce3330a@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