summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-10-07 14:36:52 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-10-07 14:36:52 +0100
commit6a69d109fb79fb19663137cf606557d663169373 (patch)
treed30f6a9aa117ad4b78abdb9067848dddc878de7f /src
parentd0eb2d4579a562f40f4c36b22d47c0225f61b667 (diff)
Fix identd connections on FreeBSD under TCP Fast Open
Diffstat (limited to 'src')
-rw-r--r--src/src/verify.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/src/verify.c b/src/src/verify.c
index ac5eb667b..5c093bf31 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -2702,10 +2702,24 @@ if (ip_connect(sock, host_af, sender_host_address, port,
sprintf(CS buffer, "%d , %d\r\n", sender_host_port, interface_port);
qlen = Ustrlen(buffer);
if (send(sock, buffer, qlen, 0) < 0)
- {
- DEBUG(D_ident) debug_printf("ident send failed: %s\n", strerror(errno));
- goto END_OFF;
- }
+ if (errno == ENOTCONN) /* seen for TFO on FreeBSD */
+ {
+ struct timeval tv = { .tv_sec = 0, .tv_usec = 500*1000 };
+ fd_set s;
+
+ FD_ZERO(&s); FD_SET(sock, &s);
+ (void) select(sock+1, NULL, (SELECT_ARG2_TYPE *)&s, (SELECT_ARG2_TYPE *)&s, &tv);
+ if (send(sock, buffer, qlen, 0) < 0)
+ {
+ DEBUG(D_ident) debug_printf("ident re-send failed: %s\n", strerror(errno));
+ goto END_OFF;
+ }
+ }
+ else
+ {
+ DEBUG(D_ident) debug_printf("ident send failed: %s\n", strerror(errno));
+ goto END_OFF;
+ }
/* Read a response line. We put it into the rest of the buffer, using several
recv() calls if necessary. */