qt-bugs@ issue : N213060Trolltech task ID : 213187bugs.kde.org number : 154774, 162600applied: yesauthor: Thiago Macieira <thiago.macieira@trolltech.com> the AI_ADDRCONFIG flag was introduced in recent specifications of the getaddrinfo(3) function. It tells the resolver to look up only address families which are already set up on the machine. That is: look up IPv4 if there are IPv4 addresses, look up IPv6 if there are IPv6 addresses in any of the network interfaces.diff --git src/network/kernel/qhostinfo_unix.cpp src/network/kernel/qhostinfo_unix.cppindex c9d8cb9..d4db2bd 100644--- src/network/kernel/qhostinfo_unix.cpp+++ src/network/kernel/qhostinfo_unix.cpp@@ -137,8 +137,19 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) struct addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC;+# ifdef AI_ADDRCONFIG+ hints.ai_flags = AI_ADDRCONFIG;+# endif int result = getaddrinfo(hostName.toLatin1().constData(), 0, &hints, &res);+# ifdef AI_ADDRCONFIG+ if (result == EAI_BADFLAGS) {+ // if the lookup failed with AI_ADDRCONFIG set, try again without it+ hints.ai_flags = 0;+ result = getaddrinfo(hostName.toLatin1().constData(), 0, &hints, &res);+ }+# endif+ if (result == 0) { addrinfo *node = res; QList<QHostAddress> addresses;