Mercurial > hg > icedtea6
changeset 3209:f84a2e0540fa
PR2565: Replace ipv4-mapped-ipv6-addresses.patch with upstream fix 6882910
2015-07-28 Andrew John Hughes <gnu.andrew@redhat.com>
PR2565: Replace ipv4-mapped-ipv6-addresses.patch
with upstream fix 6882910
* Makefile.am:
(ICEDTEA_PATCHES): Add new patch.
* NEWS: Updated. Bump release date.
* patches/ipv4-mapped-ipv6-addresses.patch:
Remove code changes, leaving just the test case.
* patches/openjdk/6882910-ipv6only.patch:
New patch, backporting 6882910 as a replacement
for the older ipv4-mapped-ipv6-addresses.patch
author | Andrew John Hughes <gnu.andrew@redhat.com> |
---|---|
date | Thu, 30 Jul 2015 22:42:11 +0100 |
parents | 6457627bec31 |
children | acc83d51b013 |
files | ChangeLog Makefile.am NEWS patches/ipv4-mapped-ipv6-addresses.patch patches/openjdk/6882910-ipv6only.patch |
diffstat | 5 files changed, 207 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 22 22:29:27 2015 +0100 +++ b/ChangeLog Thu Jul 30 22:42:11 2015 +0100 @@ -1,3 +1,16 @@ +2015-07-28 Andrew John Hughes <gnu.andrew@redhat.com> + + PR2565: Replace ipv4-mapped-ipv6-addresses.patch + with upstream fix 6882910 + * Makefile.am: + (ICEDTEA_PATCHES): Add new patch. + * NEWS: Updated. Bump release date. + * patches/ipv4-mapped-ipv6-addresses.patch: + Remove code changes, leaving just the test case. + * patches/openjdk/6882910-ipv6only.patch: + New patch, backporting 6882910 as a replacement + for the older ipv4-mapped-ipv6-addresses.patch + 2015-07-22 Andrew John Hughes <gnu.andrew@redhat.com> PR2559: generated directory gets confused with
--- a/Makefile.am Wed Jul 22 22:29:27 2015 +0100 +++ b/Makefile.am Thu Jul 30 22:42:11 2015 +0100 @@ -371,6 +371,7 @@ patches/openjdk/6967533-pre_epoch.patch \ patches/fonts-gentoo.patch \ patches/ipv4-mapped-ipv6-addresses.patch \ + patches/openjdk/6882910-ipv6only.patch \ patches/jtreg-OpenGLContextInit.patch \ patches/openjdk/6510892-httpserver_test.patch \ patches/jtreg-international-fonts.patch \
--- a/NEWS Wed Jul 22 22:29:27 2015 +0100 +++ b/NEWS Thu Jul 30 22:42:11 2015 +0100 @@ -133,6 +133,7 @@ - PR2508, G541462: Only apply PaX markings by default on running PaX kernels - PR2556, G390663: Update Gentoo font configuration and allow font directory to be specified - PR2559: generated directory gets confused with generated alias + - PR2565: Replace ipv4-mapped-ipv6-addresses.patch with upstream fix 6882910 * CACAO - PR829: Raise javadoc and JAVAC_FLAGS memory limits for CACAO * JamVM
--- a/patches/ipv4-mapped-ipv6-addresses.patch Wed Jul 22 22:29:27 2015 +0100 +++ b/patches/ipv4-mapped-ipv6-addresses.patch Thu Jul 30 22:42:11 2015 +0100 @@ -1,114 +1,3 @@ -diff -ruN openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c ---- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2010-02-17 04:14:47.000000000 +0100 -+++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2010-03-27 20:24:26.000000000 +0100 -@@ -37,6 +37,8 @@ - - #include <sys/poll.h> - -+#include "net_util.h" -+ - /* - * Stack allocated by thread when doing blocking operation - */ -@@ -301,9 +303,16 @@ - BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) ); - } - --int NET_Connect(int s, struct sockaddr *addr, int addrlen) { -+static int NET_Connect_final(int s, struct sockaddr *addr, int addrlen) { - BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) ); - } -+int NET_Connect(int s, struct sockaddr *addr, int addrlen) { -+ int rv = check_ipv4mapped_address(s, addr); -+ if (rv < 0) { -+ return rv; -+ } -+ return NET_Connect_final(s, addr, addrlen); -+} - - #ifndef USE_SELECT - int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { -diff -ruN openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.c openjdk/jdk/src/solaris/native/java/net/net_util_md.c ---- openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.c 2010-02-17 04:14:47.000000000 +0100 -+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c 2010-03-27 19:44:32.000000000 +0100 -@@ -1215,6 +1215,39 @@ - return setsockopt(fd, level, opt, arg, len); - } - -+/* -+ * Check for IPv4 mapped or unspecified IPv6 addresses and disable -+ * IPV6_V6ONLY in such cases. This function is called from NET_Bind and -+ * NET_Connect and fixes -+ * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 . -+ */ -+int -+check_ipv4mapped_address(int fd, struct sockaddr *him) -+{ -+#if defined(AF_INET6) -+ if (ipv6_available()) { -+ struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him; -+ /* switch off IPV6_V6ONLY if needed */ -+ if (IN6_IS_ADDR_V4MAPPED(& him6->sin6_addr) || -+ IN6_IS_ADDR_UNSPECIFIED(& him6->sin6_addr)) { -+ int value = 42; -+ int len = sizeof(value); -+ int rv = getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, -+ &value, &len); -+ if (rv < 0) { -+ return rv; -+ } -+ if (value > 0) { -+ value = 0; -+ return setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, -+ &value, sizeof(value)); -+ } -+ } -+ } -+#endif -+ return 0; -+} -+ - /* - * Wrapper for bind system call - performs any necessary pre/post - * processing to deal with OS specific issues :- -@@ -1251,6 +1284,11 @@ - } - #endif - -+ rv = check_ipv4mapped_address(fd, him); -+ if (rv < 0) { -+ return rv; -+ } -+ - #if defined(__solaris__) && defined(AF_INET6) - /* - * Solaris 8/9 have seperate IPv4 and IPv6 port spaces so we -diff -ruN openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.h openjdk/jdk/src/solaris/native/java/net/net_util_md.h ---- openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.h 2010-02-17 04:14:47.000000000 +0100 -+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.h 2010-03-27 20:24:26.000000000 +0100 -@@ -36,6 +36,7 @@ - #include <sys/poll.h> - #endif - -+extern int check_ipv4mapped_address(int fd, struct sockaddr *him); - - #ifdef __linux__ - extern int NET_Timeout(int s, long timeout); -diff -ruN openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c ---- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2010-03-27 20:23:58.000000000 +0100 -+++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2010-03-27 20:24:26.000000000 +0100 -@@ -401,8 +401,9 @@ - */ - SET_NONBLOCKING(fd); - -- /* no need to use NET_Connect as non-blocking */ -- connect_rv = connect(fd, (struct sockaddr *)&him, len); -+ /* no need to use NET_Connect as non-blocking; BUT! We want to -+ * support IPv4 mapped IPv6 adresses. */ -+ connect_rv = NET_Connect(fd, (struct sockaddr *)&him, len); - - /* connection not established immediately */ - if (connect_rv != 0) { --- /dev/null 2010-08-03 19:26:41.444667773 +0100 +++ openjdk/jdk/test/java/net/Socket/Bindv6Only.java 2010-08-05 15:41:55.000000000 +0100 @@ -0,0 +1,57 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6882910-ipv6only.patch Thu Jul 30 22:42:11 2015 +0100 @@ -0,0 +1,192 @@ +# HG changeset patch +# User chegar +# Date 1281457843 -3600 +# Tue Aug 10 17:30:43 2010 +0100 +# Node ID 1f996198877b92f4d8b4fd491a853f36a0d8cb69 +# Parent 3e239fe92832ba314672b8f1780f68c877b588cb +6882910: Unexplained lack of IP4 network ability when transparent IP6 to IP4 is disabled. +Reviewed-by: alanb + +diff -r bb7457f945ea src/solaris/native/java/net/PlainDatagramSocketImpl.c +--- openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Mon Jul 20 18:57:32 2015 +0100 ++++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c Mon Jul 27 18:58:42 2015 +0100 +@@ -1047,30 +1047,38 @@ + Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env, + jobject this) { + jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID); +- int fd; +- +- int t = 1; ++ int fd, t = 1; ++#ifdef AF_INET6 ++ int domain = ipv6_available() ? AF_INET6 : AF_INET; ++#else ++ int domain = AF_INET; ++#endif + + if (IS_NULL(fdObj)) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", + "Socket closed"); + return; +- } else { +-#ifdef AF_INET6 +- if (ipv6_available()) { +- fd = JVM_Socket(AF_INET6, SOCK_DGRAM, 0); +- } else +-#endif /* AF_INET6 */ +- { +- fd = JVM_Socket(AF_INET, SOCK_DGRAM, 0); +- } + } +- if (fd == JVM_IO_ERR) { ++ ++ if ((fd = JVM_Socket(domain, SOCK_DGRAM, 0)) == JVM_IO_ERR) { + NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", + "Error creating socket"); + return; + } + ++#ifdef AF_INET6 ++ /* Disable IPV6_V6ONLY to ensure dual-socket support */ ++ if (domain == AF_INET6) { ++ int arg = 0; ++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, ++ sizeof(int)) < 0) { ++ NET_ThrowNew(env, errno, "cannot set IPPROTO_IPV6"); ++ close(fd); ++ return; ++ } ++ } ++#endif /* AF_INET6 */ ++ + setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int)); + + #ifdef __linux__ +@@ -1083,7 +1091,7 @@ + * On Linux for IPv6 sockets we must set the hop limit + * to 1 to be compatible with default ttl of 1 for IPv4 sockets. + */ +- if (ipv6_available()) { ++ if (domain == AF_INET6) { + int ttl = 1; + setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&ttl, + sizeof(ttl)); +diff -r bb7457f945ea src/solaris/native/java/net/PlainSocketImpl.c +--- openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c Mon Jul 20 18:57:32 2015 +0100 ++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c Mon Jul 27 18:58:42 2015 +0100 +@@ -251,6 +251,12 @@ + jboolean stream) { + jobject fdObj, ssObj; + int fd; ++ int type = (stream ? SOCK_STREAM : SOCK_DGRAM); ++#ifdef AF_INET6 ++ int domain = ipv6_available() ? AF_INET6 : AF_INET; ++#else ++ int domain = AF_INET; ++#endif + + if (socketExceptionCls == NULL) { + jclass c = (*env)->FindClass(env, "java/net/SocketException"); +@@ -264,25 +270,29 @@ + (*env)->ThrowNew(env, socketExceptionCls, "null fd object"); + return; + } +-#ifdef AF_INET6 +- if (ipv6_available()) { +- fd = JVM_Socket(AF_INET6, (stream ? SOCK_STREAM: SOCK_DGRAM), 0); +- } else +-#endif /* AF_INET6 */ +- { +- fd = JVM_Socket(AF_INET, (stream ? SOCK_STREAM: SOCK_DGRAM), 0); +- } +- if (fd == JVM_IO_ERR) { ++ ++ if ((fd = JVM_Socket(domain, type, 0)) == JVM_IO_ERR) { + /* note: if you run out of fds, you may not be able to load + * the exception class, and get a NoClassDefFoundError + * instead. + */ + NET_ThrowNew(env, errno, "can't create socket"); + return; +- } else { +- (*env)->SetIntField(env, fdObj, IO_fd_fdID, fd); + } + ++#ifdef AF_INET6 ++ /* Disable IPV6_V6ONLY to ensure dual-socket support */ ++ if (domain == AF_INET6) { ++ int arg = 0; ++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, ++ sizeof(int)) < 0) { ++ NET_ThrowNew(env, errno, "cannot set IPPROTO_IPV6"); ++ close(fd); ++ return; ++ } ++ } ++#endif /* AF_INET6 */ ++ + /* + * If this is a server socket then enable SO_REUSEADDR + * automatically and set to non blocking. +@@ -291,9 +301,15 @@ + if (ssObj != NULL) { + int arg = 1; + SET_NONBLOCKING(fd); +- JVM_SetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, +- sizeof(arg)); ++ if (JVM_SetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, ++ sizeof(arg)) < 0) { ++ NET_ThrowNew(env, errno, "cannot set SO_REUSEADDR"); ++ close(fd); ++ return; ++ } + } ++ ++ (*env)->SetIntField(env, fdObj, IO_fd_fdID, fd); + } + + /* +diff -r bb7457f945ea src/solaris/native/sun/nio/ch/Net.c +--- openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c Mon Jul 20 18:57:32 2015 +0100 ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c Mon Jul 27 18:58:42 2015 +0100 +@@ -65,17 +65,33 @@ + jboolean reuse) + { + int fd; ++ int type = (stream ? SOCK_STREAM : SOCK_DGRAM); ++#ifdef AF_INET6 ++ int domain = ipv6_available() ? AF_INET6 : AF_INET; ++#else ++ int domain = AF_INET; ++#endif + +-#ifdef AF_INET6 +- if (ipv6_available()) +- fd = socket(AF_INET6, (stream ? SOCK_STREAM : SOCK_DGRAM), 0); +- else +-#endif /* AF_INET6 */ +- fd = socket(AF_INET, (stream ? SOCK_STREAM : SOCK_DGRAM), 0); +- ++ fd = socket(domain, type, 0); + if (fd < 0) { + return handleSocketError(env, errno); + } ++ ++#ifdef AF_INET6 ++ /* Disable IPV6_V6ONLY to ensure dual-socket support */ ++ if (domain == AF_INET6) { ++ int arg = 0; ++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, ++ sizeof(int)) < 0) { ++ JNU_ThrowByNameWithLastError(env, ++ JNU_JAVANETPKG "SocketException", ++ "sun.nio.ch.Net.setIntOption"); ++ close(fd); ++ return -1; ++ } ++ } ++#endif ++ + if (reuse) { + int arg = 1; + if (NET_SetSockOpt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&arg,