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

Chris Hegarty chris.hegarty at oracle.com
Thu Sep 5 12:47:09 PDT 2013


On 09/04/2013 02:49 PM, Rob McKenna wrote:
> Indeed it did.

Great, so we should behave in a similar manner to that of Apple's JDK6.

I think I understand why you added lookupIfLocalhost before getaddrinfo, 
in lookupAllHostAddr, but it has the consequence of retrieving the 
hostname for every other lookup. I wonder if the new code could be added 
after getaddrinfo, if no address could be found? This would mean that a 
DNS name would trump the local machine configuration, but that may not 
be so bad.

-Chris.

>
>      -Rob
>
> On 04/09/13 10:36, Chris Hegarty wrote:
>> Rob,
>>
>> I haven't looked at the changes yet, but I'm curious about the
>> decision to use getifaddrs. I know that there was a discussion started
>> at one point to determine what Apple's JDK6 is doing to retrieve the
>> local machines IP information. Did that discussion lead to getifaddrs?
>>
>> -Chris.
>>
>> On 03/09/2013 16:18, Rob McKenna wrote:
>>> Hi folks,
>>>
>>> Mac seems to have trouble looking up local hostnames using getaddrinfo
>>> unless a domain is set. The solution is to add a check with getifaddrs .
>>>
>>> This fix replaces a usage of _ALLBSD_SOURCE with MACOSX. I haven't seen
>>> a canonical answer on whether this is the way to go so I figured trial
>>> by fire might get the discussion going.
>>>
>>> http://cr.openjdk.java.net/~robm/7180557/webrev.01/
>>>
>>> -Rob
>>>
>



More information about the net-dev mailing list