Subject: Re: getaddrinfo and numeric IP addresses
To: Christoph Kaegi <kgc@zhwin.ch>
From: None <itojun@iijlab.net>
List: tech-userlevel
Date: 05/06/2003 15:41:26
>>I hope, this is not too offtopic:
>>Why does the following code not do, what the manpage suggests it should?
>(snip)
>>On my NetBSD 1.6.1 box it says: "Hostname is (null)"
>>On Solaris it says: "Hostname is 160.85.104.32"
>>Both do not return the canonical hostname.
>>Am I missing something?
>
>	the standard NetBSD 1.6.1 is based (RFC2553) does not have any
>	recommendation for ai_canonname value.  new standard (RFC3493)
>	recommends Solaris behavior.  in the near future NetBSD will behave
>	as RFC3493 suggests.

	therefore, if you want to write a portable application, you shouldn't
	rely on ai_canonname being non-NULL when hostname is numeric.

	if (res->ai_canonname)
		use res->ai_canonname;
	else
		use hostname;

	or whatever.

itojun