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 mptcp-next 1/8] mptcp: add ADD_ADDR port support for writing options
Date: Fri, 30 Oct 2020 17:14:51 -0700	[thread overview]
Message-ID: <ef6b2cf7-6ff4-c0cf-da13-3974668a5715@linux.intel.com> (raw)
In-Reply-To: 9f367861-1410-e87-546a-b33c211f5f7d@linux.intel.com

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

On Thu, 29 Oct 2020, Mat Martineau wrote:

>
> On Thu, 29 Oct 2020, Geliang Tang wrote:
>
>> This patch added ADD_ADDR port support for writing options.
>> 
>> In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port
>> is 18 octets:
>>
>>                       1                   2                   3
>>   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
>>  +---------------+---------------+-------+-------+---------------+
>>  |     Kind      |     Length    |Subtype|(rsv)|E|  Address ID   |
>>  +---------------+---------------+-------+-------+---------------+
>>  |           Address (IPv4: 4 octets / IPv6: 16 octets)          |
>>  +-------------------------------+-------------------------------+
>>  |   Port (2 octets, optional)   |                               |
>>  +-------------------------------+                               |
>>  |                Truncated HMAC (8 octets, if E=0)              |
>>  |                               +-------------------------------+
>>  |                               |
>>  +-------------------------------+
>> 
>> But mptcp_write_options is 32-bit aligned, so we need to pad it to 20
>> octets.
>> 
>> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
>> ---
>> include/net/mptcp.h  |  1 +
>> net/mptcp/options.c  | 64 +++++++++++++++++++++++++++++++++++++-------
>> net/mptcp/protocol.h | 10 +++----
>> 3 files changed, 60 insertions(+), 15 deletions(-)
>> 
>> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
>> index b6cf07143a8a..bb8b7b931490 100644
>> --- a/include/net/mptcp.h
>> +++ b/include/net/mptcp.h
>> @@ -46,6 +46,7 @@ struct mptcp_out_options {
>> #endif
>> 	};
>> 	u8 addr_id;
>> +	__be16 port;
>
> This should be a u16 (all the members in this struct use CPU byte order). The 
> put_unaligned_be16() calls below also assume this is in CPU order.
>

Looking at later patches in the patch set, I see now that __be16 is used 
in other places for the port number. __be16 is also used for inet_dport in 
various places. We should make sure the port number is handled 
consistently within the MPTCP code, and to make sure it is also consistent 
with the other IP code. Anyone else have an opinion here?

If you keep using __be16, it does remain an issue that you don't want to 
use get_unaligned_be16() and put_unaligned_be16() with that data type.

--
Mat Martineau
Intel

             reply	other threads:[~2020-10-31  0:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31  0:14 Mat Martineau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-30  0:42 [MPTCP] Re: [MPTCP][PATCH mptcp-next 1/8] mptcp: add ADD_ADDR port support for writing options Mat Martineau

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=ef6b2cf7-6ff4-c0cf-da13-3974668a5715@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