On Thu, 16 Feb 2023 21:48:19 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> Note that the new code doesn't attempt to sort anything. If it happens to be 
>> sorted by LUID, that's the underlying API at work. The MS docs don't say 
>> anything about ordering, so this is probably an implementation detail and I 
>> wouldn't assume it will always be true.
>> 
>> I'm still running jdk_net, but I can already see that test failing on my 
>> machine. Though it has a different error:
>> 
>> 
>> java.io.IOException: Network interface not configured for IPv4
>>      at 
>> java.base/sun.nio.ch.DatagramChannelImpl.setOption(DatagramChannelImpl.java:389)
>>      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)
>>      at 
>> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>>      at java.base/java.lang.reflect.Method.invoke(Method.java:578)
>>      at 
>> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
>>      at java.base/java.lang.Thread.run(Thread.java:1623)
>> 
>> 
>> So I think when picking the interface to use for the test, we need to also 
>> check that isUp = true and that the list of IP addresses contains at least 
>> one IPv4 address.
>
> Though it's more complicated than that. Some machines may have both IPv6 and 
> IPv4, some machine may only have IPv4, and some machine may only have IPv6. I 
> haven't looked at the test yet, but picking up the right interface on the 
> various platforms has always been an issue for our tests.

So,, apparently this is a Windows feature. [Older socket 
implementation](https://github.com/openjdk/jdk11/blob/37115c8ea4aff13a8148ee2b8832b20888a5d880/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c#L1350)
 had an explicit check for addresses bound to an interface, and only interfaces 
with associated addresses could be used for multicasting.

This needs to be fixed in the test. Can you add a check for addresses to 
`OptionsTest.getNetworkInterface`?

Beyond that, I'm fine with an implementation that unconditionally returns 
`true`.

-------------

PR: https://git.openjdk.org/jdk/pull/12593

Reply via email to