From c049bce007860fb9bde2b0e508cae789e92ff844 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 25 May 2017 16:12:50 +0200 Subject: [PATCH] client: try to connect to all addresses before giving up 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.c b/client.c index b3e8c76..6c606d8 100644 --- 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++) {