[openjdk-x] Bind to a multicast address fails
Andre Naujoks
nautsch2 at gmail.com
Fri Sep 7 12:22:47 UTC 2018
On 9/7/18 1:57 PM, Alan Bateman wrote:
> On 07/09/2018 12:33, Andre Naujoks wrote:
>> :
>> Hi Alan.
>>
>> First of all, thank you for the quick reply. I was not aware, that there
>> was actually a bug opened for that issue.
>>
>> The join is not the problem at this point. We need to bind the socket to
>> the address to avoid receiving traffic from all multicast groups, that
>> are joined on the system. Since a join joins the system (not the socket)
>> to the group, all sockets bound to a port, which receive multicast
>> traffic will receive all of that traffic, no matter the destination
>> address. The bind prevents that. IP_MULTICAST_ALL sadly only works for
>> IPv4 and the patch I tried to get IPV6_MULTICAST_ALL upstream into the
>> kernel was even more sadly (almost) ignored. see
>> https://marc.info/?l=linux-netdev&m=152344460530252&w=2
>>
> The JDK sets IP_MULTICAST_ALL to 0 on Linux to avoid this interference
> and get the behavior consistent with other platforms. It's news to me
> that it doesn't work on IPv6 as we always disable it, even if the socket
> is IPv6. Does it work when the IPv6 socket joins an IPv4 multicast group?
I have not tried joining IPv4 groups on an IPv6 socket through java,
since we do not use IPv4 at all in this particular environment. I have
tried setting IP_MULTICAST_ALL to 0 in the IPv6 scenario (in a C++
project), hoping it would help, but it did not. Hence the patch for the
linux kernel.
Would it actually help, if I tried the IPv4 multicast group bind on an
IPv6 socket?
The bind to an address would be a workaround for the missing
IPV6_MULTICAST_ALL handling.
Andre
>
> -Alan.
>
More information about the net-dev
mailing list