--- old/src/java.base/share/classes/sun/nio/ch/Net.java 2020-01-06 11:04:36.000000000 +0000 +++ new/src/java.base/share/classes/sun/nio/ch/Net.java 2020-01-06 11:04:35.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -615,50 +615,83 @@ // -- Multicast support -- /** - * Join IPv4 multicast group + * Join IPv4 multicast group, optionally source-specific. + * + * @param fd file descriptor + * @param group IPv4 multicast group + * @param index index of network interface + * @param infAddress IPv4 address that identifies network interface + * @param source IPv4 source address or 0 + * @return 0 or IOS_UNAVAILABLE */ - static int join4(FileDescriptor fd, int group, int interf, int source) + static int join4(FileDescriptor fd, int group, int index, int infAddress, int source) throws IOException { - return joinOrDrop4(true, fd, group, interf, source); + return joinOrDrop4(true, fd, group, index, infAddress, source); } /** - * Drop membership of IPv4 multicast group + * Drop membership of IPv4 multicast group, optionally source-specific. + * + * @param fd file descriptor + * @param group IPv4 multicast group + * @param index index of network interface + * @param infAddress IPv4 address that identifies network interface + * @param source IPv4 source address or 0 */ - static void drop4(FileDescriptor fd, int group, int interf, int source) + static void drop4(FileDescriptor fd, int group, int index, int infAddress, int source) throws IOException { - joinOrDrop4(false, fd, group, interf, source); + joinOrDrop4(false, fd, group, index, infAddress, source); } - private static native int joinOrDrop4(boolean join, FileDescriptor fd, int group, int interf, int source) + private static native int joinOrDrop4(boolean join, FileDescriptor fd, int group, + int index, int infAddress, int source) throws IOException; /** * Block IPv4 source + * + * @param fd file descriptor + * @param group IPv4 multicast group + * @param index index of network interface + * @param infAddress IPv4 address that identifies network interface + * @param source IPv4 source address + * @return 0 or IOS_UNAVAILABLE */ - static int block4(FileDescriptor fd, int group, int interf, int source) + static int block4(FileDescriptor fd, int group, int index, int infAddress, int source) throws IOException { - return blockOrUnblock4(true, fd, group, interf, source); + return blockOrUnblock4(true, fd, group, index, infAddress, source); } /** - * Unblock IPv6 source + * Unblock IPv4 source + * + * @param fd file descriptor + * @param group IPv4 multicast group + * @param index index of network interface + * @param infAddress IPv4 address that identifies network interface + * @param source IPv4 source address */ - static void unblock4(FileDescriptor fd, int group, int interf, int source) + static void unblock4(FileDescriptor fd, int group, int index, int infAddress, int source) throws IOException { - blockOrUnblock4(false, fd, group, interf, source); + blockOrUnblock4(false, fd, group, index, infAddress, source); } private static native int blockOrUnblock4(boolean block, FileDescriptor fd, int group, - int interf, int source) + int index, int infAddress, int source) throws IOException; /** - * Join IPv6 multicast group + * Join IPv6 multicast group, optionally source-specific. + * + * @param fd file descriptor + * @param group IPv6 multicast group address + * @param index index of network interface + * @param source IPv6 source address or 0 + * @return 0 or IOS_UNAVAILABLE */ static int join6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException @@ -668,6 +701,11 @@ /** * Drop membership of IPv6 multicast group + * + * @param fd file descriptor + * @param group IPv6 multicast group address + * @param index index of network interface + * @param source IPv6 source address or 0 */ static void drop6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException @@ -675,11 +713,18 @@ joinOrDrop6(false, fd, group, index, source); } - private static native int joinOrDrop6(boolean join, FileDescriptor fd, byte[] group, int index, byte[] source) + private static native int joinOrDrop6(boolean join, FileDescriptor fd, byte[] group, + int index, byte[] source) throws IOException; /** * Block IPv6 source + * + * @param fd file descriptor + * @param group IPv6 multicast group address + * @param index index of network interface + * @param source IPv6 source address or null + * @return 0 or IOS_UNAVAILABLE */ static int block6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException @@ -689,6 +734,11 @@ /** * Unblock IPv6 source + * + * @param fd file descriptor + * @param group IPv6 multicast group address + * @param index index of network interface + * @param source IPv6 source address or null */ static void unblock6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException @@ -696,10 +746,11 @@ blockOrUnblock6(false, fd, group, index, source); } - static native int blockOrUnblock6(boolean block, FileDescriptor fd, byte[] group, int index, byte[] source) + private static native int blockOrUnblock6(boolean block, FileDescriptor fd, byte[] group, + int index, byte[] source) throws IOException; - static native void setInterface4(FileDescriptor fd, int interf) throws IOException; + static native void setInterface4(FileDescriptor fd, int infAddress) throws IOException; static native int getInterface4(FileDescriptor fd) throws IOException;