Can I please get a review of this change which proposes to address the issue 
noted in https://bugs.openjdk.org/browse/JDK-8354576?

As noted in that issue, the current code in the `lookupAllHostAddr()` function 
of `Inet4AddressImpl.c` and `Inet6AddressImpl.c` has a macos specific 
implementation, where we call `getifaddrs()` and iterate over the returned 
addresses. In its current form this code doesn't check to see if the interface 
is UP or not. This can result in returing an address belonging to an interface 
which is not UP. That can cause subsequent usage of the address for networking 
operations to result in a "Network is down" error.

The commit in this PR skips interfaces that are not UP. The change only impacts 
the result of `getLocalHost()` call and that too only on macos. Given the 
nature of this change no new regression test has been introduced. Existing 
tests in tier1, tier2 and tier3 continue to pass with this change.

-------------

Commit messages:
 - 8354576: InetAddress.getLocalHost() on macos may return address of an 
interface which is not UP - leading to "Network is down" error

Changes: https://git.openjdk.org/jdk/pull/24653/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24653&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8354576
  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/24653.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24653/head:pull/24653

PR: https://git.openjdk.org/jdk/pull/24653

Reply via email to