cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: curl with c-ares returns "(Could not contact DNS servers)"

From: David Cook <kayoux_at_hotmail.com>
Date: Fri, 4 Feb 2011 02:05:02 +0000

Dan,

I found the source of the problem.

By default, my nsswitch.conf file didn't have the hosts: dns option. So I had to add it manually and burn it into the distribution. I now find it strange that dns was working without c-ares. none of my conf file had any dns lookup option.

Thanx all for your help!

David

From: kayoux_at_hotmail.com
To: curl-library_at_cool.haxx.se
Subject: RE: curl with c-ares returns "(Could not contact DNS servers)"
Date: Thu, 3 Feb 2011 22:30:41 +0000

Dan,

Ok I've been debugging. Here's some info before I start running the tests.

1) I noticed that Curl_getaddrInfo() in Curl_resolv(). This function calls ares_gethostbyname which down the stack reads /etc/hosts. The channel settings have one lookups ('f') for one file lookup and nserver is set to 1 (i really have one dns server in /etc/resolv.conf). I would have expected to have an entry for dns lookup ('b'). Do you have an opinion on this? My /etc/resolv.conf does not have any lookup entries.

2) The file lookup functions read /etc/hosts to see if there's a match for the IP address I'm looking for. However, my /etc/hosts file only has one entry:

172.20.1.254 rtl8181.realtek.com.tw rtl8181

This entry has nothing to do with the host name I'm looking for.

3) /etc/hosts is not writable on this system. I only have one writable partition (/opt). Is this a problem?

David

> Date: Thu, 3 Feb 2011 13:44:57 -0800
> From: dan_at_coneharvesters.com
> To: curl-library_at_cool.haxx.se
> Subject: Re: curl with c-ares returns "(Could not contact DNS servers)"
>
> On Thu, Feb 03, 2011 at 09:22:02PM +0000, David Cook wrote:
> > Ok I looked into the c-ares library and could not find the 3 tests you are
> > talking about. I noticed that there are several tests in curl-x/tests/data.
> > Which ones are you referring to?
>
> There are three test programs included in the c-ares source: acountry, adig
> & ahost. If curl itself is failing with c-ares, then naturally (hopefully) the
> curl tests will show failures. But, trying those three c-ares example programs
> will isolate the problem to c-ares or curl.
>
> >>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
                                               

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-04