Hi Steve, I have looked into this topic. I started some work in that area a few years ago and never finished it. I think the root cause of the issue got already pointed out in this discussion.
The JVM (correctly) detects that the system is capable of IPv6 and hence opens new sockets with address family AF_INET6. This type of socket shall allow for communication in both domains, IPv6 and IPv4. To ensure the dual stack socket, we also set socket option IPV6_V6ONLY to '0' which should make sure it's not an IPv6 only socket. This is the way, the standard TCP/UDP socket communication works in the JDK, also on AIX. Now, for multicasting, the VM wants to set the multicast interface. At that point, the socket is not yet bound to a local address or has joined a multicast group which might restrict the address type. So, we need either setsockopt(IPV6_MULTICAST_IF) or setsockopt(IP_MULTICAST_IF) to work. The documentation cited by Volker (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apis/ssocko.htm) is quite explicit in that IP_MULTICAST_IF is for AF_INET sockets and IPV6_MULTICAST_IF is for AF_INET6 type sockets. So I would expect, that IPV6_MULTICAST_IF works, even for an interface without configured IPv6 address. So, while this is nothing for the compiler folks, it is something for the AIX runtime/network people. Can you address that within IBM? Maybe the AIX experts have a suggestion if there's already a way to code around this. And if it's not possible to get this to work with the existing APIs, would it be possible for you to open a PMR with IBM or find any other means to get that fixed in the OS? Anyway, I think even if IBM can fix this in AIX, it'll be in future versions only. So I'll go ahead and create a patch for modifying the failing tests to be more tolerant to such type of system configurations on AIX. I will send an RFR mail soon. Best regards Christoph From: net-dev <net-dev-boun...@openjdk.java.net> On Behalf Of Steve Groeger Sent: Montag, 14. Januar 2019 15:31 To: Volker Simonis <volker.simo...@gmail.com> Cc: ppc-aix-port-...@openjdk.java.net; net-dev <net-dev@openjdk.java.net> Subject: Re: 8207404: MulticastSocket tests failing on Aix Hi Volker, The reason the mcast_set_if_by_if_v4(env, this, fd, value); probably fails is that the socket that we are trying to set the IPPROTO_IP, IP_MULTICAST_IF options on has been created with the AF_INET6 family, and these options may not be valid. The socket is setup with the AF_INET6 family because ipv6_available() returns true, as the AIX system does support INET6/IPv6. It is just that the interface we are using doesnt have an INET6 address associated with it. I am checking with the AIX/C compiler team in IBM to see if this a bug or not. 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: groe...@uk.ibm.com<mailto:groe...@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: Volker Simonis <volker.simo...@gmail.com<mailto:volker.simo...@gmail.com>> To: Steve Groeger <groe...@uk.ibm.com<mailto:groe...@uk.ibm.com>> Cc: Chris Hegarty <chris.hega...@oracle.com<mailto:chris.hega...@oracle.com>>, net-dev <net-dev@openjdk.java.net<mailto:net-dev@openjdk.java.net>>, ppc-aix-port-...@openjdk.java.net<mailto:ppc-aix-port-...@openjdk.java.net> Date: 14/01/2019 14:11 Subject: Re: 8207404: MulticastSocket tests failing on Aix ________________________________ On Mon, Jan 14, 2019 at 2:19 PM Steve Groeger <groe...@uk.ibm.com<mailto:groe...@uk.ibm.com>> wrote: > > Hi Chris / Volker, > > I had already tried doing the same as is done for Linux, ie calling this first > > mcast_set_if_by_if_v4(env, this, fd, value); > > This still fails for some reason with EADDRNOTAVAIL. Finding this out is probably the main challenge in order to solve this issue and one of the reason why we asked IBM for assistance :) I suppose there must be a possibility to set a socket option for an IPv4 socket on AIX even if IPv6 is enabled. Otherwise this is probably an AIX problem/bug which should be fixed there (where, again, we need assistance from IBM). The man-page (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/apis/ssocko.htm) mentions the following: IP_MULTICAST_IF: et interface over which outgoing multicast datagrams should be sent. This option is only supported for sockets with an address family of AF_INET and type of SOCK_DGRAM or SOCK_RAW. Maybe the interface is erroneously in the AF_INET6 family? The man-page only mentions the following for EADDRNOTAVAIL: EADDRNOTAVAIL: Address not available. For the IP_ADD_MEMBERSHIP or IP_DROP_MEMBERSHIP operations, this error code indicates that an incorrect address was specified for either the imr_multiaddr or imr_interface parameter value. > This error gets cleared by the > > if ((*env)->ExceptionCheck(env)){ > (*env)->ExceptionClear(env); > } > > as ipv6_available() still returns true, but we then still try and call > > mcast_set_if_by_if_v6(env, this, fd, value); > > which again fails with EADDRNOTAVAIL. So we have the same result. > > 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: groe...@uk.ibm.com<mailto:groe...@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.hega...@oracle.com<mailto:chris.hega...@oracle.com>> > To: Volker Simonis > <volker.simo...@gmail.com<mailto:volker.simo...@gmail.com>> > Cc: Steve Groeger <groe...@uk.ibm.com<mailto:groe...@uk.ibm.com>>, > ppc-aix-port-...@openjdk.java.net<mailto:ppc-aix-port-...@openjdk.java.net>, > net-dev <net-dev@openjdk.java.net<mailto:net-dev@openjdk.java.net>> > Date: 12/01/2019 14:21 > Subject: Re: 8207404: MulticastSocket tests failing on Aix > ________________________________ > > > > > > > On 11 Jan 2019, at 17:28, Volker Simonis > > <volker.simo...@gmail.com<mailto:volker.simo...@gmail.com>> wrote: > > > > I think the difference is in setMulticastInterface() in > > PlainDatagramSocketImpl.c > > > > #ifdef __linux__ > > mcast_set_if_by_if_v4(env, this, fd, value); > > if (ipv6_available()) { > > if ((*env)->ExceptionCheck(env)){ > > (*env)->ExceptionClear(env); > > } > > mcast_set_if_by_if_v6(env, this, fd, value); > > } > > #else /* __linux__ not defined */ > > if (ipv6_available()) { > > mcast_set_if_by_if_v6(env, this, fd, value); > > } else { > > mcast_set_if_by_if_v4(env, this, fd, value); > > } > > #endif /* __linux__ */ > > > > We should probably follow the Linux way for AIX as well. > > I agree. > > -Chris. > > >> On Fri, Jan 11, 2019 at 5:29 PM Chris Hegarty > >> <chris.hega...@oracle.com<mailto:chris.hega...@oracle.com>> wrote: > >> > >> > >>> On 09/01/2019 15:20, Steve Groeger wrote: > >>> ... > >>> > >>> 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 is what I observe too. Confirmed by looking at the test > >> output in the jtr file. > >> > >>> This was why I was asking the question on whether this should work on > >>> AIX, or whether it should fail on Linux!!! > >> > >> I suspect that this is an issue with the native setsockopt > >> on AIX. That said, if it cannot be resolved on AIX, then > >> maybe the networking native code on AIX, should workaround > >> it. > >> > >> -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 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