Page MenuHomeFreeBSD

Perform TFO cookie exchange for all TFO cookie requests
AbandonedPublic

Authored by rscheff on Feb 15 2021, 2:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 8:07 PM
Unknown Object (File)
Mar 10 2024, 3:53 AM
Unknown Object (File)
Feb 10 2024, 8:11 AM
Unknown Object (File)
Dec 20 2023, 6:53 AM
Unknown Object (File)
Dec 10 2023, 6:11 PM
Unknown Object (File)
Oct 10 2023, 6:07 PM
Unknown Object (File)
Jul 2 2023, 2:49 AM
Unknown Object (File)
Jun 23 2023, 11:47 PM
Subscribers

Details

Reviewers
tuexen
pkelsey
Group Reviewers
transport
Summary

when sysctl net.inet.tcp.fastpath.acceptany is enabled,
FastPath would accept incoming SYN with data, even when
they only request a cookie (TFO option without data).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37021
Build 33910: arc lint + arc unit

Event Timeline

My understanding is that if net.inet.tcp.fastpath.acceptany is set, all cookies are excepted. This includes empty cookies as mentioned in RFC 7413.

My understanding is that if net.inet.tcp.fastpath.acceptany is set, all cookies are excepted. This includes empty cookies as mentioned in RFC 7413.

Correct, it may generate an empty cookie - and accept SYN data with a empty cookie. However, with acceptany, the server will never actually generate a FastOpen response, thus a Client will not know that TFO is supported by the server.

A client will have to perform SYN+data speculatively, since the Server never response even with an empty TFO.

Looking at the client side, it appears that SYN+data is only sent on a subsequent sendto(), if a prior session carried the TFO in the SYN,ACK from the server - when the client has a key entry for that server.

Let me expand the special case here perhaps, to return a zero-filled, minimum-length cookie without doing the hashing.

My understanding is that if net.inet.tcp.fastpath.acceptany is set, all cookies are excepted. This includes empty cookies as mentioned in RFC 7413.

Correct, it may generate an empty cookie - and accept SYN data with a empty cookie. However, with acceptany, the server will never actually generate a FastOpen response, thus a Client will not know that TFO is supported by the server.

A client will have to perform SYN+data speculatively, since the Server never response even with an empty TFO.

Looking at the client side, it appears that SYN+data is only sent on a subsequent sendto(), if a prior session carried the TFO in the SYN,ACK from the server - when the client has a key entry for that server.

Let me expand the special case here perhaps, to return a zero-filled, minimum-length cookie without doing the hashing.

In my personal view, the net.inet.tcp.fastpath.acceptany is for debugging only. I would like to get rid of it, after adding a way to use empty cookies which can be controlled by a socket option. So if you don't need the protection, just use empty cookies as described in RFC 7413. And you can control this on a socket level granularity.

Glancing at this, the current fastopen infrastructure doesn't seem to have any mechanism to provide shorter key-length keys. The server side key generation is apparently done asynchonously, and reused for all clients requesting TFO. Thus special casing the acceptany when sending out the TFO option, to send out a shorter key there.

The problem is with the negotiation part - a zero length cookie, while acceptable per RFC, still needs to be sent back to a client, for it to send out SYN+data. Otherwise, a regular SYN followed by a PUSH,ACK appears to be happening.

However, it appears that dealing with zero length cookies needs more work - the alternative would be to send out a length=4, zero filled cookie, to save slightly on option space. Also, the server cookie length is hardcoded and fixed (not controlled by any sysctl), which may pose problem when multiple SYN options use up space...

The above tweak will guarantee the TFO negotiation to take place with the existing server-side key (and client-IP-specific hashing).

Let's discuss this at the next Transport call...