uid_t system_filter_uid = (uid_t)-1;
blob tcp_fastopen_nodata = { .data = NULL, .len = 0 };
-int tcp_out_fastopen = 0;
+tfo_state_t tcp_out_fastopen = TFO_NOT_USED;
#ifdef USE_TCP_WRAPPERS
uschar *tcp_wrappers_daemon_name = US TCP_WRAPPERS_DAEMON_NAME;
#endif
extern blob tcp_fastopen_nodata; /* for zero-data TFO connect requests */
extern BOOL tcp_nodelay; /* Controls TCP_NODELAY on daemon */
-extern int tcp_out_fastopen; /* 0: no 1: conn used 2: useful */
+extern tfo_state_t tcp_out_fastopen; /* 0: no 1: conn used 2: useful */
#ifdef USE_TCP_WRAPPERS
extern uschar *tcp_wrappers_daemon_name; /* tcpwrappers daemon lookup name */
#endif
debug_printf("non-TFO mode connection attempt to %s, %lu data\n",
address, (unsigned long)fastopen_blob->len);
/*XXX also seen on successful TFO, sigh */
- tcp_out_fastopen = fastopen_blob->len > 0 ? 2 : 1;
+ tcp_out_fastopen = fastopen_blob->len > 0 ? TFO_USED : TFO_ATTEMPTED;
}
else if (errno == EINPROGRESS) /* expected if we had no cookie for peer */
/* seen for no-data, proper TFO option, both cookie-request and with-cookie cases */
fastopen_blob->len > 0 ? "with" : "no");
if (!fastopen_blob->data)
{
- tcp_out_fastopen = 1; /* we tried; unknown if useful yet */
+ tcp_out_fastopen = TFO_ATTEMPTED; /* we tried; unknown if useful yet */
rc = 0;
}
else
'# echo -n "00000000-00000000-00000000-0000000" >/proc/sys/net/ipv4/tcp_fastopen_key'
The kernel seems to be counting unack'd packets. */
- case 1:
+ case TFO_ATTEMPTED:
if (tinfo.tcpi_unacked > 1)
{
DEBUG(D_transport|D_v)
debug_printf("TCP_FASTOPEN tcpi_unacked %d\n", tinfo.tcpi_unacked);
- tcp_out_fastopen = 2;
+ tcp_out_fastopen = TFO_USED;
}
break;
/* If there was data-on-SYN but we had to retrasnmit it, declare no TFO */
- case 2:
+ case TFO_USED:
if (!(tinfo.tcpi_options & TCPI_OPT_SYN_DATA))
{
DEBUG(D_transport|D_v) debug_printf("TFO: had to retransmit\n");
- tcp_out_fastopen = 0;
+ tcp_out_fastopen = TFO_NOT_USED;
}
break;
#endif
CHUNKING_ACTIVE,
CHUNKING_LAST} chunking_state_t;
+typedef enum { TFO_NOT_USED = 0,
+ TFO_ATTEMPTED,
+ TFO_USED } tfo_state_t;
+
/* Structure for holding information about a host for use mainly by routers,
but also used when checking lists of hosts and when transporting. Looking up
host addresses is done using this structure. */
BOOL no_flush;
uschar * rcpt_addr;
- if (tcp_out_fastopen && !f.tcp_out_fastopen_logged)
+ if (tcp_out_fastopen != TFO_NOT_USED && !f.tcp_out_fastopen_logged)
{
setflag(addr, af_tcp_fastopen_conn);
- if (tcp_out_fastopen > 1) setflag(addr, af_tcp_fastopen);
+ if (tcp_out_fastopen >= TFO_USED) setflag(addr, af_tcp_fastopen);
}
addr->dsn_aware = sx->peer_offered & OPTION_DSN