* [MPTCP] Re: [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" - bugfix
@ 2021-03-10 4:28 Mat Martineau
0 siblings, 0 replies; 2+ messages in thread
From: Mat Martineau @ 2021-03-10 4:28 UTC (permalink / raw)
To: mptcp
[-- 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [MPTCP] Re: [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" - bugfix
@ 2021-03-10 14:04 Matthieu Baerts
0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2021-03-10 14:04 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
Hi Geliang, Mat
On 09/03/2021 04:30, 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.
Thank you for the patch and the review!
- aa3d2ca0ec3a: "squashed" in "mptcp: add rm_list in mptcp_out_options"
- Results: 0d134d561988..6944cd8f9fbe
Tests + export have been queued.
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-10 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-10 4:28 [MPTCP] Re: [MPTCP][PATCH v3 mptcp-next] Squash to "mptcp: add rm_list in mptcp_out_options" - bugfix Mat Martineau
-- strict thread matches above, loose matches on Subject: below --
2021-03-10 14:04 Matthieu Baerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox