1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-30 06:48:02 +00:00

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.
This commit is contained in:
William Lallemand 2022-08-24 14:50:32 +02:00
parent 529b6a3a2c
commit b10b1196b8
2 changed files with 8 additions and 2 deletions
include/haproxy
src

View File

@ -163,6 +163,7 @@ struct resolvers {
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 */
};

View File

@ -2509,8 +2509,10 @@ static int resolvers_finalize_config(void)
continue;
}
if (connect(fd, (struct sockaddr*)&ns->dgram->conn.addr.to, get_addr_len(&ns->dgram->conn.addr.to)) == -1) {
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 @@ int resolvers_create_default()
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;