From: Christopher Faulet Date: Fri, 12 Mar 2021 08:06:07 +0000 (+0100) Subject: BUG/MINOR: tcpcheck: Update .health threshold of agent inside an agent-check X-Git-Tag: v2.4-dev12~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24ec9434271345857b42cc5bd9c6b497ab01a7e4;p=thirdparty%2Fhaproxy.git BUG/MINOR: tcpcheck: Update .health threshold of agent inside an agent-check If an agent-check is configured for a server, When the response is parsed, the .health threshold of the agent must be updated on up/down/stopped/fail command and not the threshold of the health-check. Otherwise, the agent-check will compete with the health-check and may mark a DOWN server as UP. This patch should fix the issue #1176. It must be backported as far as 2.2. --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 37d3b38ca1..535c82c89b 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -836,22 +836,22 @@ enum tcpcheck_eval_ret tcpcheck_agent_expect_reply(struct check *check, struct t /* first, health statuses */ if (strcasecmp(cmd, "up") == 0) { - check->server->check.health = check->server->check.rise + check->server->check.fall - 1; + check->health = check->rise + check->fall - 1; status = HCHK_STATUS_L7OKD; hs = cmd; } else if (strcasecmp(cmd, "down") == 0) { - check->server->check.health = 0; + check->health = 0; status = HCHK_STATUS_L7STS; hs = cmd; } else if (strcasecmp(cmd, "stopped") == 0) { - check->server->check.health = 0; + check->health = 0; status = HCHK_STATUS_L7STS; hs = cmd; } else if (strcasecmp(cmd, "fail") == 0) { - check->server->check.health = 0; + check->health = 0; status = HCHK_STATUS_L7STS; hs = cmd; }