::arg().setSwitch("8bit-dns", "Allow 8bit dns queries")="no";
::arg().set("xfr-max-received-mbytes", "Maximum number of megabytes received from an incoming XFR")="100";
+
+ ::arg().set("tcp-fast-open", "Enable TCP Fast Open support on the listening sockets, using the supplied numerical value as the queue size")="0";
}
static time_t s_start=time(0);
#include <cstring>
#include <cstdlib>
#include <sys/types.h>
+#include <netinet/tcp.h>
#include <iostream>
#include <string>
#include "tcpreceiver.hh"
L<<Logger::Error<<"Setsockopt failed"<<endl;
exit(1);
}
-
+
+ if (::arg().asNum("tcp-fast-open") > 0) {
+#ifdef TCP_FASTOPEN
+ int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
+ if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
+ L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+ }
+#else
+ L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
+#endif
+ }
+
if( ::arg().mustDo("non-local-bind") )
Utility::setBindAny(AF_INET, s);
L<<Logger::Error<<"Setsockopt failed"<<endl;
exit(1);
}
+
+ if (::arg().asNum("tcp-fast-open") > 0) {
+#ifdef TCP_FASTOPEN
+ int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
+ if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
+ L<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+ }
+#else
+ L<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
+#endif
+ }
+
if( ::arg().mustDo("non-local-bind") )
Utility::setBindAny(AF_INET6, s);
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) {