how to activate the TCP Fast Open in linux
I have 2 PCs linux (PC1: kernel 3.13.0-37 and PC2: kernel 3.11.0-12)
PC1-------PC2(TCP server port 4410)
From PC1, I m sending a tcp packet with TCP Fast Open (Fast Open Cookie Request)
I m expecting to get an answer from the server with TCP option (Fast Open Cookie: xxxxxxx) something like this:
But I got a tcp packet without the TCP option (Fast Open Cookie: xxxxxxx).
I m wondering if there is something to configure on my PC2 (linux) in order to activate the TCP Fastt Open option.
For the TCP server, I m running a php script:
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
// Bind the socket to an address/port
socket_bind($sock, "0.0.0.0", 4410) or die('Could not bind to address');
for(;;) {
// Start listening for connections
socket_listen($sock);
...
}
You have to enable TFO in the server's listening socket with:
int qlen = 5;
setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen));
(https://lwn.net/Articles/508865/)