pidgin: 1864a53b: Don't do IPv6 AAAA lookups if there is n...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed May 20 13:31:19 EDT 2009


-----------------------------------------------------------------
Revision: 1864a53b79ca34679ff68b45b52e7385608e46cc
Ancestor: 9c54a84f998c77a5dd31c28d1e032e0be0523372
Author: markdoliner at pidgin.im
Date: 2009-05-20T17:24:52
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1864a53b79ca34679ff68b45b52e7385608e46cc

Modified files:
        libpurple/dnsquery.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/dnsquery.c	6e43fe7de94e532ab0653ae0608a54981d3ad865
+++ libpurple/dnsquery.c	425461336daaa45e12a84427cd9f069ac36aaa4a
@@ -256,6 +256,9 @@ purple_dnsquery_resolver_run(int child_o
 		 * 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 @@ dns_thread(gpointer data)
 	 * 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) {


More information about the Commits mailing list