All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] Re: [MPTCP][PATCH mptcp-next 1/4] Squash to "mptcp: add port support for ADD_ADDR suboption writing"
@ 2020-11-10  0:03 Mat Martineau
  0 siblings, 0 replies; only message in thread
From: Mat Martineau @ 2020-11-10  0:03 UTC (permalink / raw)
  To: mptcp

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


On Sun, 8 Nov 2020, Geliang Tang wrote:

> Here is the new commit message, please update it:
> """
> In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port
> is 18 octets, but mptcp_write_options is 32-bit aligned, so we need to
> pad it to 20 octets. All the other port related option lengths need to
> be added up 2 octets similarly.
>
> This patch added a new field 'port' in mptcp_out_options. When this
> field is set with a port number, we need to add up 4 octets for the
> ADD_ADDR suboption, and put the port number into the suboption.
> """
>
> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> ---
> net/mptcp/options.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index f611fbcbd6d0..5df31d0b885b 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -1116,13 +1116,16 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> 			}
> 		} else {
> 			if (opts->ahmac) {
> -				put_unaligned_be32(opts->port << 16 |
> -						   opts->ahmac >> 48, ptr);
> -				ptr += 1;
> -				put_unaligned_be64(opts->ahmac << 16 |
> -						   TCPOPT_NOP << 8 |
> -						   TCPOPT_NOP, ptr);
> -				ptr += 2;
> +				u8 *bptr = (u8 *)ptr;
> +
> +				put_unaligned_be16(opts->port, bptr);
> +				bptr += 2;
> +				put_unaligned_be64(opts->ahmac, bptr);
> +				bptr += 8;
> +				put_unaligned_be16(TCPOPT_NOP << 8 |
> +						   TCPOPT_NOP, bptr);
> +
> +				ptr += 3;

Thanks, looks good to me.

> 			} else {
> 				put_unaligned_be32(opts->port << 16 |
> 						   TCPOPT_NOP << 8 |
> -- 
> 2.26.2

--
Mat Martineau
Intel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-10  0:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  0:03 [MPTCP] Re: [MPTCP][PATCH mptcp-next 1/4] Squash to "mptcp: add port support for ADD_ADDR suboption writing" Mat Martineau

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.