Skip to content

Commit

Permalink
8309591: Socket.setOption(TCP_QUICKACK) uses wrong level
Browse files Browse the repository at this point in the history
Backport-of: 56a73a6f0f3d38379cecea1de5eacb751febca95
  • Loading branch information
shipilev committed Aug 21, 2023
1 parent 04adfb3 commit 32a1c79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/jdk.net/aix/native/libextnet/AIXSocketOptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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;
}
Expand All @@ -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);
}

/*
Expand Down
8 changes: 4 additions & 4 deletions src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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");
}

Expand All @@ -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;
}
Expand All @@ -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);
}

/*
Expand Down

1 comment on commit 32a1c79

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.