MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] Re: [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" - bugfix
Date: Tue, 09 Mar 2021 20:28:26 -0800	[thread overview]
Message-ID: <839ae651-e496-7947-6a8b-acd569f85392@linux.intel.com> (raw)
In-Reply-To: 1013371d28c0219e3bdd904539094a90d7d3ffae.1615260023.git.geliangtang@gmail.com

[-- Attachment #1: Type: text/plain, Size: 2615 bytes --]

On Tue, 9 Mar 2021, Geliang Tang wrote:

> The original RM_ADDR option writing can only deal with 8 addresses, this
> patch fixed it.
>
> It also fixed a bug in mptcp_rm_addr_len too.
>
> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> ---
> v3:
> - set 'i = 1'.

Hi Geliang,

Thanks for the revision. v3 looks good to squash.

Mat


> v2:
> - add the bugfix for mptcp_rm_addr_len.
> ---
> net/mptcp/options.c  | 22 +++++++++++-----------
> net/mptcp/protocol.h |  2 +-
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 595b4b4279f7..c99d8172a50e 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -1222,22 +1222,22 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> 	}
>
> 	if (OPTION_MPTCP_RM_ADDR & opts->suboptions) {
> -		u8 i;
> +		u8 i = 1;
>
> -		for (i = opts->rm_list.nr; i < MPTCP_RM_IDS_MAX; i++)
> -			opts->rm_list.ids[i] = TCPOPT_NOP;
> 		*ptr++ = mptcp_option(MPTCPOPT_RM_ADDR,
> 				      TCPOLEN_MPTCP_RM_ADDR_BASE + opts->rm_list.nr,
> 				      0, opts->rm_list.ids[0]);
> -		if (opts->rm_list.nr > 1) {
> -			put_unaligned_be32(opts->rm_list.ids[1] << 24 | opts->rm_list.ids[2] << 16 |
> -					   opts->rm_list.ids[3] << 8 | opts->rm_list.ids[4], ptr);
> -			ptr += 1;
> -		}
> -		if (opts->rm_list.nr > 5) {
> -			put_unaligned_be32(opts->rm_list.ids[5] << 24 | opts->rm_list.ids[6] << 16 |
> -					   opts->rm_list.ids[7] << 8 | TCPOPT_NOP, ptr);
> +
> +		while (i < opts->rm_list.nr) {
> +			u8 id1, id2, id3, id4;
> +
> +			id1 = opts->rm_list.ids[i];
> +			id2 = i + 1 < opts->rm_list.nr ? opts->rm_list.ids[i + 1] : TCPOPT_NOP;
> +			id3 = i + 2 < opts->rm_list.nr ? opts->rm_list.ids[i + 2] : TCPOPT_NOP;
> +			id4 = i + 3 < opts->rm_list.nr ? opts->rm_list.ids[i + 3] : TCPOPT_NOP;
> +			put_unaligned_be32(id1 << 24 | id2 << 16 | id3 << 8 | id4, ptr);
> 			ptr += 1;
> +			i += 4;
> 		}
> 	}
>
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 4566f6d41d21..133e2e09f55a 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -711,7 +711,7 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)
>
> static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
> {
> -	if (rm_list->nr == 0 || rm_list->nr >= MPTCP_RM_IDS_MAX)
> +	if (rm_list->nr == 0 || rm_list->nr > MPTCP_RM_IDS_MAX)
> 		return -EINVAL;
>
> 	return TCPOLEN_MPTCP_RM_ADDR_BASE + roundup(rm_list->nr - 1, 4) + 1;
> -- 
> 2.29.2

--
Mat Martineau
Intel

             reply	other threads:[~2021-03-10  4:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  4:28 Mat Martineau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-10 14:04 [MPTCP] Re: [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" - bugfix 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=839ae651-e496-7947-6a8b-acd569f85392@linux.intel.com \
    --to=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