BUG/MINOR: tcp-check: use the server's service port as a fallback

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
This commit is contained in:
Baptiste Assmann 2018-03-19 12:22:41 +01:00 committed by Willy Tarreau
parent 248f1173f2
commit 2f3a56b4ff

View 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);