# TCP Fast Open

In computer networking, TCP Fast Open (TFO) is an extension to speed up the opening of successive Transmission Control Protocol (TCP) connections between two endpoints. It works by using a TFO cookie (a TCP option), which is a cryptographic cookie stored on the client and set upon the initial connection with the server. When the client later reconnects, it sends the initial SYN packet along with the TFO cookie data to authenticate itself. If successful, the server may start sending data to the client even before the reception of the final ACK packet of the three-way handshake, thus skipping a round-trip delay and lowering the latency in the start of data transmission.
The cookie is generated by applying a block cipher keyed on a key held secret by the server to the client's, generating an authentication tag that is difficult for third parties to spoof, even if they can forge a source IP address or make two-way connections to the same server from other IP addresses. Although it uses cryptographic techniques to generate the cookie, TFO is not intended to provide more security than the three-way handshake it replaces, and does not give any form of cryptographic protection to the resulting TCP connection, or provide identity assurance about either endpoint. It also is not intended to be resistant to man-in-the-middle attacks. If such resistance is required, it may be used in combination with a cryptographic protocol such as TLS or IPsec.
TFO has been difficult to deploy due to protocol ossification; in 2020, no Web browsers used it by default.
TFO presents privacy challenges; the TFO cookie can allow persistently tracking a client across sessions, even by passive observers.

## History

The TFO proposal was originally presented in 2011 and was published as the experimental RFC 7413 in December 2014. TCP Fast Open shares the goal of bypassing the three-way handshake of TCP with an earlier proposal from 1994, called T/TCP (RFC 1644). In contrast to TCP Fast Open, T/TCP paid no attention to security, opening a path for vulnerabilities and failing to gain traction.

## Characteristics

TFO implementations include the following:
* IPv4 support for TFO was merged into the Linux kernel mainline in kernel versions 3.6 (support for clients) and 3.7 (Dec 2012) (support for servers), and was turned on by default in kernel version 3.13 (Jan 2014). TFO support for IPv6 servers was merged in kernel version 3.16.
* FreeBSD from version 10.3 (support for servers) and 12.0. (support for clients).
* Mozilla Firefox from version 58. The support was disabled by default due to network device compatibility issues with TFO and TLS 1.3 and eventually removed in version 87.
* Google Chrome and Chromium browsers have support for TFO on Linux, including ChromeOS and Android.
* Exim mail transfer agent (MTA) from version 4.88.
* Unbound DNS Resolver from version 1.5.10.
* BIND Domain Name System (DNS) from version 9.11.0.
* Knot DNS from version 2.6.0.
* Apple's iOS 9 and OS X 10.11 both support TCP Fast Open, but it is not enabled for individual connections by default.
* Microsoft Edge supports TCP Fast Open since Windows 10 Preview build 14352.
* PowerDNS Recursor supports TCP Fast Open from version 4.1.
* dnsmasq supports TCP-fastopen (RFC-7413) from version 2.81.