BUG/MEDIUM: resolvers: Skip DNS resolution at startup if SRV resolution is set
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 09:23:05 +0000 (10:23 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Mar 2021 08:51:55 +0000 (09:51 +0100)
commit558102698c296c4aaeb32d9add8bc54c817a3cd1
tree76436c78c1ffe552ba8b5e0f38f7802f8aeb5465
parent119ec5279df7241da25f2ffc1e43de4075717f35
BUG/MEDIUM: resolvers: Skip DNS resolution at startup if SRV resolution is set

At startup, if a SRV resolution is set for a server, no DNS resolution is
created. We must wait the first SRV resolution to know if it must be
triggered. It is important to do so for two reasons.

First, during a "classical" startup, a server based on a SRV resolution has
no hostname. Thus the created DNS resolution is useless. Best waiting the
first SRV resolution. It is not really a bug at this stage, it is just
useless.

Second, in the same situation, if the server state is loaded from a file,
its hosname will be set a bit later. Thus, if there is no additionnal record
for this server, because there is already a DNS resolution, it inhibits any
new DNS resolution. But there is no hostname attached to the existing DNS
resolution. So no resolution is performed at all for this server.

To avoid any problem, it is fairly easier to handle this special case during
startup. But this means we must be prepared to have no "resolv_requester"
field for a server at runtime.

This patch must be backported as far as 2.2.

(cherry picked from commit d83a6df5cde5f2e5417e9f995ab966ba01d17501)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/dns.c
src/server.c