yes, the fix looks fine, and I verified the individual isReachable test on the test host where it failed.

it is possible to refactor the function

Java_java_net_Inet4AddressImpl_isReachable0

a little, by extracting the newly re-introduced "else" block into its own function
e.g. wxp_ping4

such that

if (isVistaSP1OrGreater()) {
        jint src_addr = 0;
        jint dest_addr = 0;
        jbyte caddr[4];
        int sz;
/**
         * Convert IP address from byte array to integer
         */
        sz = (*env)->GetArrayLength(env, addrArray);
        if (sz != 4) {
          return JNI_FALSE;
        }
        memset((char *) caddr, 0, sizeof(caddr));
        (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
        dest_addr = ((caddr[0]<<24) & 0xff000000);
        dest_addr |= ((caddr[1] <<16) & 0xff0000);
        dest_addr |= ((caddr[2] <<8) & 0xff00);
        dest_addr |= (caddr[3] & 0xff);
        dest_addr = htonl(dest_addr);
/**
         * If a network interface was specified, let's convert its address
         * as well.
         */
        if (!(IS_NULL(ifArray))) {
            memset((char *) caddr, 0, sizeof(caddr));
            (*env)->GetByteArrayRegion(env, ifArray, 0, 4, caddr);
            src_addr = ((caddr[0]<<24) & 0xff000000);
            src_addr |= ((caddr[1] <<16) & 0xff0000);
            src_addr |= ((caddr[2] <<8) & 0xff00);
            src_addr |= (caddr[3] & 0xff);
            src_addr = htonl(src_addr);
        }
return ping4(env, src_addr, dest_addr, timeout);
    } else {
        wxp_ping4(env, this, addrArray, timeout, ifArray, ttl)
    }



regards
Mark

On 25/11/2015 15:32, Seán Coffey wrote:
Looks ok to me Rob and provides a re-introduction of the old Java_java_net_Inet4AddressImpl_isReachable0 function for XP systems where necessary. Reviewed.

Approved for jdk8u-dev also.

Regards,
Sean.

On 25/11/15 14:00, Rob McKenna wrote:
forgot to cc net-dev

    -Rob

On 24/11/15 16:37, Rob McKenna wrote:
Hi folks,

The recently updated ICMP (8133015) code fails on Windows XP due to a
missing api. This fix allows XP to fall back to the old tcp based method:

https://bugs.openjdk.java.net/browse/JDK-8141260
http://cr.openjdk.java.net/~robm/8141260/webrev.01/

     -Rob


Reply via email to