Subject: Re: c-ares recursive name resolving

Re: c-ares recursive name resolving

From: William Ahern <william_at_25thandclement.com>
Date: Tue, 15 Feb 2011 02:36:20 -0800

On Tue, Feb 15, 2011 at 10:45:15AM +0100, Pawe?? Pi??tkowski wrote:
> Hello,
>
> What does c-ares do when server returns NS reply (list of DNS servers to
> ask) instead of A reply?

Nothing. (Or rather, exactly what you saw.)

> I was under the impression it was handled by c-ares internally (meaning
> c-ares would ask those servers until it finds a server that has IP
> address for the name).

c-ares is a stub resolver; meaning it asks the local recursive server and
then returns to the caller the answer. If a server returns an answer with
only NS records in the authority section this probably means that the server
you're using isn't properly configured as a recursive resolver. c-ares
requires a properly configured recursive resolver to seek out the result
using the complex rules of DNS name resolution.

> I wanted to test my software against this case so I initialized c-ares
> to ask root server (e.g. 128.8.10.90). I can see in Wireshark that it
> replies with the list of servers to ask but c-ares just calls callback
> function with status == ARES_ENODATA and hostent == NULL.
>
> Can I handle NS response manually somehow? I see there is
> ares_parse_ns_reply(). Are there any examples on how to use it?

I don't think it's possible to implement a recursive resolver using c-ares.
You can't control the fields in the query packets, nor the destination.
Received on 2011-02-15