All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mptcp: make sure flag signal is set when add addr with port
@ 2021-04-23 10:25 Jianguo Wu
  2021-04-23 10:28 ` Geliang Tang
  2021-04-24  8:53 ` Matthieu Baerts
  0 siblings, 2 replies; 3+ messages in thread
From: Jianguo Wu @ 2021-04-23 10:25 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang, Matthieu Baerts

From: Jianguo Wu <wujianguo@chinatelecom.cn>

When add address with port, it is mean to create a listening socket,
and send an ADD_ADDR to remote, so it must have flag signal set,
add this check in mptcp_pm_parse_addr().

Fixes: a77e9179c7651 ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink")
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
---
 net/mptcp/pm_netlink.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index becc32b..90bba32 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -971,8 +971,14 @@ static int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
 	if (tb[MPTCP_PM_ADDR_ATTR_FLAGS])
 		entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]);

-	if (tb[MPTCP_PM_ADDR_ATTR_PORT])
+	if (tb[MPTCP_PM_ADDR_ATTR_PORT]) {
+		if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
+			NL_SET_ERR_MSG_ATTR(info->extack, attr,
+					    "flags must have signal when using port");
+			return -EINVAL;
+		}
 		entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));
+	}

 	return 0;
 }
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mptcp: make sure flag signal is set when add addr with port
  2021-04-23 10:25 [PATCH v2] mptcp: make sure flag signal is set when add addr with port Jianguo Wu
@ 2021-04-23 10:28 ` Geliang Tang
  2021-04-24  8:53 ` Matthieu Baerts
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2021-04-23 10:28 UTC (permalink / raw)
  To: Jianguo Wu; +Cc: mptcp, Matthieu Baerts

Hi Jianguo,

Jianguo Wu <wujianguo106@163.com> 于2021年4月23日周五 下午6:26写道:
>
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
>
> When add address with port, it is mean to create a listening socket,
> and send an ADD_ADDR to remote, so it must have flag signal set,
> add this check in mptcp_pm_parse_addr().
>
> Fixes: a77e9179c7651 ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink")
> Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
> ---
>  net/mptcp/pm_netlink.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index becc32b..90bba32 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -971,8 +971,14 @@ static int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
>         if (tb[MPTCP_PM_ADDR_ATTR_FLAGS])
>                 entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]);
>
> -       if (tb[MPTCP_PM_ADDR_ATTR_PORT])
> +       if (tb[MPTCP_PM_ADDR_ATTR_PORT]) {
> +               if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
> +                       NL_SET_ERR_MSG_ATTR(info->extack, attr,
> +                                           "flags must have signal when using port");
> +                       return -EINVAL;
> +               }
>                 entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));
> +       }
>
>         return 0;
>  }

LGTM.

Acked-by: Geliang Tang <geliangtang@gmail.com>

-Geliang

> --
> 1.8.3.1
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mptcp: make sure flag signal is set when add addr with port
  2021-04-23 10:25 [PATCH v2] mptcp: make sure flag signal is set when add addr with port Jianguo Wu
  2021-04-23 10:28 ` Geliang Tang
@ 2021-04-24  8:53 ` Matthieu Baerts
  1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2021-04-24  8:53 UTC (permalink / raw)
  To: Jianguo Wu, mptcp; +Cc: Geliang Tang

Hi Jianguo, Geliang,

On 23/04/2021 12:25, Jianguo Wu wrote:
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
> 
> When add address with port, it is mean to create a listening socket,
> and send an ADD_ADDR to remote, so it must have flag signal set,
> add this check in mptcp_pm_parse_addr().

Thank you for your patch and the review!

This is now in our tree:

- eb86a8c1aeed: mptcp: make sure flag signal is set when add addr with port
- Results: 3692d2b92d9f..5c90fe877090

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210424T085242
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210424T085242

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-24  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 10:25 [PATCH v2] mptcp: make sure flag signal is set when add addr with port Jianguo Wu
2021-04-23 10:28 ` Geliang Tang
2021-04-24  8:53 ` Matthieu Baerts

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.