RFR: 7180557 - InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX

Bernd Eckenfels bernd-2013 at eckenfels.net
Thu Sep 5 14:30:27 PDT 2013


Hello,

I reported before, AI_CANONNAME is used in different places with no good  
reason. If you use the flag, the result would be in res[0].ai_canonname,  
which is not used. So you can remove it and safe the elaborate resolving  
which comes with it.

And I also think the comment "skip DNS lookup" is wrong, as GAI typically  
(also) looks in /etc/hosts - and this is also documented in the mac os man  
page.

So I think if you remove the flag you dont need the lookupIflocalhost  
shortcut at all (or you need it on all systems).

And if you have a look there, I think the AI_ADDRCONFIG should be  
considered, instead.

Gruss
Bernd

Am 05.09.2013, 22:33 Uhr, schrieb Dmitry Samersoff  
<dmitry.samersoff at oracle.com>:

> Rob,
>
> Did you try to remove
>
> hints.ai_flags = AI_CANONNAME
>
> this flag asks getaddreinfo to return FQDN, but the function behavior is
> not clearly defined for the case where FQDN is not available.



More information about the net-dev mailing list