mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8233307: MulticastSocket getOption(IP_MULTICAST_IF) returns interface when not set
The MulticastSocket method getOption has been changed to conform to the behavior described in StandardSocketOptions.IP_MULTICAST_IF. Reviewed-by: chegar, dfuchs
This commit is contained in:
parent
558aadf608
commit
55da7d34c9
4 changed files with 150 additions and 67 deletions
|
@ -576,7 +576,7 @@ public class MulticastSocket extends DatagramSocket {
|
|||
public NetworkInterface getNetworkInterface() throws SocketException {
|
||||
NetworkInterface ni
|
||||
= (NetworkInterface)getImpl().getOption(SocketOptions.IP_MULTICAST_IF2);
|
||||
if ((ni.getIndex() == 0) || (ni.getIndex() == -1)) {
|
||||
if (ni == null) {
|
||||
InetAddress[] addrs = new InetAddress[1];
|
||||
addrs[0] = InetAddress.anyLocalAddress();
|
||||
return new NetworkInterface(addrs[0].getHostName(), 0, addrs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue