From: Willy Tarreau Date: Tue, 3 Dec 2013 10:11:34 +0000 (+0100) Subject: BUG/MEDIUM: checks: fix health check regression causing them to depend on declaration... X-Git-Tag: v1.5-dev20~173 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f075e98fb9076d32e4fc433d366822752693638;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: checks: fix health check regression causing them to depend on declaration order Since commit 4a74143 (MEDIUM: Paramatise functions over the check of a server), the check type is inherited from the current proxy's check type at the moment where the server is declared instead of when reviewing server configs. This causes an issue where a health check is disabled when the server is declared before the checks. In fact the server will inherit the last known check type declared before the "server" line : backend foo # this server is not checked at all server s1 1.1.1.1:80 check option tcpchk # this server is tcp-checked : server s2 1.1.1.2:80 check option httpchk # this server is http-checked : server s3 1.1.1.3:80 check The fix consists in assigning the check type during the config review phase where the config is stable. No backport is nedeed. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 7087c65c3a..e267de8c83 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4950,9 +4950,8 @@ stats_error_parsing: goto out; } - ret = init_check(&newsrv->check, - curproxy->options2 & PR_O2_CHK_ANY, - file, linenum); + /* note: check type will be set during the config review phase */ + ret = init_check(&newsrv->check, 0, file, linenum); if (ret) { err_code |= ret; goto out; @@ -6812,6 +6811,9 @@ out_uri_auth_compat: cfgerr += ssl_sock_prepare_srv_ctx(newsrv, curproxy); #endif /* USE_OPENSSL */ + /* set the check type on the server */ + newsrv->check.type = curproxy->options2 & PR_O2_CHK_ANY; + if (newsrv->trackit) { struct proxy *px; struct server *srv;