JDK-8216417 : cleanup of IPv6 scope-id handling
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 13
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-01-09
  • Updated: 2021-09-28
  • Resolved: 2019-06-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.13-oracleFixed 13 b25Fixed 14Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8268862 :  
Description
There is a lot of OS specific native code (mostly Linux) around determining which network interface to use when binding/connecting sockets to link-local (LL) IPv6 addresses.

Most of this code can be removed such that:

1. when binding/connecting to a local LL address, a common Java level implementation can check local link-local addresses and supply the scope-id automatically.

2. when connecting to a non local LL address, we can just require the scope-id to be set explicitly, like most native applications. Link-local addresses can sometimes, but not always be determined from routing tables, but it is more reliable to require them to be set by the caller.

This change affects NIO as well classic sockets and fixes a problem on macos where channels could not bind to local link-local addresses without the scope-id being set explicitly.
Comments
Fix request [11u] I downport this for parity with 11.0.13-oracle. I had to resovle a row of files. Changed tests pass. Nightly testing passes.
24-09-2021

Git URL: https://github.com/openjdk/jdk/commit/247a6a2ce4f890252ec256de107c1fc4b898aaf6
21-09-2021

URL: http://hg.openjdk.java.net/jdk/jdk/rev/96c7427456f9 User: michaelm Date: 2019-06-13 08:11:32 +0000
13-06-2019

There is already quite a bit of scope-id magic going on for Linux in NET_InetAddressToSockaddr. So, it probably makes sense to include the Macos specific stuff there as well.
10-01-2019