8309591: Socket.setOption(TCP_QUICKACK) uses wrong level

Reviewed-by: djelinski, michaelm, alanb
This commit is contained in:
Vyom Tewari 2023-06-28 02:49:52 +00:00
parent afdaa2a330
commit 56a73a6f0f
2 changed files with 7 additions and 7 deletions

View File

@ -86,7 +86,7 @@ JNIEXPORT void JNICALL Java_jdk_net_AIXSocketOptions_setQuickAck0
int optval;
int rv;
optval = (on ? 1 : 0);
rv = setsockopt(fd, SOL_SOCKET, TCP_NODELAYACK, &optval, sizeof (optval));
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAYACK, &optval, sizeof (optval));
handleError(env, rv, "set option TCP_NODELAYACK failed");
}
@ -99,7 +99,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_AIXSocketOptions_getQuickAck0
(JNIEnv *env, jobject unused, jint fd) {
int on;
socklen_t sz = sizeof (on);
int rv = getsockopt(fd, SOL_SOCKET, TCP_NODELAYACK, &on, &sz);
int rv = getsockopt(fd, IPPROTO_TCP, TCP_NODELAYACK, &on, &sz);
handleError(env, rv, "get option TCP_NODELAYACK failed");
return on != 0;
}
@ -111,7 +111,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_AIXSocketOptions_getQuickAck0
*/
JNIEXPORT jboolean JNICALL Java_jdk_net_AIXSocketOptions_quickAckSupported0
(JNIEnv *env, jobject unused) {
return socketOptionSupported(SOL_SOCKET, TCP_NODELAYACK);
return socketOptionSupported(IPPROTO_TCP, TCP_NODELAYACK);
}
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, 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
@ -89,7 +89,7 @@ JNIEXPORT void JNICALL Java_jdk_net_LinuxSocketOptions_setQuickAck0
int optval;
int rv;
optval = (on ? 1 : 0);
rv = setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval));
rv = setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &optval, sizeof (optval));
handleError(env, rv, "set option TCP_QUICKACK failed");
}
@ -102,7 +102,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_getQuickAck0
(JNIEnv *env, jobject unused, jint fd) {
int on;
socklen_t sz = sizeof (on);
int rv = getsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &on, &sz);
int rv = getsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &on, &sz);
handleError(env, rv, "get option TCP_QUICKACK failed");
return on != 0;
}
@ -114,7 +114,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_getQuickAck0
*/
JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_quickAckSupported0
(JNIEnv *env, jobject unused) {
return socketOptionSupported(SOL_SOCKET, TCP_QUICKACK);
return socketOptionSupported(IPPROTO_TCP, TCP_QUICKACK);
}
/*