From: Christopher Faulet Date: Fri, 5 Jun 2026 08:50:32 +0000 (+0200) Subject: BUG/MINOR: tcpcheck: Override external check if healthcheck section is set X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b227ad2dc7cdc85017e229388f3a0c42503ff47b;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/check.c b/src/check.c index 1e166322a..3864e7c77 100644 --- a/src/check.c +++ b/src/check.c @@ -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); diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 4d01f2f3b..1a8d8bf23 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -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); }