return false;
}
+ if (!Ip::EnableIpv6) {
+ // if we are IPv6-disabled, use first-IPv4 instead of first-IP.
+ struct addrinfo *maybeIpv4 = res;
+ while (maybeIpv4) {
+ if (maybeIpv4->ai_family == AF_INET)
+ break;
+ maybeIpv4 = maybeIpv4->ai_next;
+ }
+ if (maybeIpv4 != NULL)
+ res = maybeIpv4;
+ // else IPv6-only host, let the caller deal with first-IP anyway.
+ }
+
/*
* NP: =(sockaddr_*) may alter the port. we don't want that.
* all we have been given as input was an IPA.
{
struct addrinfo *AI = NULL;
+ debugVerbose(2, "Transport detected: IPv4" <<
+ ((Ip::EnableIpv6 & IPV6_SPECIAL_V4MAPPING) ? "-mapped " : "") <<
+ (Ip::EnableIpv6 == IPV6_OFF ? "-only" : " and IPv6") <<
+ ((Ip::EnableIpv6 & IPV6_SPECIAL_SPLITSTACK) ? " split-stack" : ""));
+
if (Transport::Config.localHost) {
debugVerbose(2, "Resolving " << Transport::Config.localHost << " ...");