From a8c6db8d2d97629b2734c1d2be0860b6b11e5709 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 6 Jul 2017 18:46:47 +0200 Subject: [PATCH] MINOR: dns: Cache previous DNS answers. As DNS servers may not return all IPs in one answer, we want to cache the previous entries. Those entries are removed when considered obsolete, which happens when the IP hasn't been returned by the DNS server for a time defined in the "hold obsolete" parameter of the resolver section. The default is 30s. --- doc/configuration.txt | 7 +- include/proto/server.h | 2 +- include/types/dns.h | 9 +- src/cfgparse.c | 5 +- src/dns.c | 247 +++++++++++++++++++++++------------------ src/server.c | 28 +++-- 6 files changed, 175 insertions(+), 123 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index bfeb3ce0eb..f467438756 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -11693,6 +11693,10 @@ For example, with 2 name servers configured in a resolvers section: - first response is truncated and second one is a NX Domain, then HAProxy stops resolution. +As a DNS server may not answer all the IPs in one DNS request, haproxy keeps +a cache of previous answers, an answer will be considered obsolete after +"hold obsolete" seconds without the IP returned. + resolvers Creates a new name server list labelled @@ -11709,7 +11713,7 @@ hold Defines during which the last name resolution should be kept based on last resolution : last name resolution status. Acceptable values are "nx", - "other", "refused", "timeout", "valid". + "other", "refused", "timeout", "valid", "obsolete". : interval between two successive name resolution when the last answer was in . It follows the HAProxy time format. is in milliseconds by default. @@ -11756,6 +11760,7 @@ timeout