patch2.diff 1.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
commit 6ac8aa90db64a37e6c783da005ba513c6077c23d
Author: Simon Morlat <simon.morlat@linphone.org>
Date:   Fri Jan 30 10:08:45 2015 +0100

    fix ipv6 resolver test on windows

diff --git a/src/dns.c b/src/dns.c
index 317e8e0..b778aa4 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -79,6 +79,11 @@
 #include <iphlpapi.h>
 #pragma comment(lib, "IPHLPAPI.lib")
 #endif
+
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif
+
 #else
 #include <sys/types.h>		/* FD_SETSIZE socklen_t */
 #include <sys/select.h>		/* FD_ZERO FD_SET fd_set select(2) */
@@ -5709,7 +5714,8 @@ static void dns_so_destroy(struct dns_socket *);
 static struct dns_socket *dns_so_init(struct dns_socket *so, const struct sockaddr *local, int type, const struct dns_options *opts, int *error) {
 	static struct dns_socket so_initializer;
 	static DNSBool initialized = 0;
-
+	int value=0;
+	
 	if (!initialized) {
 		memset(&so_initializer, 0, sizeof so_initializer);
 		so_initializer.opts.closefd.arg = 0;
@@ -5731,7 +5737,8 @@ static struct dns_socket *dns_so_init(struct dns_socket *so, const struct sockad
 
 	if (-1 == (so->udp = dns_socket((struct sockaddr *)&so->local, SOCK_DGRAM, error)))
 		goto error;
-
+	value=0;
+	setsockopt(so->udp, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&value, sizeof(value));
 	dns_k_permutor_init(&so->qids, 1, 65535);
 
 	return so;