RFR: JDK-8313804: JDWP support for -Djava.net.preferIPv6Addresses=system [v2]

Chris Plummer cjplummer at openjdk.org
Mon Sep 18 23:47:39 UTC 2023


On Mon, 18 Sep 2023 20:47:22 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Please consider this fix for [JDK-8313804](https://bugs.openjdk.org/browse/JDK-8313804), which adds support to JDWP for `-Djava.net.preferIPv6Addresses=system`. Previously it only handled `-Djava.net.preferIPv6Addresses=true` and `-Djava.net.preferIPv6Addresses=false`.
>
> Liam Miller-Cushon has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   JDK-8313804: JDWP support for -Djava.net.preferIPv6Addresses=system

Is the code starting at lines 748 and 970 still correct after your changes?

src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c line 1312:

> 1310:  *  - AF_INET6 if the property is "true";
> 1311:  *  - AF_INET if the property is "false".
> 1312:  *  - 0 if the property is "false".

I think you meant "system", not "false".

src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c line 1338:

> 1336:             preferredAddressFamily = AF_INET;
> 1337:         } else if (strcmp(theValue, "system") == 0) {
> 1338:             preferredAddressFamily = 0;

Would `AF_UNSPEC` (which is 0) be a better choice than a literal 0 here?

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

PR Comment: https://git.openjdk.org/jdk/pull/15796#issuecomment-1724627568
PR Review Comment: https://git.openjdk.org/jdk/pull/15796#discussion_r1329356340
PR Review Comment: https://git.openjdk.org/jdk/pull/15796#discussion_r1329391577


More information about the serviceability-dev mailing list