RFR [9] 8178161: Default multicast interface on Mac

Michael McMahon michael.x.mcmahon at oracle.com
Thu Apr 6 16:50:36 UTC 2017


Looks fine to me Chris. Stylistically, the boolean tests
in line 104 could remove the == true obviously, but not a big deal.

Michael.

On 06/04/2017, 17:15, Chris Hegarty wrote:
> Because of some peculiarities on Mac the original Mac port brought
> some code that attempts to determine the default network interface
> ( on Mac only ). In all cases, on recent OS and hardware, it now finds
> the Apple peer-to-peer interface, awdl0, which is almost always the
> wrong answer. This is fragile code, and using the more modern APIs
> that support specifying an interface will avoid most of the problems,
> but it is alas still used in many cases. A quick internet search shows
> numerous reports of issues around this. We are also running into
> issues in internal testing.
>
> It is possible for the heuristic to do a little better ( but not too much ),
> by selecting an interface that supports both IPv4 and IPv6, rather
> than just returning the first reasonable one it encounters. This will
> better support the common case where a MulticastSocket, bound
> to the wildcard address, tries to join a multicast group.
>
> http://cr.openjdk.java.net/~chegar/defaultInterface/
>
> Note: this it not a problem when joining a group using the joinGroup
> method that accepts a NetworkInterface ( to join the group on ), or
> using the new NIO MulticastChannel interface. The
> MulticastSocket.joinGroup(InetAddress) are very much legacy, and
> should probably be deprecated at some point in the near future. For
> this issue I’d like to keep the changes as conservative as possible,
> and possibly revisit this in 10.
>
> -Chris.
>


More information about the net-dev mailing list