1 From 1181ad3ea9d73908b0238702032eccaeb8834a1a Mon Sep 17 00:00:00 2001
2 From: Willy Tarreau <w@1wt.eu>
3 Date: Fri, 26 Apr 2013 11:43:56 +0200
4 Subject: [PATCH 2/2] BUG/MEDIUM: checks: disable TCP quickack when pure TCP
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Cyril Bonté reported an issue with some services when pure port probes are
11 used since 1.4.23, because of the RST which is sent and sometimes caught by
12 the checked service. The result is that the service detects an error and may
13 sometimes log this error or complain about it. This issue does not appear
14 when "option tcp-smart-connect" is set.
16 So we now perform exactly like 1.5 with port probes, which means that we set
17 the TCP quickack mode on the socket before connecting, so that the final ACK
18 is never sent. So the sequence is now a clean SYN-SYN/ACK-RST which never
19 wakes the application up and that only checks that the port is open.
21 src/checks.c | 7 ++++++-
22 1 file changed, 6 insertions(+), 1 deletion(-)
24 diff --git a/src/checks.c b/src/checks.c
25 index e586e4c..9813914 100644
28 @@ -1388,8 +1388,13 @@ struct task *process_chk(struct task *t)
29 /* disabling tcp quick ack now allows
30 * the request to leave the machine with
32 + * We also want to do this to perform a
33 + * SYN-SYN/ACK-RST sequence when raw TCP
34 + * checks are configured.
36 - if (s->proxy->options2 & PR_O2_SMARTCON)
37 + if ((s->proxy->options2 & PR_O2_SMARTCON) ||
38 + (!(s->proxy->options & (PR_O_HTTP_CHK|PR_O_SMTP_CHK)) &&
39 + !(s->proxy->options2 & (PR_O2_SSL3_CHK|PR_O2_MYSQL_CHK|PR_O2_LDAP_CHK))))
40 setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
42 if ((connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != -1) || (errno == EINPROGRESS)) {