MINOR: resolvers: shut the warning when "default" resolvers is implicit
Shut the connect() warning of resolvers_finalize_config() when the
configuration was not emitted manually.
This shuts the warning for the "default" resolvers which is created
automatically for the httpclient.
Must be backported in 2.6.
diff --git a/include/haproxy/resolvers-t.h b/include/haproxy/resolvers-t.h
index dc1381b..b727463 100644
--- a/include/haproxy/resolvers-t.h
+++ b/include/haproxy/resolvers-t.h
@@ -163,6 +163,7 @@
struct {
const char *file; /* file where the section appears */
int line; /* line where the section appears */
+ int implicit; /* config was auto-generated and must be silent */
} conf; /* config information */
};
diff --git a/src/resolvers.c b/src/resolvers.c
index bcfd878..1f894ab 100644
--- a/src/resolvers.c
+++ b/src/resolvers.c
@@ -2509,8 +2509,10 @@
continue;
}
if (connect(fd, (struct sockaddr*)&ns->dgram->conn.addr.to, get_addr_len(&ns->dgram->conn.addr.to)) == -1) {
- ha_warning("resolvers '%s': can't connect socket for nameserver '%s'.\n",
- resolvers->id, ns->id);
+ if (!resolvers->conf.implicit) { /* emit a warning only if it was configured manually */
+ ha_warning("resolvers '%s': can't connect socket for nameserver '%s'.\n",
+ resolvers->id, ns->id);
+ }
close(fd);
err_code |= ERR_WARN;
continue;
@@ -3682,6 +3684,9 @@
err_code |= resolvers_new(&curr_resolvers, "default", "<internal>", 0);
if (err_code & ERR_CODE)
goto err;
+
+ curr_resolvers->conf.implicit = 1;
+
err_code |= parse_resolve_conf(NULL, NULL);
if (err_code & ERR_CODE)
goto err;