git://git.exim.org
/
users
/
jgh
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae8f902
)
TFO: use enum for client status
author
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 6 Oct 2018 14:32:14 +0000
(15:32 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 6 Oct 2018 14:32:14 +0000
(15:32 +0100)
src/src/globals.c
patch
|
blob
|
history
src/src/globals.h
patch
|
blob
|
history
src/src/ip.c
patch
|
blob
|
history
src/src/smtp_out.c
patch
|
blob
|
history
src/src/structs.h
patch
|
blob
|
history
src/src/transports/smtp.c
patch
|
blob
|
history
diff --git
a/src/src/globals.c
b/src/src/globals.c
index cdf00e8107225674fb98109eeda8c268fe146a2c..fdeaebd642104eb65fa3c129b340a957d763da2c 100644
(file)
--- a/
src/src/globals.c
+++ b/
src/src/globals.c
@@
-1519,7
+1519,7
@@
gid_t system_filter_gid = 0;
uid_t system_filter_uid = (uid_t)-1;
blob tcp_fastopen_nodata = { .data = NULL, .len = 0 };
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
#ifdef USE_TCP_WRAPPERS
uschar *tcp_wrappers_daemon_name = US TCP_WRAPPERS_DAEMON_NAME;
#endif
diff --git
a/src/src/globals.h
b/src/src/globals.h
index bdf03606e99361d0ceac92a46465cf6bc07c16cf..de0a7bab81f178a9db33dd487f5dab97226e979d 100644
(file)
--- a/
src/src/globals.h
+++ b/
src/src/globals.h
@@
-988,7
+988,7
@@
extern BOOL system_filter_uid_set; /* TRUE if uid set */
extern blob tcp_fastopen_nodata; /* for zero-data TFO connect requests */
extern BOOL tcp_nodelay; /* Controls TCP_NODELAY on daemon */
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
#ifdef USE_TCP_WRAPPERS
extern uschar *tcp_wrappers_daemon_name; /* tcpwrappers daemon lookup name */
#endif
diff --git
a/src/src/ip.c
b/src/src/ip.c
index 633e0c2f9e041026d5e8e4d218168852f60af5f6..ef133bf9f0bd780445b25a6368bfd2aaad90b226 100644
(file)
--- a/
src/src/ip.c
+++ b/
src/src/ip.c
@@
-267,7
+267,7
@@
if (fastopen_blob && f.tcp_fastopen_ok)
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 */
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 */
}
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 */
@@
-280,7
+280,7
@@
if (fastopen_blob && f.tcp_fastopen_ok)
fastopen_blob->len > 0 ? "with" : "no");
if (!fastopen_blob->data)
{
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
rc = 0;
}
else
diff --git
a/src/src/smtp_out.c
b/src/src/smtp_out.c
index 62d4c7333bb26bd6f4ae9543605cf93ea5d50c54..f02863a5410bda5867577a3a25190d3b8ca117c9 100644
(file)
--- a/
src/src/smtp_out.c
+++ b/
src/src/smtp_out.c
@@
-163,12
+163,12
@@
if (getsockopt(sock, IPPROTO_TCP, TCP_INFO, &tinfo, &len) == 0)
'# echo -n "00000000-00000000-00000000-0000000" >/proc/sys/net/ipv4/tcp_fastopen_key'
The kernel seems to be counting unack'd packets. */
'# 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);
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;
}
break;
@@
-178,11
+178,11
@@
if (getsockopt(sock, IPPROTO_TCP, TCP_INFO, &tinfo, &len) == 0)
/* If there was data-on-SYN but we had to retrasnmit it, declare no TFO */
/* 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");
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
}
break;
#endif
diff --git
a/src/src/structs.h
b/src/src/structs.h
index b1df408be9669a30dfd7ac705ab2af7df5084005..1ac455ca5789624568e70173a379c2d3ef6a8cc7 100644
(file)
--- a/
src/src/structs.h
+++ b/
src/src/structs.h
@@
-65,6
+65,10
@@
typedef enum { CHUNKING_NOT_OFFERED = -1,
CHUNKING_ACTIVE,
CHUNKING_LAST} chunking_state_t;
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. */
/* 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. */
diff --git
a/src/src/transports/smtp.c
b/src/src/transports/smtp.c
index f3e09ada7c91cd69c1875fbc6b5e50e9ee35d439..fba5a7ce82f64935dc76c83f75d8d8f57bb33603 100644
(file)
--- a/
src/src/transports/smtp.c
+++ b/
src/src/transports/smtp.c
@@
-2680,10
+2680,10
@@
for (addr = sx->first_addr, address_count = 0;
BOOL no_flush;
uschar * rcpt_addr;
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);
{
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
}
addr->dsn_aware = sx->peer_offered & OPTION_DSN