Summary
-------
Add IPv6 support for JPDA socket transport.
Problem
-------
Some parts of the world are moving to IPv6 only and we want our customers to continue to be able to debug their applications.
JDI side of the socket transport supports both IPv4 and IPv6, but the JDWP agent supports IPv4 only.
This makes impossible to use socket transport for debugging on IPv6 only systems.
Solution
--------
Add IPv6 support for JDWP agent.
The IPv4 will continue to be supported as before.
Specification
-------------
The JDWP agent options (-agentlib:jdwp=transport=dt_socket,...) are changed as follows:
- address (address=[<address>]:<port>):
- address can be IPv6 (in addition to IPv4);
- as IPv6 address contains colons, the address can be enclosed in square brackets (example: [::1]:<port>)
- if address is empty or a symbolic hostname is specified (like localhost) which can be resolved to either IPv4 or IPv6 IP address,
the address is selected depending on standard java net system properties:
- "java.net.preferIPv4Stack" (default: false) - use only IPv4 addresses;
- "java.net.preferIPv6Addresses" (default: false) - IPv6 addresses are preferred;
For compatibility, addresses are resolved to IPv4 by default, so old debuggers can connect to new target VMs.
- allow (allow=<address1>[/<prefixLength1>]+<address2>[/<prefixLength2>]+...)
- addresses can be either IPv4 or IPv6:
- IPv4 addresses are 32bit, so IPv4 max prefixLength is 31
- IPv6 addresses are 128bit, so IPv6 max prefixLength is 127
The following doc changes are required:
- "allow" option needs to be documented (It has not been documented yet, see enhancement JDK-8221713 and related CSR JDK-8061228);
- in "Connection and Invocation Details" (https://docs.oracle.com/en/java/javase/12/docs/specs/jpda/conninv.html) the following change is required:
<pre>
The socket transport uses a single stream TCP/IP connection
between the debugger application and the target VM. Both IPv4 and IPv6 are
-supported on the JDI side of the socket transport. The current implementation
-on the target VM side only supports IPv4, but this could change in a future
-release so that both IPv4 and IPv6 are supported.
+supported on the JDI side and the target VM side of the socket transport.
</pre>