RFR: 8302659: Modernize Windows native code for NetworkInterface [v2]
Daniel Jeliński
djelinski at openjdk.org
Thu Feb 16 19:41:27 UTC 2023
On Thu, 16 Feb 2023 18:59:06 GMT, Rich DiCroce <duke at openjdk.org> wrote:
>> Ha! Apparently I have a machine where the implementation of `supportsMulticast` implementation makes a difference. On my machine the test `jdk/java/net/SocketOption/OptionsTest.java` is failing with:
>>
>> java.net.SocketException: Invalid argument: no further information
>> at java.base/sun.nio.ch.Net.setInterface6(Native Method)
>> at java.base/sun.nio.ch.DatagramChannelImpl.setOption(DatagramChannelImpl.java:377)
>> at java.base/sun.nio.ch.DatagramSocketAdaptor.setOption(DatagramSocketAdaptor.java:431)
>> at java.base/java.net.DatagramSocket.setOption(DatagramSocket.java:1207)
>> at OptionsTest.test(OptionsTest.java:155)
>> at OptionsTest.doMulticastSocketTests(OptionsTest.java:235)
>> at OptionsTest.main(OptionsTest.java:337)
>> ...
>>
>> It works with the current master. Will try to figure it out.
>>
>> BTW. did you try running jdk_net tests?
>
> I ran the tests for NetworkInterface specifically, though that reminds me that I need to open a bug report about fixpath mangling things incorrectly. I'll give the full jdk_net suite a run and see what happens.
ok so here goes: your patch changes the order in which the interfaces are returned; the original code returned them in order of increasing indexes, the new code appears to sort interfaces by LUID.
The failing test uses the first interface for which supportsMulticast returns true. I get `supportsMulticast` = `true` on all interfaces even with the old code.
The interface that happened to be on the first position of my list was:
67 name:ethernet_0 (Hyper-V Virtual Switch Extension Adapter-Hyper-V Virtual Switch Extension Filter-0000)
ifup: true isP2P: false isLoopback: false macAddr: null MTU: 1500 supportsMulticast: true
it has no associated IP addresses, and is not usable with IP_MULTICAST_IF.
(Also it's a filter interface, which means that the old code returned ifUp = false).
Well that would explain how `supportsMulticast` is meant to be used; now we just need to figure out which interfaces can be used for multicasting.
-------------
PR: https://git.openjdk.org/jdk/pull/12593
More information about the build-dev
mailing list