]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: do not check for CO_FL_SOCK_RD_SH too early
authorWilly Tarreau <w@1wt.eu>
Thu, 23 Jan 2020 17:05:18 +0000 (18:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Jan 2020 17:05:18 +0000 (18:05 +0100)
The handshake functions dedicated to proxy proto, netscaler and
socks4 all check for this flag before proceeding. This is wrong,
they must not do and instead perform the call to recv() then
report the close. The reason for this is that the current
construct managed to lose the CO_ER_CIP_EMPTY error code in case
the connection was already shut, thus causing a race condition
with some errors being reported correctly or as unknown depending
on the timing.

src/connection.c

index dcecf1409619cc50b6fef5cb79331b7ee3836e3a..83790a9d9aa4883ef21b60a8bf527f02b113c912 100644 (file)
@@ -493,10 +493,6 @@ int conn_recv_proxy(struct connection *conn, int flag)
        int tlv_offset = 0;
        int ret;
 
-       /* we might have been called just after an asynchronous shutr */
-       if (conn->flags & CO_FL_SOCK_RD_SH)
-               goto fail;
-
        if (!conn_ctrl_ready(conn))
                goto fail;
 
@@ -825,10 +821,6 @@ int conn_recv_netscaler_cip(struct connection *conn, int flag)
        uint8_t ip_ver;
        int ret;
 
-       /* we might have been called just after an asynchronous shutr */
-       if (conn->flags & CO_FL_SOCK_RD_SH)
-               goto fail;
-
        if (!conn_ctrl_ready(conn))
                goto fail;
 
@@ -1094,10 +1086,6 @@ int conn_recv_socks4_proxy_response(struct connection *conn)
        char line[SOCKS4_HS_RSP_LEN];
        int ret;
 
-       /* we might have been called just after an asynchronous shutr */
-       if (conn->flags & CO_FL_SOCK_RD_SH)
-               goto fail;
-
        if (!conn_ctrl_ready(conn))
                goto fail;