X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdaemon.c;h=a852192ead58fa832e8080e5667581d6ae5cb228;hb=de6f74f297d040a34746bc8e1829ad4b867441c9;hp=ee9ddcc4f2b6ec8127e182318c96ce8a6d35eb08;hpb=590faf89a2dd33a5f97f8e685efd019ac9c96e1e;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/daemon.c b/src/src/daemon.c index ee9ddcc4f..a852192ea 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -106,10 +106,10 @@ Returns: nothing static void never_error(uschar *log_msg, uschar *smtp_msg, int was_errno) { -uschar *emsg = (was_errno <= 0)? US"" : - string_sprintf(": %s", strerror(was_errno)); +uschar *emsg = was_errno <= 0 + ? US"" : string_sprintf(": %s", strerror(was_errno)); log_write(0, LOG_MAIN|LOG_PANIC, "%s%s", log_msg, emsg); -if (smtp_out != NULL) smtp_printf("421 %s\r\n", FALSE, smtp_msg); +if (smtp_out) smtp_printf("421 %s\r\n", FALSE, smtp_msg); } @@ -202,11 +202,11 @@ memory is reclaimed. */ whofrom = string_append(NULL, 3, "[", sender_host_address, "]"); if (LOGGING(incoming_port)) - whofrom = string_append(whofrom, 2, ":", string_sprintf("%d", sender_host_port)); + whofrom = string_fmt_append(whofrom, ":%d", sender_host_port); if (LOGGING(incoming_interface)) - whofrom = string_append(whofrom, 4, " I=[", - interface_address, "]:", string_sprintf("%d", interface_port)); + whofrom = string_fmt_append(whofrom, " I=[%s]:%d", + interface_address, interface_port); (void) string_from_gstring(whofrom); /* Terminate the newly-built string */ @@ -1458,7 +1458,7 @@ if (f.daemon_listen && !f.inetd_wait_mode) else debug_printf("listening on %s port %d\n", ipa->address, ipa->port); -#ifdef TCP_FASTOPEN +#if defined(TCP_FASTOPEN) && !defined(__APPLE__) if ( f.tcp_fastopen_ok && setsockopt(listen_sockets[sk], IPPROTO_TCP, TCP_FASTOPEN, &smtp_connect_backlog, sizeof(smtp_connect_backlog))) @@ -1471,7 +1471,19 @@ if (f.daemon_listen && !f.inetd_wait_mode) /* Start listening on the bound socket, establishing the maximum backlog of connections that is allowed. On success, continue to the next address. */ - if (listen(listen_sockets[sk], smtp_connect_backlog) >= 0) continue; + if (listen(listen_sockets[sk], smtp_connect_backlog) >= 0) + { +#if defined(TCP_FASTOPEN) && defined(__APPLE__) + if ( f.tcp_fastopen_ok + && setsockopt(listen_sockets[sk], IPPROTO_TCP, TCP_FASTOPEN, + &on, sizeof(on))) + { + DEBUG(D_any) debug_printf("setsockopt FASTOPEN: %s\n", strerror(errno)); + f.tcp_fastopen_ok = FALSE; + } +#endif + continue; + } /* Listening has failed. In an IPv6 environment, as for bind(), if listen() fails with the error EADDRINUSE and we are doing IPv4 wildcard listening