From: Jeremy Harris Date: Sat, 23 Jan 2021 23:15:58 +0000 (+0000) Subject: TFO: cleanup the TCP pure ack of SMTP banner X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/8d7e00e408df4d92c37caabbfd68cdc75ebd2dfb?ds=sidebyside TFO: cleanup the TCP pure ack of SMTP banner --- diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index b1a25f70a..2a392e50f 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -349,14 +349,22 @@ else save_errno = errno; else if (early_data && !fastopen_blob && early_data->data && early_data->len) { + /* We had some early-data to send, but couldn't do TFO */ HDEBUG(D_transport|D_acl|D_v) debug_printf("sending %ld nonTFO early-data\n", (long)early_data->len); +#ifdef TCP_QUICKACK_notdef + (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off)); +#endif if (send(sock, early_data->data, early_data->len, 0) < 0) save_errno = errno; } -#ifdef TCP_QUICKACK - (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off)); +#ifdef TCP_QUICKACK_notdef + /* Under TFO (with openssl & pipe-conn; testcase 4069, as of + 5.10.8-100.fc32.x86_64) this seems to be inop. + Perhaps overwritten when we (client) go -> ESTABLISHED on seeing the 3rd-ACK? + For that case, added at smtp_reap_banner(). */ + (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off)); #endif } diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 0a6bfde18..30669d351 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -712,7 +712,17 @@ return count; static BOOL smtp_reap_banner(smtp_context * sx) { -BOOL good_response = smtp_read_response(sx, sx->buffer, sizeof(sx->buffer), +BOOL good_response; +#if defined(__linux__) && defined(TCP_QUICKACK) + { /* Hack to get QUICKACK disabled; has to be right after 3whs, and has to on->off */ + int sock = sx->cctx.sock; + struct pollfd p = {.fd = sock, .events = POLLOUT}; + int rc = poll(&p, 1, 1000); + (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &on, sizeof(on)); + (void) setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off)); + } +#endif +good_response = smtp_read_response(sx, sx->buffer, sizeof(sx->buffer), '2', (SOB sx->conn_args.ob)->command_timeout); #ifdef EXPERIMENTAL_DSN_INFO sx->smtp_greeting = string_copy(sx->buffer);