necessary for (some release of) USAGI Linux; other IP stacks fail at the
listen() stage instead. */
+#ifdef TCP_FASTOPEN
+ tcp_fastopen_ok = TRUE;
+#endif
for(;;)
{
uschar *msg, *addr;
#ifdef TCP_FASTOPEN
if (setsockopt(listen_sockets[sk], IPPROTO_TCP, TCP_FASTOPEN,
&smtp_connect_backlog, sizeof(smtp_connect_backlog)))
+ {
DEBUG(D_any) debug_printf("setsockopt FASTOPEN: %s\n", strerror(errno));
+ tcp_fastopen_ok = FALSE;
+ }
#endif
/* Start listening on the bound socket, establishing the maximum backlog of
BOOL system_filter_uid_set = FALSE;
BOOL system_filtering = FALSE;
+BOOL tcp_fastopen_ok = FALSE;
BOOL tcp_nodelay = TRUE;
#ifdef USE_TCP_WRAPPERS
uschar *tcp_wrappers_daemon_name = US TCP_WRAPPERS_DAEMON_NAME;
extern BOOL system_filter_uid_set; /* TRUE if uid set */
extern BOOL system_filtering; /* TRUE when running system filter */
+extern BOOL tcp_fastopen_ok; /* appears to be supported by kernel */
extern BOOL tcp_nodelay; /* Controls TCP_NODELAY on daemon */
#ifdef USE_TCP_WRAPPERS
extern uschar *tcp_wrappers_daemon_name; /* tcpwrappers daemon lookup name */
host_item shost;
host_item *h;
int af = 0, fd, fd4 = -1, fd6 = -1;
+BOOL fastopen = tcp_fastopen_ok && type == SOCK_STREAM;
shost.next = NULL;
shost.address = NULL;
}
for(port = portlo; port <= porthi; port++)
- if (ip_connect(fd, af, h->address, port, timeout, type == SOCK_STREAM) == 0)
+ if (ip_connect(fd, af, h->address, port, timeout, fastopen) == 0)
{
if (fd != fd6) close(fd6);
if (fd != fd4) close(fd4);