From: Baptiste Assmann Date: Mon, 14 Aug 2017 08:37:46 +0000 (+0200) Subject: BUG/MINOR: dns: server set by SRV records stay in "no resolution" status X-Git-Tag: v1.8-dev3~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=747359eeca03716558063ddb3e7a9ba8627282e3;p=thirdparty%2Fhaproxy.git BUG/MINOR: dns: server set by SRV records stay in "no resolution" status This patch fixes a bug where some servers managed by SRV record query types never ever recover from a "no resolution" status. The problem is due to a wrong function called when breaking the server/resolution (A/AAAA) relationship: this is performed when a server's SRV record disappear from the SRV response. --- diff --git a/include/proto/server.h b/include/proto/server.h index d35a9c1c8a..666377028d 100644 --- a/include/proto/server.h +++ b/include/proto/server.h @@ -57,6 +57,7 @@ const char *update_server_fqdn(struct server *server, const char *fqdn, const ch int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *nameserver); int snr_resolution_error_cb(struct dns_requester *requester, int error_code); struct server *snr_check_ip_callback(struct server *srv, void *ip, unsigned char *ip_family); +void srv_free_from_resolution(struct server *srv); /* increase the number of cumulated connections on the designated server */ static void inline srv_inc_sess_ctr(struct server *s) diff --git a/src/dns.c b/src/dns.c index d46160fcf7..c91d4237be 100644 --- a/src/dns.c +++ b/src/dns.c @@ -564,10 +564,7 @@ void dns_resolve_recv(struct dgram_conn *dgram) srv->hostname_dn_len = 0; free(srv->hostname_dn); srv->hostname_dn = NULL; - dns_resolution_free(srv->resolvers, srv->resolution); - srv->resolution = dns_resolution_list_get(srv->resolvers, NULL, srv->dns_requester->prefered_query_type); - if (resolution == srv->resolution) - removed_reso = 1; + srv_free_from_resolution(srv); } } } diff --git a/src/server.c b/src/server.c index caf84c6ae0..917ed09a38 100644 --- a/src/server.c +++ b/src/server.c @@ -1692,7 +1692,7 @@ static int srv_prepare_for_resolution(struct server *srv, const char *hostname) * - move resolution's hostname_dn and hostname_dn_len to the next requester * available (when applied) */ -static void srv_free_from_resolution(struct server *srv) +void srv_free_from_resolution(struct server *srv) { struct dns_requester *requester; int count;