Fix DatagramChannelImpl.setOption(IP_MULTICAST_IF, value) for dual-stack.
When setting multicast interface on IPv6 enabled interface, instead
of just setting IPv6 (IPV6_MULTICAST_IF), we are also setting IPv4
(IP_MULTICAST_IF).
This is done by changing the implementation of setInterface4 using
"struct ip_mreqn" following:
https://android.googlesource.com/platform/libcore/+/master/luni/src/main/native/libcore_io_Linux.cpp#2288
Bug: 144222142
Test: DatagramChannel dc = DatagramChannel.open();
dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, iface);
dc.send(...);
sends datagram with the correct interface even if it is not
a default interface.
Tested on blueline and ARC++ atlas.
Test: dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, iface);
will work on IPv4 and IPv6 only network interface;
Tested on blueline and ARC++ atlas.
Merged-Id: I696aae69c342f9a555fa87a59d170f35eb6ce2b4
Change-Id: I696aae69c342f9a555fa87a59d170f35eb6ce2b4
(cherry picked from commit 3984fafd3b8cefe9ed91dbe682bd0498a8714622)
1 file changed