From: Marko Kreen Date: Tue, 30 Dec 2014 13:13:45 +0000 (+0200) Subject: c-ares: force IPv4 on c-ares <= v1.10 X-Git-Tag: pgbouncer_1_6_rc1~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26a4716b1d629555d9e4692ab4488e0e6973fd84;p=pgbouncer c-ares: force IPv4 on c-ares <= v1.10 It does not resolve CNAME with AF_UNSPEC. Fixed in GIT, still unreleased. --- diff --git a/src/dnslookup.c b/src/dnslookup.c index da0a431..53ae344 100644 --- a/src/dnslookup.c +++ b/src/dnslookup.c @@ -895,9 +895,24 @@ static void xares_host_cb(void *arg, int status, int timeouts, struct hostent *h static void impl_launch_query(struct DNSRequest *req) { struct XaresMeta *meta = req->ctx->edns; + int af; +/* + * c-ares <= 1.10 cannot resolve CNAME with AF_UNSPEC. + * + * Force IPv4 there. + * + * Fixed in "host_callback: Fall back to AF_INET on searching with AF_UNSPEC" (c1fe47f) + * in c-ares repo. + */ +#if ARES_VERSION <= 0x10A00 +#warning Forcing c-ares to be IPv4-only. + af = AF_INET; +#else + af = AF_UNSPEC; +#endif log_noise("dns: ares_gethostbyname(%s)", req->name); - ares_gethostbyname(meta->chan, req->name, AF_UNSPEC, xares_host_cb, req); + ares_gethostbyname(meta->chan, req->name, af, xares_host_cb, req); meta->got_events = 1; }