Subject: Re: CNAME ordering in ares_parse_a_reply()

Re: CNAME ordering in ares_parse_a_reply()

From: Erik Kline <ek_at_google.com>
Date: Thu, 4 Sep 2008 19:33:14 -0700

2008/9/4 James deBoer <deboer_at_google.com>:
> Hello,
>
> I am using c-ares to resolve host names from a server which returns
> CNAME records after A records.
>
> For example, a request for lion.domain would return:
>
> cat.domain. IN A 1.2.3.4
> lion.domain. IN CNAME cat.domain.
>
> This order is opposite to BIND, which always returns CNAME records
> first. I haven't found any documentation that specifies a record
> order, but I haven't read all the RFCs closely either.
>
> Currently, ares_parse_a_reply() makes a single pass over the DNS
> reply. By the time it follows the CNAME pointer, it has missed the
> relevant A record.
>
> I have a patch that adds an additional pass to ares_parse_a_reply()
> which resolves the CNAME chain before examining the A records. This
> change allows c-ares to resolve lion.domain. Is this the correct
> approach, or are these upside-down replies invalid?
>
> Thanks,
> James.
>

I assume that other resolvers (e.g. unbound, ...) don't have a problem
with this (whether it's permitted or not I couldn't exactly say, at
this time, either).
Received on 2008-09-05