]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: try to connect to all addresses before giving up
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 25 May 2017 14:12:50 +0000 (16:12 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 26 May 2017 11:33:53 +0000 (13:33 +0200)
Don't give up when one of the addresses/hostnames specified by -h fails
to resolve in DNS_Name2IPAddress(), e.g. with the default setting try to
connect to ::1 even when 127.0.0.1 failed due to the -6 option.

client.c

index b3e8c76e295cd378dc37afe1e7d9837c01caaa3a..6c606d8cd72314b77b0c63ea13b497e119046c25 100644 (file)
--- a/client.c
+++ b/client.c
@@ -172,7 +172,7 @@ get_sockaddrs(const char *hostnames, int port)
     } else {
       if (DNS_Name2IPAddress(hostname, ip_addrs, DNS_MAX_ADDRESSES) != DNS_Success) {
         DEBUG_LOG("Could not get IP address for %s", hostname);
-        break;
+        continue;
       }
 
       for (i = 0; i < DNS_MAX_ADDRESSES && ip_addrs[i].family != IPADDR_UNSPEC; i++) {