JDK-8233307 : MulticastSocket getOption(IP_MULTICAST_IF) returns interface when not set
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 9,14
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-10-31
  • Updated: 2020-02-12
  • Resolved: 2019-11-28
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 14
14 b26Fixed
Related Reports
Blocks :  
Blocks :  
CSR :  
Relates :  
Sub Tasks
JDK-8234915 :  
Description
The IP_MULTICAST_IF socket option is specified to have an initial value of null to mean that the interface has not been set. When the interface is not set MulticastSocket's getOption(IP_MULTICAST_IF) returns a NetworkInterface that appears to be valid (index >= 0) but is useless.

The setOption/getOption methods are @since 9 so the compatibility impact of fixing this is probably low.

Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/6f12009ea9d7 User: dfuchs Date: 2019-11-28 18:28:58 +0000
28-11-2019

Right, no change to MulticastSocket getInterface/getNetworkInterface, the proposal is to only fix getOption(StandardOptions.IP_MULTICAST_IF). The compatibility impact should be low as getOption is new since 9 and MulticastSocket doesn't have anything in its javadoc to say that it supports this socket option.
17-11-2019

This will probably need a CSR. To limit compatibility risks we want to keep MulticastSocket::getInterface()/getNetworkInterface() unchanged - and simply have getOption(StandardOptions.IP_MULTICAST_IF) return null if the option is not set (which is how StandardOptions.IP_MULTICAST_IF is specified).
15-11-2019