mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-08 16:23:24 -04:00
BUG/MEDIUM: server/checks: Support healtcheck keyword on default-server lines
Some checks are pending
Contrib / admin/halog/ (push) Waiting to run
Contrib / dev/flags/ (push) Waiting to run
Contrib / dev/haring/ (push) Waiting to run
Contrib / dev/hpack/ (push) Waiting to run
Contrib / dev/poll/ (push) Waiting to run
FreeBSD / clang (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run
Some checks are pending
Contrib / admin/halog/ (push) Waiting to run
Contrib / dev/flags/ (push) Waiting to run
Contrib / dev/haring/ (push) Waiting to run
Contrib / dev/hpack/ (push) Waiting to run
Contrib / dev/poll/ (push) Waiting to run
FreeBSD / clang (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run
The healthcheck keyword could be parsed on default-server lines but not copied during server initialization, making it ineffective. But there is also a true issue by setting it on a default-server. The pseudo server used to parse the default-server line is not initialized via the new_server() function, as regular servers. So there is no tcpcheck information inherited from the proxy. We must take care of that when the "healthcheck" keyword is parsed to avoid crashes. This patch must be backported to 3.4.
This commit is contained in:
parent
3daf4498f3
commit
f7bc8246ee
2 changed files with 14 additions and 1 deletions
13
src/server.c
13
src/server.c
|
|
@ -2978,6 +2978,19 @@ void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl
|
|||
srv->check.alpn_len = src->check.alpn_len;
|
||||
}
|
||||
}
|
||||
if (src->check.tcpcheck && src->check.tcpcheck->healthcheck) {
|
||||
struct tcpcheck *tcpcheck = NULL;
|
||||
|
||||
tcpcheck = calloc(1, sizeof(*tcpcheck));
|
||||
if (tcpcheck) {
|
||||
LIST_INIT(&tcpcheck->preset_vars);
|
||||
tcpcheck->healthcheck = strdup(src->check.tcpcheck->healthcheck);
|
||||
if (tcpcheck->healthcheck == NULL)
|
||||
ha_free(&tcpcheck);
|
||||
}
|
||||
if (tcpcheck)
|
||||
srv->check.tcpcheck = tcpcheck;
|
||||
}
|
||||
|
||||
if (!(srv->flags & SRV_F_RHTTP))
|
||||
srv->check.reuse_pool = src->check.reuse_pool;
|
||||
|
|
|
|||
|
|
@ -5970,7 +5970,7 @@ static int srv_parse_healthcheck(char **args, int *cur_arg, struct proxy *curpx,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (srv->check.tcpcheck->healthcheck) {
|
||||
if (srv->check.tcpcheck && srv->check.tcpcheck->healthcheck) {
|
||||
/* a healthcheck section was already defined. Replace it */
|
||||
ha_free(&srv->check.tcpcheck->healthcheck);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue