BUG/MINOR: tcpcheck: Override external check if healthcheck section is set

When an external check was configured at the proxy level, the healthcheck
section set on a server was not considered. The main reason was that the
check type of the server was always inherited for the proxy one.

To fix the issue, when a healthcheck section is set on a server line, the
check type for the server is forced to TCPCHK.

This patch must be backported to 3.4.
This commit is contained in:
Christopher Faulet 2026-06-05 10:50:32 +02:00
parent 07deafa104
commit b227ad2dc7
2 changed files with 3 additions and 3 deletions

View file

@ -1802,7 +1802,7 @@ int init_srv_check(struct server *srv)
if (!srv->do_check || !(srv->proxy->cap & PR_CAP_BE))
goto out;
if ((srv->proxy->options2 & PR_O2_CHK_ANY) != PR_O2_TCPCHK_CHK)
if (!srv->check.type && (srv->proxy->options2 & PR_O2_CHK_ANY) != PR_O2_TCPCHK_CHK)
goto init;
check_type = srv->check.tcpcheck->rs->flags & TCPCHK_RULES_PROTO_CHK;
@ -1945,7 +1945,7 @@ int init_srv_check(struct server *srv)
}
init:
err = init_check(&srv->check, srv->proxy->options2 & PR_O2_CHK_ANY);
err = init_check(&srv->check, srv->check.type ? srv->check.type : (srv->proxy->options2 & PR_O2_CHK_ANY));
if (err) {
ha_alert("config: %s '%s': unable to init check for server '%s' (%s).\n",
proxy_type_str(srv->proxy), srv->proxy->id, srv->id, err);

View file

@ -4198,7 +4198,7 @@ int check_server_tcpcheck(struct server *srv)
}
srv->check.tcpcheck->rs = rs;
srv->check.tcpcheck->flags = rs->conf.flags;
srv->check.type = PR_O2_TCPCHK_CHK;
err_code = check_tcpcheck_ruleset(srv->proxy, rs);
}