[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getaddrinfo() and AI_CANONNAME




>> 	ai_canonname has the same meaning as "h->h_name" and
>Where it is defined?

	there were some discussions on ipngwg and the author clarified it to me.

>> 	getaddrinfo must not do the reverse lookup (i.e. getnameinfo).
>I don't quite understand. getaddrinfo() does not do a reverse lookup.

	your patch calls getnameinfo from inside getaddrinfo, and you are
	making reverse lookup from getnameinfo.

>The problem is: I have a Linux and an AIX system. Both has FQDNs in /etc/hosts
>and both are configured to use /etc/hosts first for lookups. On Linux,
>getaddrinfo() returns an FQDN when asked for the canonical name of the local
>host; AIX returns the unqualified hostname. Since the meaning of
>"canonical name" is not defined in either RFC2133 or RFC2553 (and the POSIX
>draft is neither final nor public), I must say that both Linux and AIX
>comply to the mentioned RFCs.

	"canincal name" is in DNS RFCs (RFC103[45] for example).

	if AIX getaddrinfo does not return something different from
	h->h_name into ai_canonname, that is broken.

>> 	so i don't think your patch is right.
>Then how to expand an unqualified name to a FQDN?

	if you are using DNS, DNS resolver knows where it got the mapping.
	for example, if you ask for "foo" and "foo.itojun.org" was consulted
	on the DNS database, "foo.itojun.org" is the canonical name.

	if you are using /etc/hosts, the first hostname on the list is
	considered as the canonical name.

itojun