On Tue, 15 Apr 2025 08:58:21 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> 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. This pull request has now been integrated. Changeset: 4c3c2b32 Author: Jaikiran Pai <j...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/4c3c2b32a1b9dea6f3e258cf44666932afc179e4 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod 8354576: InetAddress.getLocalHost() on macos may return address of an interface which is not UP - leading to "Network is down" error Reviewed-by: alanb, dfuchs, vyazici ------------- PR: https://git.openjdk.org/jdk/pull/24653