changeset 27005:cf373257effb

Don't do IPv6 AAAA lookups if there is no IPv6 address configured on this machine. From the getaddrinfo() man page: "If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by result only if the local system has at least one IPv4 address configured, and IPv6 addresses are only returned if the local system has at least one IPv6 address configured." It's my understanding that this flag is non-standard (a GNUism perhaps), which is why it's surrounded in #ifdefs.
author Mark Doliner <mark@kingant.net>
date Wed, 20 May 2009 17:24:52 +0000
parents 2e849a9adc01
children 5541ea5e9d1e
files libpurple/dnsquery.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dnsquery.c	Wed May 20 17:00:17 2009 +0000
+++ b/libpurple/dnsquery.c	Wed May 20 17:24:52 2009 +0000
@@ -256,6 +256,9 @@
 		 * library.
 		 */
 		hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_ADDRCONFIG
+		hints.ai_flags |= AI_ADDRCONFIG;
+#endif /* AI_ADDRCONFIG */
 		rc = getaddrinfo(dns_params.hostname, servname, &hints, &res);
 		write_to_parent(child_out, &rc, sizeof(rc));
 		if (rc != 0) {
@@ -706,6 +709,9 @@
 	 * library.
 	 */
 	hints.ai_socktype = SOCK_STREAM;
+#ifdef AI_ADDRCONFIG
+	hints.ai_flags |= AI_ADDRCONFIG;
+#endif /* AI_ADDRCONFIG */
 	if ((rc = getaddrinfo(query_data->hostname, servname, &hints, &res)) == 0) {
 		tmp = res;
 		while(res) {