struct addrinfo *result;
struct addrinfo *pos;
+#ifdef WINDOWS
+ /* Due to a bug, getaddrinfo will not return a mix of different families */
+ if (AF_UNSPEC == af)
+ {
+ int ret1;
+ int ret2;
+ ret1 = getaddrinfo_resolve (tc, hostname, AF_INET);
+ ret2 = getaddrinfo_resolve (tc, hostname, AF_INET6);
+ if ((ret1 == GNUNET_OK) || (ret2 == GNUNET_OK))
+ return GNUNET_OK;
+ if ((ret1 == GNUNET_SYSERR) || (ret2 == GNUNET_SYSERR))
+ return GNUNET_SYSERR;
+ return GNUNET_NO;
+ }
+#endif
+
memset (&hints, 0, sizeof (struct addrinfo));
-// FIXME in PlibC
-#ifndef MINGW
hints.ai_family = af;
-#else
- hints.ai_family = AF_INET;
-#endif
hints.ai_socktype = SOCK_STREAM; /* go for TCP */
if (0 != (s = getaddrinfo (hostname, NULL, &hints, &result)))
AF_INET) ? "IPv4" : ((af == AF_INET6) ? "IPv6" : "any"),
gai_strerror (s));
if ((s == EAI_BADFLAGS) || (s == EAI_MEMORY)
-#ifndef MINGW
+#ifndef WINDOWS
|| (s == EAI_SYSTEM)
#else
- // FIXME NILS
|| 1
#endif
)
}
if (result == NULL)
return GNUNET_SYSERR;
- pos = result;
- while (pos != NULL)
+ for (pos = result; pos != NULL; pos = pos->ai_next)
{
switch (pos->ai_family)
{
/* unsupported, skip */
break;
}
- pos = pos->ai_next;
}
freeaddrinfo (result);
return GNUNET_OK;
int ret1;
int ret2;
+#ifdef WINDOWS
+ /* gethostbyname2() in plibc is a compat dummy that calls gethostbyname(). */
+ return GNUNET_NO;
+#endif
+
if (af == AF_UNSPEC)
{
ret1 = gethostbyname2_resolve (tc, hostname, AF_INET);