8207404: MulticastSocket tests failing on Aix

Steve Groeger GROEGES at uk.ibm.com
Wed Jan 9 15:20:21 UTC 2019


Hi Chris, 

Thanks for responding. 

The IPv6 portion of the test is not being executed as you have mentioned. 
The errors I am seeing on AIX are when it runs the IPv4 portion of the 
test.

The AIX system I am running on has IPv6 enabled but the interface that is 
being used 
for the IPv4 test (en0) doesn't have an IPv6/INET6 address configured for 
it. 
As can be seen from the output from the 'ifconfig -a' command

en0: 
flags=1e084863,80480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
        inet 9.xxx.xxx.150 netmask 0xfffffe00 broadcast 9.xxx.xxx.255
         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
lo0: 
flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
        inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
        inet6 ::1%1/64
         tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1 

The test does the following:

try (MulticastSocket soc = new MulticastSocket()) {
    soc.setNetworkInterface(nif);
    soc.joinGroup(group);
    soc.leaveGroup(group);
} catch (IOException e) {
    throw new UncheckedIOException(e);
}

The issue I am gettiing is when the test calls the following line

soc.setNetworkInterface(nif);

which basically ends up throwing an exception from the 
mcast_set_if_by_if_v6 native 
method in java.base/unix/native/libnet/PlainDatagramSocketImpl.c when it 
is doing the 
setsockopt which gets a EADDRNOTAVAIL error and throws an exception. The 
code is:

if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
               (const char*)&index, sizeof(index)) < 0) {
    if (errno == EINVAL && index > 0) {
        JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
            "IPV6_MULTICAST_IF failed (interface has IPv4 "
            "address only?)");
    } else {
        JNU_ThrowByNameWithMessageAndLastError
           (env, JNU_JAVANETPKG "SocketException", "Error setting socket 
option");
    }
    return;
}

If I run the test with   '-Djava.net.preferIPv4Stack=true` it al works 
fine.

Digging into the java code I can see that when the MulticastSocket is 
created using

try (MulticastSocket soc = new MulticastSocket()) {

it ends up in the datagramSocketCreate function in 

Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
                                                           jobject this) {
    jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
    int arg, fd, t = 1;
    char tmpbuf[1024];
    int domain = ipv6_available() ? AF_INET6 : AF_INET;

    if (IS_NULL(fdObj)) {
        JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
                        "Socket closed");
        return;
    }

    if ((fd = socket(domain, SOCK_DGRAM, 0)) == -1) {
        JNU_ThrowByNameWithMessageAndLastError
            (env, JNU_JAVANETPKG "SocketException", "Error creating 
socket");
        return;
    }

where it is creating a socket with a family of AF_INET6 because the 
ipv6_available() function returns true.
then later we are trying to configure an interface on that socket that 
doesnt have an IPv6/INET6 address
and hence why I think we get the EADDRNOTAVAIL error.

I think I have an Linux system setup with a simarly configured interface 
(system has IPv6 configured but interface 
has no IPv6/INET6 address configured) but the test works fine when run on 
that system.

This was why I was asking the question on whether this should work on AIX, 
or whether it should fail on Linux!!! 

Hoping that with the description above you might be able to let me know 
what the expected behaviour is.

Thanks
Steve Groeger
IBM Runtime Technologies
Hursley, Winchester
Tel: (44) 1962 816911  Mobex: 279990  Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groeges at uk.ibm.com

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



From:   Chris Hegarty <chris.hegarty at oracle.com>
To:     Steve Groeger <GROEGES at uk.ibm.com>, net-dev at openjdk.java.net
Cc:     ppc-aix-port-dev at openjdk.java.net
Date:   07/01/2019 14:34
Subject:        Re: 8207404: MulticastSocket tests failing on Aix



Steve,

On 05/12/2018 10:50, Steve Groeger wrote:
> Posting this to net-dev as well as ppc-aix-port-dev as this may be a 
> more appropriate mailing list to get responses about networking.
> 
> I have performed the test Volker mentioned in an earlier post (on xLinux 

> machine, remove the ipv6 address from the ens32 interface but leaving 
> inte6 enabled on the system).
> With this configuration the jdk/java/net/MulticastSocket/JoinLeave.java 
> test still passes, whereas on AIX with a similar configuration the test 
> fails.
> For those with knowledge of networking, should this MulticastSocket test 

> pass if there is no ipv6 address enabled for the interface being used.

If there is no interface, that supports multicasting, with an IPv6 
address, then the test will not execute the particular IPv6 multicasting 
scenario. That is fine, the IPv6 portion of the test is effectively 
skipped, since it cannot be tested on the particular platform. ( One 
could separate IPv4 from IPv6 in this test, and rather return a jtreg 
skipped status if a suitable interface with IPv6 is not found. But is 
does not seem worth while. )

-Chris.




Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190109/fc3a71e3/attachment.html>


More information about the net-dev mailing list