]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: resolvers: Don't set an address-less server as UP
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 10 Mar 2021 14:34:52 +0000 (15:34 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 15:43:37 +0000 (16:43 +0100)
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.

src/resolvers.c

index 96431f47e670fafabebdb0d9be4d241b337fcb52..859189d1a8081f7424cf3bc0865c0a6c706ca423 100644 (file)
@@ -659,8 +659,8 @@ static void resolv_check_response(struct resolv_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;