From 0735b17ec9a70b1433c65456b7b6fb24222d394a Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 17 Mar 2017 15:42:38 +0100 Subject: [PATCH] rec: Add server-side TCP Fast Open support --- docs/markdown/recursor/settings.md | 8 ++++++++ pdns/pdns_recursor.cc | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/markdown/recursor/settings.md b/docs/markdown/recursor/settings.md index cb71da62a..c79cfbc93 100644 --- a/docs/markdown/recursor/settings.md +++ b/docs/markdown/recursor/settings.md @@ -866,6 +866,14 @@ Size of the stack per thread. Number of entries in the remotes ringbuffer, which keeps statistics on who is querying your server. Can be read out using `rec_control top-remotes`. +## `tcp-fast-open` +* Integer +* Default: 0 (Disabled) +* Available since: 4.1 + +Enable TCP Fast Open support, if available, on the listening sockets. The numerical +value supplied is used as the queue size, 0 meaning disabled. + ## `threads` * Integer * Default: 2 diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index d038455b5..bb4db079b 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1844,6 +1844,17 @@ static void makeTCPServerSockets() } #endif + if (::arg().asNum("tcp-fast-open") > 0) { +#ifdef TCP_FASTOPEN + int fastOpenQueueSize = ::arg().asNum("tcp-fast-open"); + if (setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) { + L<