]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: resolvers: continue startup if network is unavailable
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Jul 2022 08:50:09 +0000 (10:50 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Jul 2022 08:59:14 +0000 (10:59 +0200)
When haproxy starts with a resolver section, and there is a default one
since 2.6 which use /etc/resolv.conf, it tries to do a connect() with the UDP
socket in order to check if the routes of the system allows to reach the
server.

This check is too much restrictive as it won't prevent any runtime
failure.

Relax the check by making it a warning instead of a fatal alert.

This must be backported in 2.6.

src/resolvers.c

index c7267aafca015f882ec4d65439442af0369a2abc..f325f39c3ff825dadbb013628cfc119d3dcb43c6 100644 (file)
@@ -2509,10 +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) {
-                                       ha_alert("resolvers '%s': can't connect socket for nameserver '%s'.\n",
+                                       ha_warning("resolvers '%s': can't connect socket for nameserver '%s'.\n",
                                                 resolvers->id, ns->id);
                                        close(fd);
-                                       err_code |= (ERR_ALERT|ERR_ABORT);
+                                       err_code |= ERR_WARN;
                                        continue;
                                }
                                close(fd);