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

2013-10-07 Thread Rob McKenna
Heh, you just beat me to the punch. -Rob On 07/10/13 17:34, Dmitry Samersoff wrote: Rob, Existing code uses if (JVM_GetHostName(myhostname, NI_MAXHOST)) so I withdraw my last comments. Please, don't change it!!! -Dmitry On 2013-10-07 20:30, Rob McKenna wrote: Thanks Dmitry! I'll correct

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

2013-10-07 Thread Dmitry Samersoff
Rob, Existing code uses if (JVM_GetHostName(myhostname, NI_MAXHOST)) so I withdraw my last comments. Please, don't change it!!! -Dmitry On 2013-10-07 20:30, Rob McKenna wrote: > Thanks Dmitry! I'll correct that nipick pre-push. > > -Rob > > On 07/10/13 16:47, Dmitry Samersoff wrote: >> Rob

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

2013-10-07 Thread Rob McKenna
Thanks Dmitry! I'll correct that nipick pre-push. -Rob On 07/10/13 16:47, Dmitry Samersoff wrote: Rob, This version of your fix looks good for me. Inet4AddressImpl.c: Thumbs up. Inet6AddressImpl.c: Thumbs up. 173 if (JVM_GetHostName(myhostname, NI_MAXHOST)) { Nitpicking, e

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

2013-10-07 Thread Dmitry Samersoff
Rob, This version of your fix looks good for me. Inet4AddressImpl.c: Thumbs up. Inet6AddressImpl.c: Thumbs up. 173 if (JVM_GetHostName(myhostname, NI_MAXHOST)) { Nitpicking, explicit == -1 would be better here. > Actually, can you tell me why you'd rather not > include ipv6 loopba

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

2013-10-04 Thread Rob McKenna
Hi Dmitry, Thanks a lot for the comprehensive review. W.r.t. line 210, I agree there is a problem with the logic, but I'd like to suggest an alternative solution: - If addrs4 >= 1, then we will always be including loopback addresses in the list. Since the idea of this extra condition is to e

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

2013-09-21 Thread Dmitry Samersoff
Rob, See below - ll. 210 have to be fixed, other comments is just an opinion. Inet4AddressImpl.c: ll.132 - it might be better to move initialization to a separate function, the same way as in Inet6 - I really like this idea. Inet6AddressImpl.c ll. 126. it's better to move static int initia

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

2013-09-20 Thread Chris Hegarty
Looks fine to me Rob, thanks. -Chris. On 09/20/2013 03:58 PM, Rob McKenna wrote: After a brief discussion with Chris, we decided to revert the position of the call to lookupIfLocalAddrs so as to give the local host primacy over DNS. Latest (and hopefully last) webrev here: http://cr.openjdk.j

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

2013-09-20 Thread Rob McKenna
After a brief discussion with Chris, we decided to revert the position of the call to lookupIfLocalAddrs so as to give the local host primacy over DNS. Latest (and hopefully last) webrev here: http://cr.openjdk.java.net/~robm/7180557/webrev.03/ -Rob On 14/09/13 00:00, Rob McKenna wrote:

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

2013-09-13 Thread Rob McKenna
Hi Bernd, I should have said in the context of this bug. What I meant was removing AI_CANONNAME doesn't resolve the issue as far as Mac is concerned. I.e. I still see the UnknownHostException. In this particular case the hostname is not set via the hosts file. In the latest webrev the call t

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

2013-09-13 Thread Bernd Eckenfels
Am 13.09.2013, 19:32 Uhr, schrieb Rob McKenna : W.r.t. the use of AI_CANONNAME, this doesn't actually make a difference in the context of this fix, but is definitely something that should be looked at. I'll put it on the todo list. I think it does make a difference: If you remove the CANON f

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

2013-09-13 Thread Rob McKenna
Hi folks, updated webrev at: http://cr.openjdk.java.net/~robm/7180557/webrev.02/ Hopefully all of your concerns have been addressed. W.r.t. the use of AI_CANONNAME, this doesn't actually make a difference in the context of this fix, but is definitely something that should be looked at. I'll p

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

2013-09-06 Thread Rob McKenna
Thanks for the comments folks. Chris, I like the idea of moving this check below the GAI call. Dmitry, that loop is indeed a bit of a code smell. I'll take care of it. Bernd / Dmitry, thanks for the notes on AI_CANONNAME. I'll adjust the code and get some testing done then report back! I've k

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

2013-09-05 Thread Dmitry Samersoff
Rob, Instead of iterating interfaces list twice you can maintain two indices, as you already know exact number of addresses. put_v4_at(i) put_v6_at(j+v4count) Also you can take a look at solaris/native/java/net/NetworkInterface.c and possibly re-use some logic from there. -Dmitry On 2013-09-

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

2013-09-05 Thread Bernd Eckenfels
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 loo

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

2013-09-05 Thread Dmitry Samersoff
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. -Dmitry On 2013-09-03 19:18, Rob McKenna wrote: > Hi folks, > > Mac seems to have trouble looking up

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

2013-09-05 Thread Chris Hegarty
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 oth

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

2013-09-04 Thread Rob McKenna
Indeed it did. -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 i

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

2013-09-04 Thread Chris Hegarty
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 0

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

2013-09-03 Thread Rob McKenna
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 tr