SCTP do not work with OpenJDK8
Timo Völker
timo.voelker at fh-muenster.de
Tue Jul 31 13:55:03 UTC 2018
Hi,
I found an issue with SCTP support in OpenJDK8 for FreeBSD. In my example
https://github.com/msvoelker/java-sctp/
it happened that OpenJDK8 calls sendmsg with an buffer address != NULL and a buffer length of 0, which is an invalid argument for FreeBSD. I found the code lines in the function Java_sun_nio_ch_sctp_SctpChannelImpl_send0 of
jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c
Besides that, I changed two ifdef statements for FreeBSD. I attach my patch file at the end. If I copy this patch file to the files directory of the OpenJDK8 port, I'm able to install OpenJDK and to run the example application.
sudo cp patch-jdk-src-solaris-native-sun-nio-ch-sctp-SctpChannelImpl.c /usr/ports/java/openjdk8/files
cd /usr/ports/java/openjdk8
sudo make install
I just saw that hwh found this issue already for OpenJDK7.
https://lists.freebsd.org/pipermail/freebsd-java/2010-September/008906.html
Thanks,
Timo
patch-jdk-src-solaris-native-sun-nio-ch-sctp-SctpChannelImpl.c
--- jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c.org 2018-07-26 09:56:49.897172000 +0200
+++ jdk/src/solaris/native/sun/nio/ch/sctp/SctpChannelImpl.c 2018-07-30 16:13:19.116935000 +0200
@@ -330,11 +330,11 @@
break;
case SCTP_ADDR_MADE_PRIM :
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_MADE_PRIM;
-#ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */
+#ifndef __solaris__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */
break;
case SCTP_ADDR_CONFIRMED :
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_CONFIRMED;
-#endif /* __linux__ */
+#endif /* __solaris__ */
}
addressObj = SockAddrToInetSocketAddress(env, (struct sockaddr*)&spc->spc_aaddr);
@@ -445,13 +445,13 @@
} else if (errno == EINTR) {
return IOS_INTERRUPTED;
-#ifdef __linux__
+#ifndef __solaris__
} else if (errno == ENOTCONN) {
/* ENOTCONN when EOF reached */
rv = 0;
/* there will be no control data */
msg->msg_controllen = 0;
-#endif /* __linux__ */
+#endif /* __solaris__ */
} else {
handleSocketError(env, errno);
@@ -568,7 +568,7 @@
/* Set up the msghdr structure for sending */
memset(msg, 0, sizeof (*msg));
memset(cbuf, 0, cbuf_size);
- msg->msg_name = &sa;
+ msg->msg_name = (sa_len == 0 ? NULL : &sa);
msg->msg_namelen = sa_len;
iov->iov_base = addr;
iov->iov_len = length;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5243 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-java/attachments/20180731/324266ea/attachment.bin>
More information about the freebsd-java
mailing list