]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: tcp-check: use the server's service port as a fallback
authorBaptiste Assmann <bedis9@gmail.com>
Mon, 19 Mar 2018 11:22:41 +0000 (12:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2018 12:55:55 +0000 (13:55 +0100)
When running tcp-check scripts, one must ensure we can establish a tcp
connection first.
When doing this action, HAProxy needs a TCP port configured either on
the server or on the check itself or on the connect rule itself.
For some reasons, the connect code did not evaluate the service port on
the server structure...

this patch fixes this error.

Backport status: 1.8

src/checks.c

index 8ca2089546bd4aa8f4f68899ff27a2ac8ddff939..cae2e3e3fa729a4adc74644436a27aeea213634a 100644 (file)
@@ -2757,6 +2757,8 @@ static int tcpcheck_main(struct check *check)
                                set_host_port(&conn->addr.to, check->current_step->port);
                        else if (check->port)
                                set_host_port(&conn->addr.to, check->port);
+                       else if (s->svc_port)
+                               set_host_port(&conn->addr.to, s->svc_port);
 
                        if (check->current_step->conn_opts & TCPCHK_OPT_SSL) {
                                xprt = xprt_get(XPRT_SSL);