All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmytro SHYTYI <dmytro@shytyi.net>
To: Paolo Abeni <pabeni@redhat.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH net-next v2] net: mptcp, Fast Open Mechanism
Date: Wed, 19 Jan 2022 17:35:21 +0000	[thread overview]
Message-ID: <27a82812-5502-73ba-8d1d-1cff7a86e207@shytyi.net> (raw)
In-Reply-To: <3f1ec9d12c7903988639689f3a7568a97ce83ef0.camel@redhat.com>

Hello Paolo,

On 18/01/2022 11:02, Paolo Abeni wrote:
> On Mon, 2022-01-17 at 21:48 +0000, Dmytro SHYTYI wrote:
>> Hi Paolo,
>>
>> AFAIK, TFO option requires more that 8 bytes, if cookie len is 8 bytes:
>>
>> In file /net/ipv4/tcp_output.c (line 689):
>>
>> static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
>>                                 struct tcp_out_options *opts)
>> ....
>> {
>>           if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) {
>>                   struct tcp_fastopen_cookie *foc = opts->fastopen_cookie;
>>                   u8 *p = (u8 *)ptr;
>>                   u32 len; /* Fast Open option length */
>>
>>                   if (foc->exp) {
>>                           len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
>>                           *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) |
>>                                        TCPOPT_FASTOPEN_MAGIC);
>>                           p += TCPOLEN_EXP_FASTOPEN_BASE;
>>                   } else {
>>                           len = TCPOLEN_FASTOPEN_BASE + foc->len;
>>                           *p++ = TCPOPT_FASTOPEN;
>>                           *p++ = len;
>>                   }
>>
>>                   memcpy(p, foc->val, foc->len);
>>                   if ((len & 3) == 2) {
>>                           p[foc->len] = TCPOPT_NOP;
>>                           p[foc->len + 1] = TCPOPT_NOP;
>>                   }
>>                   ptr += (len + 3) >> 2;
>>           }
>> ...
>>
>> Here we do have  "len = TCPOLEN_FASTOPEN_BASE + foc->len" that is
>> slightly more than 8 bytes.
>>
>> This is the cause of introducing 4 byte cookie for MPTCP implementation.
>>
>> The RFC 8684 B.1. says:
>>     This is done with the TCP cookie request/response
>>      options, of 2 bytes and 6-18 bytes, respectively (depending on the
>>      chosen cookie length).
>>
>> So in my understanding, the "selected cookie size +
>> TCPOLEN_FASTOPEN_BASE" = 6, is not prohibited by, and in the allowed
>> range of the RFC 8684.
> 
> You are right, I underlooked the TFO option writing.
> 
>> As you suggested I will document the size of the cookie, if there is no
>> objections to above information :)
> 
> Shrinking the TFO cookie size has both security and functional impact:
> 
> - we do not want to change the TFO cookie size for TCP connection in
> MPTCP enabled build.
> - dynamically selecting the TFO cookie size depending on the specific
> rsk type will add more complexity to the TCP code.

I agree with functional and future security impact in case if we reduce 
the cookie size.

> rfc8684 suggests we could remove the TS option from the synack packet.
> I think it's worthy to try such idea.
> 
> To do that, we need to change the 'mptcp_synack_options()' hook
> signature, to accept a 'struct tcp_out_options' as the 3rd argument, so
> that mptcp_synack_options() can clear the TCPOLEN_TSTAMP_ALIGNED bit
> when needed.

With this we can try to keep "cookie len == 8". It will simplify things. 
I will look into it.

> Thanks
> 
> Paolo
> 

Thanks,
Dmytro.

  reply	other threads:[~2022-01-19 17:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16  0:12 [PATCH net-next v2] net: mptcp, Fast Open Mechanism Dmytro SHYTYI
2022-01-16 13:15 ` kernel test robot
2022-01-16 13:15   ` kernel test robot
2022-01-16 21:24   ` Dmytro SHYTYI
2022-01-17  9:01     ` Matthieu Baerts
2022-01-17 21:08       ` Dmytro SHYTYI
2022-01-16 13:45 ` kernel test robot
2022-01-16 13:45   ` kernel test robot
2022-01-17  9:58 ` Paolo Abeni
2022-01-17 10:03   ` Paolo Abeni
2022-01-17 10:22     ` Matthieu Baerts
2022-01-17 21:51       ` Dmytro SHYTYI
2022-01-17 21:48     ` Dmytro SHYTYI
2022-01-18 11:02       ` Paolo Abeni
2022-01-19 17:35         ` Dmytro SHYTYI [this message]
2022-01-21  0:00           ` Dmytro SHYTYI
2022-01-17 21:39   ` Dmytro SHYTYI
2022-01-16 18:41 kernel test robot
2022-01-18 14:28 ` Dan Carpenter
2022-01-18 14:28 ` Dan Carpenter
2022-01-19 17:37 ` Dmytro SHYTYI

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=27a82812-5502-73ba-8d1d-1cff7a86e207@shytyi.net \
    --to=dmytro@shytyi.net \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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 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.