]> git.pond.sub.org Git - empserver/blobdiff - src/client/host.c
Use IPv4 and v6 only when suitable interfaces are configured
[empserver] / src / client / host.c
index 68df7e21f8d43c71efdfcc105dede145687916d4..6687f71ab4aa9c028b295f613de902438f4d6f9a 100644 (file)
 #endif
 #include "misc.h"
 
+/* Portability cruft, should become unnecessary eventually */
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0
+#endif
+
 #ifdef HAVE_GETADDRINFO
 /*
  * Inspired by example code from W. Richard Stevens: UNIX Network
@@ -65,6 +70,7 @@ tcp_connect(char *host, char *serv)
     struct addrinfo hints, *res, *ressave;
 
     memset(&hints, 0, sizeof(struct addrinfo));
+    hints.ai_flags = AI_ADDRCONFIG;
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;