summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-06-15 10:56:05 +0200
committerJakub Hrozek <jhrozek@redhat.com>2011-06-15 10:56:05 +0200
commit159b82c0567c534a98556665e0b8518dbee71714 (patch)
tree7e5ceabd0e2a4a4e3e83cf2d533a082a3ff1d6d7
parentce03c818f4f0474237abdd881450ef7e468306a5 (diff)
downloadc-ares-159b82c0567c534a98556665e0b8518dbee71714.tar.gz
c-ares-159b82c0567c534a98556665e0b8518dbee71714.tar.bz2
c-ares-159b82c0567c534a98556665e0b8518dbee71714.zip
Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses"
This reverts commit b5823d65706af687c0e5110af8f0cfdcd068997d. This patch was not reviewed properly before pushing
-rw-r--r--ares_gethostbyname.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ares_gethostbyname.c b/ares_gethostbyname.c
index ad89dc2..72f8f8b 100644
--- a/ares_gethostbyname.c
+++ b/ares_gethostbyname.c
@@ -194,11 +194,11 @@ static void host_callback(void *arg, int status, int timeouts,
else if (hquery->sent_family == AF_INET6)
{
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
- if ((status == ARES_ENODATA || status == ARES_EBADRESP) &&
- hquery->want_family == AF_UNSPEC) {
+ if (status == ARES_ENODATA || status == ARES_EBADRESP) {
/* The query returned something but either there were no AAAA
records (e.g. just CNAME) or the response was malformed. Try
- looking up A instead. */
+ looking up A instead. We should possibly limit this
+ attempt-next logic to AF_UNSPEC lookups only. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A,
host_callback, hquery);
@@ -210,10 +210,11 @@ static void host_callback(void *arg, int status, int timeouts,
end_hquery(hquery, status, host);
}
else if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
- status == ARES_ETIMEOUT) && (hquery->sent_family == AF_INET6 &&
- hquery->want_family == AF_UNSPEC))
+ status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6)
{
- /* The AAAA query yielded no useful result. Now look up an A instead. */
+ /* The AAAA query yielded no useful result. Now look up an A instead.
+ We should possibly limit this attempt-next logic to AF_UNSPEC lookups
+ only. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);