#include <stdio.h>
#include <stdlib.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
#include <assert.h>
-#include <sys/types.h>
#ifndef WINDOWS
# include <sys/socket.h>
#include "hash.h"
#include "connect.h" /* for socket_has_inet6 */
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef h_errno
-# ifndef __CYGWIN__
-extern int h_errno;
-# endif
-#endif
-
#ifndef NO_ADDRESS
# define NO_ADDRESS NO_DATA
#endif
else if (opt.ipv6_only)
hints.ai_family = AF_INET6;
else
- {
+ /* We tried using AI_ADDRCONFIG, but removed it because: it
+ misinterprets IPv6 loopbacks, it is broken on AIX 5.1, and
+ it's unneeded since we sort the addresses anyway. */
hints.ai_family = AF_UNSPEC;
-#ifdef AI_ADDRCONFIG
- hints.ai_flags |= AI_ADDRCONFIG;
-#else
- /* On systems without AI_ADDRCONFIG, emulate it by manually
- checking whether the system supports IPv6 sockets. */
- if (!socket_has_inet6 ())
- hints.ai_family = AF_INET;
-#endif
- }
+
if (flags & LH_BIND)
hints.ai_flags |= AI_PASSIVE;