MINOR: dns: enable caching of responses for server set by a SRV record

The function srv_set_fqdn() is used to update a server's fqdn and set
accordingly its DNS resolution.
Current implementation prevents a server whose update is triggered by a
SRV record from being linked to an existing resolution in the cache (if
applicable).
This patch aims at fixing this.
This commit is contained in:
Baptiste Assmann 2017-08-14 16:35:45 +02:00 committed by Willy Tarreau
parent 7d2a12662b
commit 6fb8192b28

View File

@ -4133,10 +4133,15 @@ int srv_set_fqdn(struct server *srv, const char *hostname)
/* first, we need to unlink our server from its current resolution */ /* first, we need to unlink our server from its current resolution */
srv_free_from_resolution(srv); srv_free_from_resolution(srv);
} else { } else {
resolution = srv->resolution; /* this server's fqdn has been set by a SRV record */
resolution = dns_resolution_list_get(srv->resolvers, trash.str, srv->dns_requester->prefered_query_type);
srv_free_from_resolution(srv);
srv->resolution = resolution;
if (resolution->hostname_dn == NULL) {
resolution->last_resolution = now_ms; resolution->last_resolution = now_ms;
did_set_reso = 1; did_set_reso = 1;
} }
}
/* now we update server's parameters */ /* now we update server's parameters */
free(srv->hostname); free(srv->hostname);