From 1ec9077f8678dcf13ef89b57e8afccbf63e4e140 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 10 Mar 2021 15:34:52 +0100 Subject: [PATCH] BUG/MEDIUM: resolvers: Don't set an address-less server as UP when a server status is updated based on a SRV item, it is always set to UP, regardless it has an IP address defined or not. For instance, if only a SRV item is received, with no additional record, only the server hostname is defined. We must wait to have an IP address to set the server as UP. This patch must be backported as far as 2.2. (cherry picked from commit ab177ac1f31b5c6c2e4f7d023923dd668cce3076) Signed-off-by: Christopher Faulet --- src/dns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dns.c b/src/dns.c index 06b4d80..cc3b68f 100644 --- a/src/dns.c +++ b/src/dns.c @@ -709,8 +709,8 @@ static void dns_check_dns_response(struct dns_resolution *res) send_log(srv->proxy, LOG_NOTICE, "%s", msg); } - /* now we have an IP address associated to this server, we can update its status */ - snr_update_srv_status(srv, 0); + /* Update the server status */ + snr_update_srv_status(srv, (srv->addr.ss_family != AF_INET && srv->addr.ss_family != AF_INET6)); srv->svc_port = item->port; srv->flags &= ~SRV_F_MAPPORTS; -- 1.7.10.4