mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliangtang@gmail.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [MPTCP][PATCH mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal"
Date: Mon, 26 Jul 2021 17:31:48 -0700 (PDT)	[thread overview]
Message-ID: <e8a07d66-3e27-4423-421f-f836e58cf276@linux.intel.com> (raw)
In-Reply-To: <313195dff50905ec809b66b2f195340dd80d68ff.1627219500.git.geliangtang@xiaomi.com>

On Sun, 25 Jul 2021, Geliang Tang wrote:

> Paolo's patch (Squash-to: "mptcp: build ADD_ADDR/echo-ADD_ADDR option
> according pm.add_signal") reverts back to a single 'addr' field in struct
> mptcp_addr_info.
>
> Then no need to change the argument of mptcp_pm_add_addr_signal and no
> need to modify the code in mptcp_write_options now, the original code is
> fine.
>
> So this patch reverts back more code.
>
> And the commit log needs to be updated:
>
> '''
> According to the MPTCP_ADD_ADDR_SIGNAL or MPTCP_ADD_ADDR_ECHO flag, build
> the ADD_ADDR/ADD_ADDR_ECHO option.
>
> In mptcp_pm_add_addr_signal(), use opts->remote or opts->local to save the
> announced ADD_ADDR or ADD_ADDR_ECHO address.
> '''
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Hi Geliang,

Thanks for the updates to this patch. The result of squashing Paolo's 
patch and yours to the "mptcp: build ADD_ADDR..." patch is much clearer.

As you note here (and in your reply), the commit message also needs some 
work. One more part of that, the commit message should say 
"pm.addr_signal" instead of "pm.add_signal", but that is a separate fix.


Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>



> ---
> net/mptcp/options.c  | 25 ++++++++++++-------------
> net/mptcp/pm.c       |  6 +++---
> net/mptcp/protocol.h |  2 +-
> 3 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index eafdb9408f3a..cb29a5605776 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -668,7 +668,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
> 	int len;
>
> 	if (!mptcp_pm_should_add_signal(msk) ||
> -	    !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, opts,
> +	    !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr,
> 		    &echo, &port, &drop_other_suboptions))
> 		return false;
>
> @@ -692,8 +692,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
> 						     msk->remote_key,
> 						     &opts->addr);
> 	}
> -	pr_debug("addr_id=%d, addr_port=%d, ahmac=%llu, echo=%d",
> -		 opts->addr.id, ntohs(opts->addr.port), opts->ahmac, echo);
> +	pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d",
> +		 opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port));
>
> 	return true;
> }
> @@ -1250,16 +1250,15 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
>
> mp_capable_done:
> 	if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) {
> -		struct mptcp_addr_info *addr = &opts->addr;
> 		u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;
> 		u8 echo = MPTCP_ADDR_ECHO;
>
> #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> -		if (addr->family == AF_INET6)
> +		if (opts->addr.family == AF_INET6)
> 			len = TCPOLEN_MPTCP_ADD_ADDR6_BASE;
> #endif
>
> -		if (addr->port)
> +		if (opts->addr.port)
> 			len += TCPOLEN_MPTCP_PORT_LEN;
>
> 		if (opts->ahmac) {
> @@ -1268,25 +1267,25 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> 		}
>
> 		*ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR,
> -				      len, echo, addr->id);
> -		if (addr->family == AF_INET) {
> -			memcpy((u8 *)ptr, (u8 *)&addr->addr.s_addr, 4);
> +				      len, echo, opts->addr.id);
> +		if (opts->addr.family == AF_INET) {
> +			memcpy((u8 *)ptr, (u8 *)&opts->addr.addr.s_addr, 4);
> 			ptr += 1;
> 		}
> #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> -		else if (addr->family == AF_INET6) {
> -			memcpy((u8 *)ptr, addr->addr6.s6_addr, 16);
> +		else if (opts->addr.family == AF_INET6) {
> +			memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16);
> 			ptr += 4;
> 		}
> #endif
>
> -		if (!addr->port) {
> +		if (!opts->addr.port) {
> 			if (opts->ahmac) {
> 				put_unaligned_be64(opts->ahmac, ptr);
> 				ptr += 2;
> 			}
> 		} else {
> -			u16 port = ntohs(addr->port);
> +			u16 port = ntohs(opts->addr.port);
>
> 			if (opts->ahmac) {
> 				u8 *bptr = (u8 *)ptr;
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 5fe3805af02a..781da0885f98 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -257,7 +257,7 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup)
>
> bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
> 			      unsigned int opt_size, unsigned int remaining,
> -			      struct mptcp_out_options *opts, bool *echo,
> +			      struct mptcp_addr_info *saddr, bool *echo,
> 			      bool *port, bool *drop_other_suboptions)
> {
> 	int ret = false;
> @@ -286,10 +286,10 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
> 		goto out_unlock;
>
> 	if (*echo) {
> -		opts->addr = msk->pm.remote;
> +		*saddr = msk->pm.remote;
> 		add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO);
> 	} else {
> -		opts->addr = msk->pm.local;
> +		*saddr = msk->pm.local;
> 		add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL);
> 	}
> 	WRITE_ONCE(msk->pm.addr_signal, add_addr);
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index b54335857b6e..099e3e6a4c89 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -801,7 +801,7 @@ static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
>
> bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, struct sk_buff *skb,
> 			      unsigned int opt_size, unsigned int remaining,
> -			      struct mptcp_out_options *opts, bool *echo,
> +			      struct mptcp_addr_info *saddr, bool *echo,
> 			      bool *port, bool *drop_other_suboptions);
> bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
> 			     struct mptcp_rm_list *rm_list);
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

      parent reply	other threads:[~2021-07-27  0:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 13:41 [MPTCP][PATCH mptcp-next] Squash to "Squash-to: mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal" Geliang Tang
2021-07-25 13:50 ` Geliang Tang
2021-07-26  8:08 ` Paolo Abeni
2021-07-27  0:31 ` Mat Martineau [this message]

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=e8a07d66-3e27-4423-421f-f836e58cf276@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=geliangtang@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).