]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: dns: timeout resolve not applied for valid resolutions
authorBaptiste Assmann <bedis9@gmail.com>
Thu, 7 Nov 2019 10:02:18 +0000 (11:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Nov 2019 17:50:07 +0000 (18:50 +0100)
Documentation states that the interval between 2 DNS resolution is
driven by "timeout resolve <time>" directive.
From a code point of view, this was applied unless the latest status of
the resolution was VALID. In such case, "hold valid" was enforce.
This is a bug, because "hold" timers are not here to drive how often we
want to trigger a DNS resolution, but more how long we want to keep an
information if the status of the resolution itself as changed.
This avoid flapping and prevent shutting down an entire backend when a
DNS server is not answering.

This issue was reported by hamshiva in github issue #345.

Backport status: 1.8

src/dns.c

index 00012896065f16548f7e502a077e23f1651766fb..5f9e7eae528a308bf8ae1d9dd08eae01ca886a75 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -150,10 +150,7 @@ static inline uint16_t dns_rnd16(void)
 
 static inline int dns_resolution_timeout(struct dns_resolution *res)
 {
-       switch (res->status) {
-               case RSLV_STATUS_VALID: return res->resolvers->hold.valid;
-               default:                return res->resolvers->timeout.resolve;
-       }
+       return res->resolvers->timeout.resolve;
 }
 
 /* Updates a resolvers' task timeout for next wake up and queue it */