From: Baptiste Assmann Date: Wed, 2 Sep 2015 20:15:58 +0000 (+0200) Subject: BUG/MAJOR: dns: dns client resolution infinite loop X-Git-Tag: v1.6-dev5~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11c4e4eefbf5b0e080e2a7993948565781b9e767;p=thirdparty%2Fhaproxy.git BUG/MAJOR: dns: dns client resolution infinite loop Under certain circonstance (a configuration with many servers relying on DNS resolution and one of them triggering the replay of a request because of a timeout or invalid response to an ANY query), HAProxy could end up in an infinite loop over the currently supposed running DNS queries. This was caused because the FIFO list of running queries was improperly updated in snr_resolution_error_cb. The head of the list was removed instead of the resolution in error, when moving the resolution to the end of the list. In the mean time, a LIST_DEL statement is removed since useless. This action is already performed by the dns_reset_resolution function. --- diff --git a/src/server.c b/src/server.c index f3b0f16395..9bbed7979f 100644 --- a/src/server.c +++ b/src/server.c @@ -2088,7 +2088,6 @@ int snr_resolution_cb(struct dns_resolution *resolution, struct dns_nameserver * /* reset values */ dns_reset_resolution(resolution); - LIST_DEL(&resolution->list); dns_update_resolvers_timeout(nameserver->resolvers); snr_update_srv_status(s); @@ -2149,7 +2148,7 @@ int snr_resolution_error_cb(struct dns_resolution *resolution, int error_code) */ if (dns_check_resolution_queue(resolvers) > 1) { /* second resolution becomes first one */ - LIST_DEL(&resolvers->curr_resolution); + LIST_DEL(&resolution->list); /* ex first resolution goes to the end of the queue */ LIST_ADDQ(&resolvers->curr_resolution, &resolution->list); }