[8u-dev] Request for backport approval: 8156521: Minor fixes and cleanups in NetworkInterface.c

Chris Hegarty chris.hegarty at oracle.com
Wed May 25 09:06:33 UTC 2016


> On 25 May 2016, at 09:12, Seán Coffey <sean.coffey at oracle.com> wrote:
> 
> Approved for jdk8u-dev integration but please ensure you get one review of the jdk8u edits before pushing.
> 
> Regards,
> Sean.
> 
> On 24/05/2016 22:43, Langer, Christoph wrote:
>> Hi,
>> 
>> 
>> 
>> Would you please approve backporting this fix?
>> 
>> 
>> 
>> Original Bug: https://bugs.openjdk.java.net/browse/JDK-8156521
>> 
>> Jdk9 change: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/fe3e1508653e
>> 
>> Jdk9 review thread: http://mail.openjdk.java.net/pipermail/net-dev/2016-May/009771.html
>> 
>> 
>> 
>> I had to modify the jdk9 patch a little bit to get it to apply to 8udev. This is the according webrev: http://cr.openjdk.java.net/~clanger/webrevs/8156521.8udev/

I’ve taken a look at this and it looks fine. It is a nice cleanup. Is the motivation
for the backport request, or something else ? Just curious.

Comparing against JDK 9 ( modulo the removal of JVM_ functions and the
InetAddress IDs), I have the following suggestions, that will help keep the 
code more consistent.

diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c
--- a/src/solaris/native/java/net/NetworkInterface.c
+++ b/src/solaris/native/java/net/NetworkInterface.c
@@ -684,7 +684,7 @@
     }
 
     // Create the array of InetAddresses
-    addrArr = (*env)->NewObjectArray(env, addr_count,  ni_iacls, NULL);
+    addrArr = (*env)->NewObjectArray(env, addr_count, ni_iacls, NULL);
     if (addrArr == NULL) {
         return NULL;
     }
@@ -734,7 +734,7 @@
             int scope=0;
             iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
             if (iaObj) {
-                int ret = setInet6Address_ipaddress(env, iaObj, 
+                jboolean ret = setInet6Address_ipaddress(env, iaObj,
                     (char *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr));
                 if (ret == JNI_FALSE) {
                     return NULL;
@@ -1071,12 +1071,12 @@
  * if it falls return AF_INET6 socket.
  */
 // unused arg ifname and struct if2
-static int openSocketWithFallback(JNIEnv *env, const char *ifname){
+static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
     int sock;
     struct ifreq if2;
 
     if ((sock = JVM_Socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-        if (errno == EPROTONOSUPPORT){
+        if (errno == EPROTONOSUPPORT) {
             if ((sock = JVM_Socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
                 NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                              "IPV6 Socket creation failed");
@@ -1873,7 +1873,7 @@
     struct ifreq if2;
 
      if ((sock = JVM_Socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-         if (errno == EPROTONOSUPPORT){
+         if (errno == EPROTONOSUPPORT) {
               if ((sock = JVM_Socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
                  NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                               "IPV6 Socket creation failed");


-Chris.


More information about the jdk8u-dev mailing list