8285671: java/nio/channels/etc/PrintSupportedOptions.java and java/nio/channels/DatagramChannel/AfterDisconnect.java are failing
Reviewed-by: dfuchs
This commit is contained in:
parent
4919525ddb
commit
ef27081fe7
src/jdk.net
linux/classes/jdk/net
macosx
share/classes/jdk/net
windows/classes/jdk/net
test/jdk
@ -58,6 +58,11 @@ class LinuxSocketOptions extends PlatformSocketOptions {
|
||||
return keepAliveOptionsSupported0();
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean ipDontFragmentSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean peerCredentialsSupported() {
|
||||
return true;
|
||||
}
|
||||
|
@ -43,6 +43,11 @@ class MacOSXSocketOptions extends PlatformSocketOptions {
|
||||
return keepAliveOptionsSupported0();
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean ipDontFragmentSupported() {
|
||||
return ipDontFragmentSupported0();
|
||||
}
|
||||
|
||||
@Override
|
||||
void setTcpkeepAliveProbes(int fd, final int value) throws SocketException {
|
||||
setTcpkeepAliveProbes0(fd, value);
|
||||
@ -108,6 +113,8 @@ class MacOSXSocketOptions extends PlatformSocketOptions {
|
||||
private static native boolean getIpDontFragment0(int fd) throws SocketException;
|
||||
private static native long getSoPeerCred0(int fd) throws SocketException;
|
||||
private static native boolean keepAliveOptionsSupported0();
|
||||
private static native boolean ipDontFragmentSupported0();
|
||||
|
||||
static {
|
||||
if (System.getSecurityManager() == null) {
|
||||
System.loadLibrary("extnet");
|
||||
|
@ -189,6 +189,35 @@ static int socketFamily(jint fd) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: jdk_net_MacOSXSocketOptions
|
||||
* Method: ipDontFragmentSupported0
|
||||
* Signature: ()Z;
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_jdk_net_MacOSXSocketOptions_ipDontFragmentSupported0
|
||||
(JNIEnv *env, jobject unused) {
|
||||
jint rv, fd, value;
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (fd == -1)
|
||||
return JNI_FALSE;
|
||||
value = 1;
|
||||
rv = setsockopt(fd, IPPROTO_IP, IP_DONTFRAG, &value, sizeof(value));
|
||||
close(fd);
|
||||
if (rv == -1) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
fd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if (fd == -1)
|
||||
return JNI_FALSE;
|
||||
value = 1;
|
||||
rv = setsockopt(fd, IPPROTO_IPV6, IPV6_DONTFRAG, &value, sizeof(value));
|
||||
close(fd);
|
||||
if (rv == -1) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: jdk_net_MacOSXSocketOptions
|
||||
* Method: setIpDontFragment0
|
||||
|
@ -232,6 +232,8 @@ public final class ExtendedSocketOptions {
|
||||
platformSocketOptions.peerCredentialsSupported();
|
||||
private static final boolean incomingNapiIdOptSupported =
|
||||
platformSocketOptions.incomingNapiIdSupported();
|
||||
private static final boolean ipDontFragmentSupported =
|
||||
platformSocketOptions.ipDontFragmentSupported();
|
||||
|
||||
private static final Set<SocketOption<?>> extendedOptions = options();
|
||||
|
||||
@ -249,7 +251,9 @@ public final class ExtendedSocketOptions {
|
||||
if (peerCredentialsSupported) {
|
||||
options.add(SO_PEERCRED);
|
||||
}
|
||||
options.add(IP_DONTFRAGMENT);
|
||||
if (ipDontFragmentSupported) {
|
||||
options.add(IP_DONTFRAGMENT);
|
||||
}
|
||||
return Collections.unmodifiableSet(options);
|
||||
}
|
||||
|
||||
@ -438,6 +442,10 @@ public final class ExtendedSocketOptions {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ipDontFragmentSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void setTcpkeepAliveProbes(int fd, final int value) throws SocketException {
|
||||
throw new UnsupportedOperationException("unsupported TCP_KEEPCNT option");
|
||||
}
|
||||
|
@ -36,6 +36,11 @@ class WindowsSocketOptions extends PlatformSocketOptions {
|
||||
public WindowsSocketOptions() {
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean ipDontFragmentSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
void setIpDontFragment(int fd, final boolean value) throws SocketException {
|
||||
setIpDontFragment0(fd, value);
|
||||
|
@ -564,9 +564,6 @@ java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc6
|
||||
|
||||
java/nio/channels/DatagramChannel/ManySourcesAndTargets.java 8264385 macosx-aarch64
|
||||
|
||||
java/nio/channels/etc/PrintSupportedOptions.java 8285671 macosx-x64
|
||||
java/nio/channels/DatagramChannel/AfterDisconnect.java 8285671 macosx-x64
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_rmi
|
||||
|
@ -23,8 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8243099
|
||||
* @bug 8243099 8285671
|
||||
* @modules jdk.net
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.Platform
|
||||
* @run main/othervm DontFragmentTest ipv4
|
||||
* @run main/othervm DontFragmentTest ipv6
|
||||
*/
|
||||
@ -32,13 +34,17 @@
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.nio.channels.*;
|
||||
import jdk.test.lib.Platform;
|
||||
import static java.net.StandardProtocolFamily.INET;
|
||||
import static java.net.StandardProtocolFamily.INET6;
|
||||
import static jdk.net.ExtendedSocketOptions.IP_DONTFRAGMENT;
|
||||
|
||||
public class DontFragmentTest {
|
||||
|
||||
private static boolean isMacos;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
isMacos = Platform.isOSX();
|
||||
testDatagramChannel();
|
||||
StandardProtocolFamily fam = args[0].equals("ipv4") ? INET : INET6;
|
||||
System.out.println("Family = " + fam);
|
||||
@ -55,9 +61,34 @@ public class DontFragmentTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the option is supported, false if not supported.
|
||||
* Throws exception if it is not supported, but should be
|
||||
*/
|
||||
static boolean checkSupported(DatagramChannel c1) throws IOException {
|
||||
boolean supported = c1.supportedOptions().contains(IP_DONTFRAGMENT);
|
||||
|
||||
if (!isMacos && !supported) {
|
||||
throw new RuntimeException("IP_DONTFRAGMENT should be supported");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
static boolean checkSupported(DatagramSocket c1) throws IOException {
|
||||
boolean supported = c1.supportedOptions().contains(IP_DONTFRAGMENT);
|
||||
|
||||
if (!isMacos && !supported) {
|
||||
throw new RuntimeException("IP_DONTFRAGMENT should be supported");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
public static void testDatagramChannel() throws IOException {
|
||||
try (DatagramChannel c1 = DatagramChannel.open()) {
|
||||
|
||||
if (!checkSupported(c1)) {
|
||||
return;
|
||||
}
|
||||
if (c1.getOption(IP_DONTFRAGMENT)) {
|
||||
throw new RuntimeException("IP_DONTFRAGMENT should not be set");
|
||||
}
|
||||
@ -75,6 +106,9 @@ public class DontFragmentTest {
|
||||
public static void testDatagramChannel(String[] args, ProtocolFamily fam) throws IOException {
|
||||
try (DatagramChannel c1 = DatagramChannel.open(fam)) {
|
||||
|
||||
if (!checkSupported(c1)) {
|
||||
return;
|
||||
}
|
||||
if (c1.getOption(IP_DONTFRAGMENT)) {
|
||||
throw new RuntimeException("IP_DONTFRAGMENT should not be set");
|
||||
}
|
||||
@ -90,6 +124,9 @@ public class DontFragmentTest {
|
||||
}
|
||||
|
||||
public static void testDatagramSocket(DatagramSocket c1) throws IOException {
|
||||
if (!checkSupported(c1)) {
|
||||
return;
|
||||
}
|
||||
if (c1.getOption(IP_DONTFRAGMENT)) {
|
||||
throw new RuntimeException("IP_DONTFRAGMENT should not be set");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user