CNAME and gethostbyname()

Barry Margolin barmar at alum.mit.edu
Mon Jun 21 17:49:11 UTC 2004


In article <cb76dg$1sht$1 at sf1.isc.org>,
 "Gisle Vanem" <giva at users.sourceforge.net> wrote:

> I'm doing a small implementation of gethostbyname()
> and friends. My question; if my resolver gets a CNAME
> record for a query, where do I put the CNAME in the
> hostent structure?
> 
> Do I (1) put it in 'h->h_name' (potentially replacing the old one). 
> Or (2) do I put in 'h->aliases[0]' with the original query name 
> put in 'h->h_name'?

Why don't you look at what the BIND resolver does?

> 
> AFAIK, the CNAME records are sometimes called "aliases" 
> but are technically referred to as "Canonical Name" entries.
> Hence my confusion.

In a record like:

foo IN CNAME bar

"bar" is the Canonical NAME of the alias named "foo".  This is analogous 
with other types of records, e.g. in

foo IN A 1.2.3.4

1.2.3.4 is the Address of the host named "foo".

-- 
Barry Margolin, barmar at alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


More information about the bind-users mailing list