getaddrinfo canonicalization (Re: host name resolution ...)

Ken Raeburn raeburn at MIT.EDU
Mon Mar 17 15:44:08 EST 2003


"Donn Cave" <donn at u.washington.edu> writes:
> | gethostbyname() won't help, as in this case we're talking about a
> | real "A" name, just not a canonical one, so you get the same host
> | name out of gethostbyname() that you put in.  But you can get a
> | canonical name out of getaddrinfo if you ask for it, at least if
> | the platform has a working getaddrinfo().
>
> I take that back - it's true on one platform I have at hand, but
> not on the other two that support getaddrinfo at all.

Various implementations I've tried have bugs -- AIX 4.3.3, Linux
especially.  See fake-addrinfo.h for my attempts to work around them;
it's not pretty.

> I mention this mainly because I see this value is used in sn2princ.c
> and elsewhere, so its unfortunate diversity of meanings has some
> potential to cause problems.

I'm attempting to fix the different meanings, until the vendors get
their acts together.  We should be able to use one interface for this
information, and when it works, getaddrinfo should be that interface.

If you can document a specific case where the modified getaddrinfo
(i.e., calling getaddrinfo() after including fake-addrinfo.h) is
giving incorrect data, let me know.  (And I would assert that the
correct behavior for getaddrinfo's ai_canonname result is to return
the target of a CNAME record, and not to look up A then PTR records.)

Ken


More information about the krbdev mailing list