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 07:02:05 -0800

On Tue, Feb 15, 2011 at 01:36:20PM +0100, Pawe?? Pi??tkowski wrote:
> On 15.02.2011 11:36, William Ahern wrote:
> >>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.
>
> Sure, but if I could parse NS reply and get addresses of suggested DNS
> servers then I could send another request to them and repeat this
> behavior until I get A reply.

The problem is that you're relying on a local server which is not configured
properly; whatever you manage to hack together using c-ares alone might not
work anywhere else.

At best you could re-initialize a new c-ares channel with the (struct
ares_option)->servers set to the new nameservers for that round, but you
can't set the header fields, such as the recursive bit set. An authoritative
nameserver might just drop packets with that bit set rather than answer it.
Received on 2011-02-15