Proper CNAME interpretation

Chuck Swiger cswiger at mac.com
Wed Sep 14 21:52:34 UTC 2011


On Sep 14, 2011, at 2:27 PM, Ronald F. Guilmette wrote:
> The second part however seems to go more to my question, which is "What is
> the resolver supposed to do when some knucklehead breaks the rules and puts
> a CNAME in with some other stuff?"

Depends on which query one issued.  The very next paragraph of RFC-1034 is:

"CNAME RRs cause special action in DNS software.  When a name server
fails to find a desired RR in the resource set associated with the
domain name, it checks to see if the resource set consists of a CNAME
record with a matching class.  If so, the name server includes the CNAME
record in the response and restarts the query at the domain name
specified in the data field of the CNAME record.  The one exception to
this rule is that queries which match the CNAME type are not restarted."

In other words, if you ask for an A record, and you get back both a CNAME and an A record, then the A record matches and that's what gethostbyname()/getaddrinfo() or whatever should receive from the resolver.  If you asked for an AAAA record, and got that same reply of a CNAME and an A record, then the resolver should chase the CNAME's data field.

> It sure _sounds_ like that second sentence is encouraging any & all people
> who are writing resolvers, or other related tools, that they should ignore
> any flotsam & jetsum that appear along side a CNAME.  But is that encourage-
> ment espressed anywhere as a "MUST"?

By no means.  You only ought to chase a CNAME if you got a CNAME *instead* of the resource type that you asked for.

Regards,
-- 
-Chuck




More information about the bind-users mailing list