]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: dns: server set by SRV records stay in "no resolution" status
authorBaptiste Assmann <bedis9@gmail.com>
Mon, 14 Aug 2017 08:37:46 +0000 (10:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 09:34:49 +0000 (11:34 +0200)
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.

include/proto/server.h
src/dns.c
src/server.c

index d35a9c1c8a184812c50826b69bf495c93f74e4aa..666377028dd7530bb6a8d8d3eb302e5a5dceb0da 100644 (file)
@@ -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)
index d46160fcf722eeffc092402162b92445530987e7..c91d4237be180278a4f8f833c92925ea1496f1f7 100644 (file)
--- 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);
                                                                }
                                                        }
                                                }
index caf84c6ae0aacfb280a140d9fa4522739f9f4b7f..917ed09a38fc17b6a4cb1178b1faf24c07c7c383 100644 (file)
@@ -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;