RFR: 8304286: java/net/SocketOption/OptionsTest.java failing after JDK-8302659 [v2]
Daniel Jeliński
djelinski at openjdk.org
Mon Mar 20 12:00:32 UTC 2023
On Fri, 17 Mar 2023 07:01:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Yeah, I had something like that before. With security manager installed it will only return the loopback interface, which is not usable for multicasting on Linux.
>>
>> The test is using [this SecurityManager policy](https://github.com/openjdk/jdk/blob/master/test/jdk/java/net/SocketOption/options.policy), which only allows `connect` to `localhost`, so only loopback address will be visible on NetworkInterfaces because of [this check](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/net/NetworkInterface.java#L143)
>
> This test is for socket options rather than a SM test. Also SM is deprecated, for removal. It would be okay to update the test's policy file so that it isn't restricted to just the loopback.
OK then. I updated the SM policy to allow all interface addresses to be retrieved, and updated the test to only consider interfaces with at least one address.
The test is never run with `preferIPv4Stack`, and even if it were, `preferIPv4Stack` would filter out all IPv6 interface addresses.
The only way this test could spuriously fail now is if it got an interface with IPv4 addresses only. Which is possible, but then `test/jdk/java/net/MulticastSocket/SetGetNetworkInterfaceTest.java` would also fail.
-------------
PR: https://git.openjdk.org/jdk/pull/13061
More information about the net-dev
mailing list