packages/net/haproxy/patches/001-BUG-MEDIUM-checks-Only-attempt-to-do-handshakes-if-the-connection-is-ready.patch
Christian Lachner fdaa55a918 haproxy: Update HAProxy to v2.1.2
- Major version jump from v2.0 to v2.1
- Update haproxy download URL and hash
- Add new patches (see https://www.haproxy.org/bugs/bugs-2.1.2.html)
- Stop building LUA 5.3 in the haproxy build-process and use liblua5.3 as a dependency instead

Signed-off-by: Christian Lachner <gladiac@gmail.com>
2020-02-03 07:54:31 +01:00

46 lines
2 KiB
Diff

commit 68265b3993d68cc7af5fc0f70bcfa35d52ffa99d
Author: Olivier Houchard <cognet@ci0.org>
Date: Mon Dec 30 15:13:42 2019 +0100
BUG/MEDIUM: checks: Only attempt to do handshakes if the connection is ready.
When creating a new check connection, only attempt to add an handshake
connection if the connection has fully been initialized. It can not be the
case if a DNS resolution is still pending, and thus we don't yet have the
address for the server, as the handshake code assumes the connection is fully
initialized and would otherwise crash.
This is not ideal, the check shouldn't probably run until we have an address,
as it leads to check failures with "Socket error".
While I'm there, also add an xprt handshake if we're using socks4, otherwise
checks wouldn't be able to use socks4 properly.
This should fix github issue #430
This should be backported to 2.0 and 2.1.
(cherry picked from commit 37d7897aafc412f3c4a4a68a1dccbd6b5d6cb180)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/checks.c b/src/checks.c
index 083aebbe0..2b7fc09c6 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1715,6 +1715,9 @@ static int connect_conn_chk(struct task *t)
if (s->check.send_proxy && !(check->state & CHK_ST_AGENT)) {
conn->send_proxy_ofs = 1;
conn->flags |= CO_FL_SEND_PROXY;
+ }
+ if (conn->flags & (CO_FL_SEND_PROXY | CO_FL_SOCKS4) &&
+ conn_ctrl_ready(conn)) {
if (xprt_add_hs(conn) < 0)
ret = SF_ERR_RESOURCE;
}
@@ -2960,7 +2963,8 @@ static int tcpcheck_main(struct check *check)
if (proto && proto->connect)
ret = proto->connect(conn,
CONNECT_HAS_DATA /* I/O polling is always needed */ | (next && next->action == TCPCHK_ACT_EXPECT) ? 0 : CONNECT_DELACK_ALWAYS);
- if (check->current_step->conn_opts & TCPCHK_OPT_SEND_PROXY) {
+ if (conn_ctrl_ready(conn) &&
+ check->current_step->conn_opts & TCPCHK_OPT_SEND_PROXY) {
conn->send_proxy_ofs = 1;
conn->flags |= CO_FL_SEND_PROXY;
if (xprt_add_hs(conn) < 0)