JDK-7122846 : (macosx) MulticastSocket.setLoopbackMode() not working for IPv4 using AF_INET6 sockets
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7u4,8,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • CPU: unknown
  • Submitted: 2011-12-19
  • Updated: 2024-06-24
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.
Other
tbdUnresolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
(macosx) MulticastSocket.setLoopbackMode() not working for IPv4 using AF_INET6 sockets,
which is the default case when IPv6 is available. If preferIPv4Stack is enabled
then it works ok.

Comments
Looking at the JCK error log, I can reproduce the same error with the native test case. So, ./foo ff15:0:0:0:0:0:0:1234 en0 produces a sendto failed: No route to host error Are these new JCK tests, or are they being run on Mac OS for the first time, because I am thinking they could never have passed before?
24-01-2014

I have submitted Apple bug 15902831 for this and have attached the native test case for reference here too. Basically loopback of packets does not occur when sending to ff01/112 groups (interface local scope) but does work when sending to ff02/112 groups (link-local scope). It also fails with ff0e/112 (global scope). eg ./foo ff01:0:0:0:0:0:0:a lo0 argv[2] = lo0 ifindex = 1 dest = ff01:0:0:0:0:0:0:a sendto failed: No route to host
24-01-2014

Ahh... Michael, see this comment: https://bugs.openjdk.java.net/browse/JDK-7122846?focusedCommentId=13450621&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13450621 "Following JCK-runtime tests are failing on MacOS: "
24-01-2014

Please answer Michael's question above about a jck test
24-01-2014

Thanks for the update, Michael will look into it (my guess is that this issue has always existed on OS X so a bit puzzling why it's a fire drill now).
24-01-2014

Unfortunately, there is a slight mismatch between the report title and the content (ie the failing test). The test fails using AF_INET6 sockets when sending (loopback) to an IPv6 group. I will update the title to reflect the issue in the test later. But, the test is still failing in JDK 8 and on various versions of macos including Mavericks. It does seem to be an OS issue and will raise a bug report with Apple, but this will require a native test. In any case, I don't see the need for a tck-red here. Is there a JCK test failing also?
24-01-2014

To Alan : Please see my previous comment, I updated it.
21-01-2014

Svetlana - it would be good to include the "ifconfig -a" for stt-mac-18.ru.oracle.com as I assume this issue is being tickled by the IPv6 configuration on that system.
21-01-2014

RULE java/net/MulticastSocket/SetLoopbackMode.java Exception java.io.IOException: No route to host RULE java/net/MulticastSocket/Test.java Exception java.io.IOException: No route to host
17-12-2013

java/net/MulticastSocket/NoLoopbackPackets.java
17-12-2013

Test java/net/MulticastSocket/Test.java fails on MacOS X JDK 7u51 b11 #section:main ----------messages:(3/108)---------- command: main Test reason: Assumed action based on file name: run main Test elapsed time (seconds): 24.144 ----------System.out:(59/1612)---------- ********************** Test 1: /224.80.80.80 Join: /224.80.80.80 Send packet to: /224.80.80.80 Got packet! - Good. Send packet to: /224.80.80.80 Got packet! - Good. Leave: /224.80.80.80 No packet received within timeout! - Good. Join: /224.80.80.80 Send packet to: /224.80.80.80 Got packet! - Good. Send packet to: /224.80.80.80 Got packet! - Good. Leave: /224.80.80.80 No packet received within timeout! - Good. Test passed. ********************** Test 2: /ff01:0:0:0:0:0:0:a Join: /ff01:0:0:0:0:0:0:a Send packet to: /ff01:0:0:0:0:0:0:a Failed: Unexpected exception thrown: Test failed!! ********************** Test 3: /ff02:0:0:0:0:0:0:a Join: /ff02:0:0:0:0:0:0:a Send packet to: /ff02:0:0:0:0:0:0:a Got packet! - Good. Send packet to: /ff02:0:0:0:0:0:0:a Got packet! - Good. Leave: /ff02:0:0:0:0:0:0:a No packet received within timeout! - Good. Join: /ff02:0:0:0:0:0:0:a Send packet to: /ff02:0:0:0:0:0:0:a Got packet! - Good. Send packet to: /ff02:0:0:0:0:0:0:a Got packet! - Good. Leave: /ff02:0:0:0:0:0:0:a No packet received within timeout! - Good. Test passed. ********************** Test 4: /ff0e:0:0:0:0:0:0:a Join: /ff0e:0:0:0:0:0:0:a Send packet to: /ff0e:0:0:0:0:0:0:a Got packet! - Good. Send packet to: /ff0e:0:0:0:0:0:0:a Got packet! - Good. Leave: /ff0e:0:0:0:0:0:0:a No packet received within timeout! - Good. Join: /ff0e:0:0:0:0:0:0:a Send packet to: /ff0e:0:0:0:0:0:0:a Got packet! - Good. Send packet to: /ff0e:0:0:0:0:0:0:a Got packet! - Good. Leave: /ff0e:0:0:0:0:0:0:a No packet received within timeout! - Good. Test passed. ********************** 4 test(s) executed. 1 test(s) failed. ----------System.err:(25/1387)---------- java.io.IOException: No route to host at java.net.PlainDatagramSocketImpl.send(Native Method) at java.net.DatagramSocket.send(DatagramSocket.java:676) at Test.doTest(Test.java:69) at Test.allTests(Test.java:167) at Test.main(Test.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94) at java.lang.Thread.run(Thread.java:744) java.lang.Exception: Test failed - see log file for details at Test.main(Test.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94) at java.lang.Thread.run(Thread.java:744) JavaTest Message: Test threw exception: java.lang.Exception: Test failed - see log file for details JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.Exception: Test failed - see log file for details
16-12-2013

EVALUATION Seems to be an OS bug. IPv6 groups work fine with AF_INET6 and IPv4 groups work fine with AF_INET (java.net.preferIPv4Stack=true). But since the default configuration is to use AF_INET6 sockets with both IPv4 and IPv6, the end result is that the function works for IPv6 groups but not IPv4. There doesn't seem to be any workaround.
19-12-2011