From: Christopher Faulet Date: Tue, 23 Feb 2021 11:33:17 +0000 (+0100) Subject: BUG/MEDIUM: resolvers: Reset address for unresolved servers X-Git-Tag: v2.4-dev10~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d127ffa9f;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: resolvers: Reset address for unresolved servers If the DNS resolution failed for a server, its ip address must be removed. Otherwise, the server is stopped but keeps its ip. This may be confusing when the servers state are retrieved on the CLI and it may lead to undefined behavior if HAproxy is configured to load its servers state from a file. This patch should be backported as far as 2.0. --- diff --git a/src/server.c b/src/server.c index bb6a57b09b..bc38b7704b 100644 --- a/src/server.c +++ b/src/server.c @@ -4162,6 +4162,7 @@ int snr_resolution_error_cb(struct resolv_requester *requester, int error_code) return 1; HA_SPIN_LOCK(SERVER_LOCK, &s->lock); snr_update_srv_status(s, 0); + memset(&s->addr, 0, sizeof(s->addr)); HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock); return 1; }