Subject: Set options and resolv.conf

Set options and resolv.conf

From: Matthew Yacobucci <M.Yacobucci_at_f5.com>
Date: Wed, 25 Mar 2015 14:58:41 +0000

Hi all,

I encountered an issue where c-ares timeouts were taking exceedingly long for what my resolv.conf was configured for.

I'm using c-ares 1.10.0.

I noticed in set_options only the retrans and retry resolv.conf options were looked at and not timeout or attempts. The channel->timeout should also be in milliseconds.

Here's the patch:

diff --git a/ext/libs/c-ares-1.10.0/ares_init.c b/ext/libs/c-ares-1.10.0/ares_in
index d23c1b0..e2becf9 100644
--- a/ext/libs/c-ares-1.10.0/ares_init.c
+++ b/ext/libs/c-ares-1.10.0/ares_init.c
@@ -1733,10 +1733,14 @@ static int set_options(ares_channel channel, const char
       val = try_option(p, q, "ndots:");
       if (val && channel->ndots == -1)
         channel->ndots = aresx_sltosi(strtol(val, NULL, 10));
- val = try_option(p, q, "retrans:");
+ val = try_option(p, q, "timeout:");
+ if (!val)
+ val = try_option(p, q, "retrans:");
       if (val && channel->timeout == -1)
- channel->timeout = aresx_sltosi(strtol(val, NULL, 10));
- val = try_option(p, q, "retry:");
+ channel->timeout = aresx_sltosi(strtol(val, NULL, 10)) * 1000;
+ val = try_option(p, q, "attempts:");
+ if (!val)
+ val = try_option(p, q, "retry:");
       if (val && channel->tries == -1)
         channel->tries = aresx_sltosi(strtol(val, NULL, 10));
       val = try_option(p, q, "rotate");
?
Cheers,
MY
Received on 2015-03-25