If TCP_FASTOPEN_CONNECT is defined it's a sign that we're being
compiled on recent Linux. Try, experimentally, enabling TFO always on
this platform.
Note that the documentation intentionally does not define the default
for TFO, so we can revert this later if it causes issues.
Also note that even on Linux you won't get TFO unless you change
sysctl net.ipv4.tcp_fastopen = 1 and use a server which supports it
(ie. nbdkit).
---
lib/handle.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/handle.c b/lib/handle.c
index f297b78c3..cf486e556 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -29,6 +29,7 @@
#include <netdb.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <netinet/tcp.h>
#include "ascii-ctype.h"
#include "internal.h"
@@ -69,7 +70,11 @@ nbd_create (void)
}
h->unique = 1;
+#ifdef TCP_FASTOPEN_CONNECT
+ h->fastopen = true;
+#else
h->fastopen = false;
+#endif
h->tls_verify_peer = true;
h->request_eh = true;
h->request_sr = true;
--
2.46.0