提交 825e6979 编写于 作者: M michaelm

8015743: Address internet addresses

Reviewed-by: alanb, khazra, skoivu
上级 bf489ae9
...@@ -213,6 +213,13 @@ class InetAddress implements java.io.Serializable { ...@@ -213,6 +213,13 @@ class InetAddress implements java.io.Serializable {
this.family = family; this.family = family;
} }
void init(String hostName, int family) {
this.hostName = hostName;
if (family != -1) {
this.family = family;
}
}
String hostName; String hostName;
String getHostName() { String getHostName() {
...@@ -240,7 +247,7 @@ class InetAddress implements java.io.Serializable { ...@@ -240,7 +247,7 @@ class InetAddress implements java.io.Serializable {
} }
/* Used to store the serializable fields of InetAddress */ /* Used to store the serializable fields of InetAddress */
private final transient InetAddressHolder holder; final transient InetAddressHolder holder;
InetAddressHolder holder() { InetAddressHolder holder() {
return holder; return holder;
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
*/ */
jclass ia6_class; jclass ia6_class;
jfieldID ia6_holder6ID;
jfieldID ia6_ipaddressID; jfieldID ia6_ipaddressID;
jfieldID ia6_scopeidID; jfieldID ia6_scopeidID;
jfieldID ia6_cachedscopeidID; jfieldID ia6_cachedscopeidID;
...@@ -47,19 +49,24 @@ jmethodID ia6_ctrID; ...@@ -47,19 +49,24 @@ jmethodID ia6_ctrID;
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls) { Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls) {
jclass ia6h_class;
jclass c = (*env)->FindClass(env, "java/net/Inet6Address"); jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
CHECK_NULL(c); CHECK_NULL(c);
ia6_class = (*env)->NewGlobalRef(env, c); ia6_class = (*env)->NewGlobalRef(env, c);
CHECK_NULL(ia6_class); CHECK_NULL(ia6_class);
ia6_ipaddressID = (*env)->GetFieldID(env, ia6_class, "ipaddress", "[B"); ia6h_class = (*env)->FindClass(env, "java/net/Inet6Address$Inet6AddressHolder");
CHECK_NULL(ia6h_class);
ia6_holder6ID = (*env)->GetFieldID(env, ia6_class, "holder6", "Ljava/net/Inet6Address$Inet6AddressHolder;");
CHECK_NULL(ia6_holder6ID);
ia6_ipaddressID = (*env)->GetFieldID(env, ia6h_class, "ipaddress", "[B");
CHECK_NULL(ia6_ipaddressID); CHECK_NULL(ia6_ipaddressID);
ia6_scopeidID = (*env)->GetFieldID(env, ia6_class, "scope_id", "I"); ia6_scopeidID = (*env)->GetFieldID(env, ia6h_class, "scope_id", "I");
CHECK_NULL(ia6_scopeidID); CHECK_NULL(ia6_scopeidID);
ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I"); ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I");
CHECK_NULL(ia6_cachedscopeidID); CHECK_NULL(ia6_cachedscopeidID);
ia6_scopeidsetID = (*env)->GetFieldID(env, ia6_class, "scope_id_set", "Z"); ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z");
CHECK_NULL(ia6_scopeidID); CHECK_NULL(ia6_scopeidID);
ia6_scopeifnameID = (*env)->GetFieldID(env, ia6_class, "scope_ifname", "Ljava/net/NetworkInterface;"); ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;");
CHECK_NULL(ia6_scopeifnameID); CHECK_NULL(ia6_scopeifnameID);
ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V"); ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V");
CHECK_NULL(ia6_ctrID); CHECK_NULL(ia6_ctrID);
......
...@@ -94,6 +94,92 @@ extern jfieldID ia_holderID; ...@@ -94,6 +94,92 @@ extern jfieldID ia_holderID;
extern jfieldID iac_addressID; extern jfieldID iac_addressID;
extern jfieldID iac_familyID; extern jfieldID iac_familyID;
/**
* set_ methods return JNI_TRUE on success JNI_FALSE on error
* get_ methods that return +ve int return -1 on error
* get_ methods that return objects return NULL on error.
*/
jobject getInet6Address_scopeifname(JNIEnv *env, jobject iaObj) {
jobject holder;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, NULL);
return (*env)->GetObjectField(env, holder, ia6_scopeifnameID);
}
int setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) {
jobject holder;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, JNI_FALSE);
(*env)->SetObjectField(env, holder, ia6_scopeifnameID, scopeifname);
return JNI_TRUE;
}
int getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) {
jobject holder;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, -1);
return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID);
}
int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) {
jobject holder;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, -1);
return (*env)->GetIntField(env, holder, ia6_scopeidID);
}
int setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) {
jobject holder;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, JNI_FALSE);
(*env)->SetIntField(env, holder, ia6_scopeidID, scopeid);
if (scopeid > 0) {
(*env)->SetBooleanField(env, holder, ia6_scopeidsetID, JNI_TRUE);
}
return JNI_TRUE;
}
int getInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *dest) {
jobject holder, addr;
jbyteArray barr;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, JNI_FALSE);
addr = (*env)->GetObjectField(env, holder, ia6_ipaddressID);
CHECK_NULL_RETURN(addr, JNI_FALSE);
(*env)->GetByteArrayRegion(env, addr, 0, 16, (jbyte *)dest);
return JNI_TRUE;
}
int setInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *address) {
jobject holder;
jbyteArray addr;
init(env);
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID);
CHECK_NULL_RETURN(holder, JNI_FALSE);
addr = (jbyteArray)(*env)->GetObjectField(env, holder, ia6_ipaddressID);
if (addr == NULL) {
addr = (*env)->NewByteArray(env, 16);
CHECK_NULL_RETURN(addr, JNI_FALSE);
(*env)->SetObjectField(env, holder, ia6_ipaddressID, addr);
}
(*env)->SetByteArrayRegion(env, addr, 0, 16, (jbyte *)address);
return JNI_TRUE;
}
void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) { void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
jobject holder; jobject holder;
init(env); init(env);
...@@ -167,6 +253,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) { ...@@ -167,6 +253,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
} else { } else {
static jclass inet6Cls = 0; static jclass inet6Cls = 0;
jint scope; jint scope;
int ret;
if (inet6Cls == 0) { if (inet6Cls == 0) {
jclass c = (*env)->FindClass(env, "java/net/Inet6Address"); jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
CHECK_NULL_RETURN(c, NULL); CHECK_NULL_RETURN(c, NULL);
...@@ -176,18 +263,11 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) { ...@@ -176,18 +263,11 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
} }
iaObj = (*env)->NewObject(env, inet6Cls, ia6_ctrID); iaObj = (*env)->NewObject(env, inet6Cls, ia6_ctrID);
CHECK_NULL_RETURN(iaObj, NULL); CHECK_NULL_RETURN(iaObj, NULL);
ipaddress = (*env)->NewByteArray(env, 16); ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr));
CHECK_NULL_RETURN(ipaddress, NULL); CHECK_NULL_RETURN(ret, NULL);
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(him6->sin6_addr));
(*env)->SetObjectField(env, iaObj, ia6_ipaddressID, ipaddress);
setInetAddress_family(env, iaObj, IPv6); setInetAddress_family(env, iaObj, IPv6);
scope = getScopeID(him); scope = getScopeID(him);
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
if (scope > 0)
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
} }
*port = ntohs(him6->sin6_port); *port = ntohs(him6->sin6_port);
} else } else
...@@ -247,9 +327,8 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj) ...@@ -247,9 +327,8 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
if (family == AF_INET) { if (family == AF_INET) {
return JNI_FALSE; return JNI_FALSE;
} }
ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); scope = getInet6Address_scopeid(env, iaObj);
scope = (*env)->GetIntField(env, iaObj, ia6_scopeidID); getInet6Address_ipaddress(env, iaObj, (char *)caddrCur);
(*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddrCur);
if (NET_IsEqual(caddrNew, caddrCur) && cmpScopeID(scope, him)) { if (NET_IsEqual(caddrNew, caddrCur) && cmpScopeID(scope, him)) {
return JNI_TRUE; return JNI_TRUE;
} else { } else {
......
...@@ -58,6 +58,19 @@ extern jfieldID iac_familyID; ...@@ -58,6 +58,19 @@ extern jfieldID iac_familyID;
extern jfieldID iac_hostNameID; extern jfieldID iac_hostNameID;
extern jfieldID ia_preferIPv6AddressID; extern jfieldID ia_preferIPv6AddressID;
/** (Inet6Address accessors)
* set_ methods return JNI_TRUE on success JNI_FALSE on error
* get_ methods that return int/boolean, return -1 on error
* get_ methods that return objects return NULL on error.
*/
extern jobject getInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj);
extern int setInet6Address_scopeifname(JNIEnv *env, jobject ia6Obj, jobject scopeifname);
extern int getInet6Address_scopeid_set(JNIEnv *env, jobject ia6Obj);
extern int getInet6Address_scopeid(JNIEnv *env, jobject ia6Obj);
extern int setInet6Address_scopeid(JNIEnv *env, jobject ia6Obj, int scopeid);
extern int getInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *dest);
extern int setInet6Address_ipaddress(JNIEnv *env, jobject ia6Obj, char *address);
extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address); extern void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address);
extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family); extern void setInetAddress_family(JNIEnv *env, jobject iaObj, int family);
extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h); extern void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject h);
...@@ -93,12 +106,12 @@ extern jfieldID dp_bufLengthID; ...@@ -93,12 +106,12 @@ extern jfieldID dp_bufLengthID;
/* Inet6Address fields */ /* Inet6Address fields */
extern jclass ia6_class; extern jclass ia6_class;
extern jfieldID ia6_holder6ID;
extern jfieldID ia6_ipaddressID; extern jfieldID ia6_ipaddressID;
extern jfieldID ia6_scopeidID; extern jfieldID ia6_scopeidID;
extern jfieldID ia6_cachedscopeidID; extern jfieldID ia6_cachedscopeidID;
extern jfieldID ia6_scopeidsetID; extern jfieldID ia6_scopeidsetID;
extern jfieldID ia6_scopeifnameID; extern jfieldID ia6_scopeifnameID;
extern jfieldID ia6_scopeifnamesetID;
extern jmethodID ia6_ctrID; extern jmethodID ia6_ctrID;
/************************************************************************ /************************************************************************
......
...@@ -120,7 +120,6 @@ static jclass ni_ia4cls; ...@@ -120,7 +120,6 @@ static jclass ni_ia4cls;
static jclass ni_ia6cls; static jclass ni_ia6cls;
static jmethodID ni_ia4ctrID; static jmethodID ni_ia4ctrID;
static jmethodID ni_ia6ctrID; static jmethodID ni_ia6ctrID;
static jfieldID ni_ia6ipaddressID;
static int initialized = 0; static int initialized = 0;
/* /*
...@@ -156,7 +155,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -156,7 +155,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
initialized = 1; initialized = 1;
} }
...@@ -303,6 +301,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -303,6 +301,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
} }
while (iterator != NULL) { while (iterator != NULL) {
int ret1;
if (iterator->ai_family == AF_INET) { if (iterator->ai_family == AF_INET) {
jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
if (IS_NULL(iaObj)) { if (IS_NULL(iaObj)) {
...@@ -315,26 +314,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -315,26 +314,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
inetIndex++; inetIndex++;
} else if (iterator->ai_family == AF_INET6) { } else if (iterator->ai_family == AF_INET6) {
jint scope = 0; jint scope = 0;
jbyteArray ipaddress;
jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
if (IS_NULL(iaObj)) { if (IS_NULL(iaObj)) {
ret = NULL; ret = NULL;
goto cleanupAndReturn; goto cleanupAndReturn;
} }
ipaddress = (*env)->NewByteArray(env, 16); ret1 = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
if (IS_NULL(ipaddress)) { if (!ret1) {
ret = NULL; ret = NULL;
goto cleanupAndReturn; goto cleanupAndReturn;
} }
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
if (scope != 0) { /* zero is default value, no need to set */ if (scope != 0) { /* zero is default value, no need to set */
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
setInetAddress_hostName(env, iaObj, host); setInetAddress_hostName(env, iaObj, host);
(*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
inet6Index++; inet6Index++;
......
...@@ -118,7 +118,6 @@ static jclass ni_ibcls; ...@@ -118,7 +118,6 @@ static jclass ni_ibcls;
static jmethodID ni_ia4ctrID; static jmethodID ni_ia4ctrID;
static jmethodID ni_ia6ctrID; static jmethodID ni_ia6ctrID;
static jmethodID ni_ibctrID; static jmethodID ni_ibctrID;
static jfieldID ni_ia6ipaddressID;
static jfieldID ni_ibaddressID; static jfieldID ni_ibaddressID;
static jfieldID ni_ib4broadcastID; static jfieldID ni_ib4broadcastID;
static jfieldID ni_ib4maskID; static jfieldID ni_ib4maskID;
...@@ -193,7 +192,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) { ...@@ -193,7 +192,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) {
ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V"); ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;"); ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;"); ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S"); ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
...@@ -332,11 +330,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 ...@@ -332,11 +330,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
#ifdef AF_INET6 #ifdef AF_INET6
if (family == AF_INET6) { if (family == AF_INET6) {
jbyte *bytes = (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr); jbyte *bytes = (jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr);
jbyteArray ipaddress = (*env)->GetObjectField(env, iaObj, ni_ia6ipaddressID);
jbyte caddr[16]; jbyte caddr[16];
int i; int i;
getInet6Address_ipaddress(env, iaObj, (char *)caddr);
(*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
i = 0; i = 0;
while (i < 16) { while (i < 16) {
if (caddr[i] != bytes[i]) { if (caddr[i] != bytes[i]) {
...@@ -670,21 +666,17 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) { ...@@ -670,21 +666,17 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
int scope=0; int scope=0;
iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
if (iaObj) { if (iaObj) {
jbyteArray ipaddress = (*env)->NewByteArray(env, 16); int ret = setInet6Address_ipaddress(env, iaObj, (char *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr));
if (ipaddress == NULL) { if (ret == JNI_FALSE) {
return NULL; return NULL;
} }
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(((struct sockaddr_in6*)addrP->addr)->sin6_addr));
scope = ((struct sockaddr_in6*)addrP->addr)->sin6_scope_id; scope = ((struct sockaddr_in6*)addrP->addr)->sin6_scope_id;
if (scope != 0) { /* zero is default value, no need to set */ if (scope != 0) { /* zero is default value, no need to set */
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); setInet6Address_scopeifname(env, iaObj, netifObj);
(*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
} }
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj) { if (ibObj) {
......
...@@ -2148,8 +2148,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this, ...@@ -2148,8 +2148,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
caddr[14] = ((address >> 8) & 0xff); caddr[14] = ((address >> 8) & 0xff);
caddr[15] = (address & 0xff); caddr[15] = (address & 0xff);
} else { } else {
ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); getInet6Address_ipaddress(env, iaObj, caddr);
(*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
} }
memcpy((void *)&(mname6.ipv6mr_multiaddr), caddr, sizeof(struct in6_addr)); memcpy((void *)&(mname6.ipv6mr_multiaddr), caddr, sizeof(struct in6_addr));
......
...@@ -782,7 +782,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -782,7 +782,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
/* needs work. 1. family 2. clean up him6 etc deallocate memory */ /* needs work. 1. family 2. clean up him6 etc deallocate memory */
if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) { if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) {
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him; struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
jbyteArray ipaddress;
jbyte caddr[16]; jbyte caddr[16];
jint address; jint address;
...@@ -803,8 +802,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -803,8 +802,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
caddr[15] = (address & 0xff); caddr[15] = (address & 0xff);
} }
} else { } else {
ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); getInet6Address_ipaddress(env, iaObj, (char *)caddr);
(*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
} }
memset((char *)him6, 0, sizeof(struct sockaddr_in6)); memset((char *)him6, 0, sizeof(struct sockaddr_in6));
him6->sin6_port = htons(port); him6->sin6_port = htons(port);
...@@ -840,7 +838,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -840,7 +838,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
*/ */
if (!cached_scope_id) { if (!cached_scope_id) {
if (ia6_scopeidID) { if (ia6_scopeidID) {
scope_id = (int)(*env)->GetIntField(env,iaObj,ia6_scopeidID); scope_id = getInet6Address_scopeid(env, iaObj);
} }
if (scope_id != 0) { if (scope_id != 0) {
/* check user-specified value for loopback case /* check user-specified value for loopback case
...@@ -884,7 +882,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -884,7 +882,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
if (family != IPv4) { if (family != IPv4) {
if (ia6_scopeidID) { if (ia6_scopeidID) {
him6->sin6_scope_id = (int)(*env)->GetIntField(env, iaObj, ia6_scopeidID); him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj);
} }
} }
#endif #endif
......
...@@ -77,7 +77,6 @@ static jclass ni_ia4cls; ...@@ -77,7 +77,6 @@ static jclass ni_ia4cls;
static jclass ni_ia6cls; static jclass ni_ia6cls;
static jmethodID ni_ia4ctrID; static jmethodID ni_ia4ctrID;
static jmethodID ni_ia6ctrID; static jmethodID ni_ia6ctrID;
static jfieldID ni_ia6ipaddressID;
static int initialized = 0; static int initialized = 0;
JNIEXPORT jobjectArray JNICALL JNIEXPORT jobjectArray JNICALL
...@@ -101,7 +100,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -101,7 +100,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V"); ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
initialized = 1; initialized = 1;
} }
if (IS_NULL(host)) { if (IS_NULL(host)) {
...@@ -242,26 +240,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -242,26 +240,22 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
(*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
inetIndex ++; inetIndex ++;
} else if (iterator->ai_family == AF_INET6) { } else if (iterator->ai_family == AF_INET6) {
jint scope = 0; jint scope = 0, ret1;
jbyteArray ipaddress;
jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
if (IS_NULL(iaObj)) { if (IS_NULL(iaObj)) {
ret = NULL; ret = NULL;
goto cleanupAndReturn; goto cleanupAndReturn;
} }
ipaddress = (*env)->NewByteArray(env, 16); ret1 = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
if (IS_NULL(ipaddress)) {
if (ret1 == JNI_FALSE) {
ret = NULL; ret = NULL;
goto cleanupAndReturn; goto cleanupAndReturn;
} }
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
if (scope != 0) { /* zero is default value, no need to set */ if (scope != 0) { /* zero is default value, no need to set */
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
setInetAddress_hostName(env, iaObj, host); setInetAddress_hostName(env, iaObj, host);
(*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
inet6Index ++; inet6Index ++;
......
...@@ -72,8 +72,6 @@ jmethodID ni_ia4Ctor; /* Inet4Address() */ ...@@ -72,8 +72,6 @@ jmethodID ni_ia4Ctor; /* Inet4Address() */
jclass ni_ia6cls; /* Inet6Address */ jclass ni_ia6cls; /* Inet6Address */
jmethodID ni_ia6ctrID; /* Inet6Address() */ jmethodID ni_ia6ctrID; /* Inet6Address() */
jfieldID ni_ia6ipaddressID;
jfieldID ni_ia6ipaddressID;
jclass ni_ibcls; /* InterfaceAddress */ jclass ni_ibcls; /* InterfaceAddress */
jmethodID ni_ibctrID; /* InterfaceAddress() */ jmethodID ni_ibctrID; /* InterfaceAddress() */
...@@ -520,7 +518,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) ...@@ -520,7 +518,6 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address"); ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls); ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V"); ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress"); ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress");
ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls); ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls);
...@@ -621,19 +618,16 @@ jobject createNetworkInterface ...@@ -621,19 +618,16 @@ jobject createNetworkInterface
int scope; int scope;
iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
if (iaObj) { if (iaObj) {
jbyteArray ipaddress = (*env)->NewByteArray(env, 16); int ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
if (ipaddress == NULL) { if (ret == JNI_FALSE) {
return NULL; return NULL;
} }
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
scope = addrs->addr.him6.sin6_scope_id; scope = addrs->addr.him6.sin6_scope_id;
if (scope != 0) { /* zero is default value, no need to set */ if (scope != 0) { /* zero is default value, no need to set */
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); setInet6Address_scopeifname(env, iaObj, netifObj);
(*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) { if (ibObj == NULL) {
free_netaddr(netaddrP); free_netaddr(netaddrP);
......
...@@ -544,19 +544,15 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) ...@@ -544,19 +544,15 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs)
int scope; int scope;
iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID); iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
if (iaObj) { if (iaObj) {
jbyteArray ipaddress = (*env)->NewByteArray(env, 16); int ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
if (ipaddress == NULL) { if (ret == JNI_FALSE) {
return NULL; return NULL;
} }
(*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
(jbyte *)&(addrs->addr.him6.sin6_addr.s6_addr));
scope = addrs->addr.him6.sin6_scope_id; scope = addrs->addr.him6.sin6_scope_id;
if (scope != 0) { /* zero is default value, no need to set */ if (scope != 0) { /* zero is default value, no need to set */
(*env)->SetIntField(env, iaObj, ia6_scopeidID, scope); setInet6Address_scopeid(env, iaObj, scope);
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); setInet6Address_scopeifname(env, iaObj, netifObj);
(*env)->SetObjectField(env, iaObj, ia6_scopeifnameID, netifObj);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) { if (ibObj == NULL) {
free_netaddr(netaddrP); free_netaddr(netaddrP);
......
...@@ -728,7 +728,6 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this, ...@@ -728,7 +728,6 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
setInetAddress_family(env, socketAddressObj, IPv4); setInetAddress_family(env, socketAddressObj, IPv4);
(*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj); (*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
} else { } else {
jbyteArray addr;
/* AF_INET6 -> Inet6Address */ /* AF_INET6 -> Inet6Address */
if (inet6Cls == 0) { if (inet6Cls == 0) {
jclass c = (*env)->FindClass(env, "java/net/Inet6Address"); jclass c = (*env)->FindClass(env, "java/net/Inet6Address");
...@@ -751,14 +750,10 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this, ...@@ -751,14 +750,10 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
NET_SocketClose(fd); NET_SocketClose(fd);
return; return;
} }
addr = (*env)->GetObjectField (env, socketAddressObj, ia6_ipaddressID); setInet6Address_ipaddress(env, socketAddressObj, (const char *)&him.him6.sin6_addr);
(*env)->SetByteArrayRegion (env, addr, 0, 16, (const char *)&him.him6.sin6_addr);
setInetAddress_family(env, socketAddressObj, IPv6); setInetAddress_family(env, socketAddressObj, IPv6);
scope = him.him6.sin6_scope_id; setInet6Address_scopeid(env, socketAddressObj, him.him6.sin6_scope_id);
(*env)->SetIntField(env, socketAddressObj, ia6_scopeidID, scope);
if(scope>0) {
(*env)->SetBooleanField(env, socketAddressObj, ia6_scopeidsetID, JNI_TRUE);
}
} }
/* fields common to AF_INET and AF_INET6 */ /* fields common to AF_INET and AF_INET6 */
......
...@@ -851,7 +851,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -851,7 +851,6 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
family = (iafam == IPv4)? AF_INET : AF_INET6; family = (iafam == IPv4)? AF_INET : AF_INET6;
if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) { if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) {
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him; struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
jbyteArray ipaddress;
jbyte caddr[16]; jbyte caddr[16];
jint address, scopeid = 0; jint address, scopeid = 0;
jint cached_scope_id = 0; jint cached_scope_id = 0;
...@@ -872,10 +871,9 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr ...@@ -872,10 +871,9 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
caddr[15] = (address & 0xff); caddr[15] = (address & 0xff);
} }
} else { } else {
ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID); getInet6Address_ipaddress(env, iaObj, (char *)caddr);
scopeid = (jint)(*env)->GetIntField(env, iaObj, ia6_scopeidID); scopeid = getInet6Address_scopeid(env, iaObj);
cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID); cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
(*env)->GetByteArrayRegion(env, ipaddress, 0, 16, caddr);
} }
memset((char *)him6, 0, sizeof(struct SOCKADDR_IN6)); memset((char *)him6, 0, sizeof(struct SOCKADDR_IN6));
......
...@@ -94,7 +94,26 @@ public class Serialize { ...@@ -94,7 +94,26 @@ public class Serialize {
} finally { } finally {
ois.close(); ois.close();
} }
System.out.println(nobj);
nobj = (Inet6Address)InetAddress.getByAddress("foo.com", new byte[] {
(byte)0xfe,(byte)0x80,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,
(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)1
});
if (!test1(nobj, addr1)) {
throw new RuntimeException("failed with " + nobj.toString());
}
nobj = (Inet6Address)InetAddress.getByAddress("x.bar.com", new byte[] {
(byte)0xfe,(byte)0xC0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,
(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)0,(byte)1
});
if (!test1(nobj, addr2)) {
throw new RuntimeException("failed with " + nobj.toString());
}
nobj = (Inet6Address)InetAddress.getByName("::1");
if (!test1(nobj, addr3)) {
throw new RuntimeException("failed with " + nobj.toString());
}
System.out.println("All tests passed"); System.out.println("All tests passed");
} }
...@@ -113,4 +132,162 @@ public class Serialize { ...@@ -113,4 +132,162 @@ public class Serialize {
return false; return false;
} }
} }
}
static boolean test1 (Inet6Address obj, byte[] buf) throws Exception {
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buf));
Inet6Address nobj = (Inet6Address) ois.readObject();
ois.close();
if (nobj.equals(obj)) {
return true;
} else {
return false;
}
}
// Inet6Address instances serialized with JDK 6
static byte[] addr1 = {
(byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72,
(byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49,
(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64,
(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f,
(byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80,
(byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00,
(byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,
(byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c,
(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f,
(byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74,
(byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f,
(byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e,
(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65,
(byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66,
(byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00,
(byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f,
(byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67,
(byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70,
(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,
(byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42,
(byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61,
(byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,
(byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41,
(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,
(byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3,
(byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49,
(byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,
(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06,
(byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79,
(byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73,
(byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71,
(byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x02,(byte)0x74,(byte)0x00,(byte)0x07,(byte)0x66,
(byte)0x6f,(byte)0x6f,(byte)0x2e,(byte)0x63,(byte)0x6f,(byte)0x6d,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x70,(byte)0x75,(byte)0x72,(byte)0x00,(byte)0x02,(byte)0x5b,
(byte)0x42,(byte)0xac,(byte)0xf3,(byte)0x17,(byte)0xf8,(byte)0x06,
(byte)0x08,(byte)0x54,(byte)0xe0,(byte)0x02,(byte)0x00,(byte)0x00,
(byte)0x78,(byte)0x70,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x10,
(byte)0xfe,(byte)0x80,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x78
};
static byte[] addr2 = {
(byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72,
(byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49,
(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64,
(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f,
(byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80,
(byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00,
(byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,
(byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c,
(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f,
(byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74,
(byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f,
(byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e,
(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65,
(byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66,
(byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00,
(byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f,
(byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67,
(byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70,
(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,
(byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42,
(byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61,
(byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,
(byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41,
(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,
(byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3,
(byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49,
(byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,
(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06,
(byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79,
(byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73,
(byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71,
(byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x02,(byte)0x74,(byte)0x00,(byte)0x09,(byte)0x78,
(byte)0x2e,(byte)0x62,(byte)0x61,(byte)0x72,(byte)0x2e,(byte)0x63,
(byte)0x6f,(byte)0x6d,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x70,(byte)0x75,(byte)0x72,(byte)0x00,
(byte)0x02,(byte)0x5b,(byte)0x42,(byte)0xac,(byte)0xf3,(byte)0x17,
(byte)0xf8,(byte)0x06,(byte)0x08,(byte)0x54,(byte)0xe0,(byte)0x02,
(byte)0x00,(byte)0x00,(byte)0x78,(byte)0x70,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x10,(byte)0xfe,(byte)0xc0,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,
(byte)0x78
};
static byte[] addr3 = {
(byte)0xac,(byte)0xed,(byte)0x00,(byte)0x05,(byte)0x73,(byte)0x72,
(byte)0x00,(byte)0x15,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x2e,(byte)0x49,
(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x36,(byte)0x41,(byte)0x64,
(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x5f,
(byte)0x7c,(byte)0x20,(byte)0x81,(byte)0x52,(byte)0x2c,(byte)0x80,
(byte)0x21,(byte)0x03,(byte)0x00,(byte)0x05,(byte)0x49,(byte)0x00,
(byte)0x08,(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,
(byte)0x5f,(byte)0x69,(byte)0x64,(byte)0x5a,(byte)0x00,(byte)0x0c,
(byte)0x73,(byte)0x63,(byte)0x6f,(byte)0x70,(byte)0x65,(byte)0x5f,
(byte)0x69,(byte)0x64,(byte)0x5f,(byte)0x73,(byte)0x65,(byte)0x74,
(byte)0x5a,(byte)0x00,(byte)0x10,(byte)0x73,(byte)0x63,(byte)0x6f,
(byte)0x70,(byte)0x65,(byte)0x5f,(byte)0x69,(byte)0x66,(byte)0x6e,
(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x5f,(byte)0x73,(byte)0x65,
(byte)0x74,(byte)0x4c,(byte)0x00,(byte)0x06,(byte)0x69,(byte)0x66,
(byte)0x6e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x74,(byte)0x00,
(byte)0x12,(byte)0x4c,(byte)0x6a,(byte)0x61,(byte)0x76,(byte)0x61,
(byte)0x2f,(byte)0x6c,(byte)0x61,(byte)0x6e,(byte)0x67,(byte)0x2f,
(byte)0x53,(byte)0x74,(byte)0x72,(byte)0x69,(byte)0x6e,(byte)0x67,
(byte)0x3b,(byte)0x5b,(byte)0x00,(byte)0x09,(byte)0x69,(byte)0x70,
(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,
(byte)0x73,(byte)0x74,(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42,
(byte)0x78,(byte)0x72,(byte)0x00,(byte)0x14,(byte)0x6a,(byte)0x61,
(byte)0x76,(byte)0x61,(byte)0x2e,(byte)0x6e,(byte)0x65,(byte)0x74,
(byte)0x2e,(byte)0x49,(byte)0x6e,(byte)0x65,(byte)0x74,(byte)0x41,
(byte)0x64,(byte)0x64,(byte)0x72,(byte)0x65,(byte)0x73,(byte)0x73,
(byte)0x2d,(byte)0x9b,(byte)0x57,(byte)0xaf,(byte)0x9f,(byte)0xe3,
(byte)0xeb,(byte)0xdb,(byte)0x02,(byte)0x00,(byte)0x03,(byte)0x49,
(byte)0x00,(byte)0x07,(byte)0x61,(byte)0x64,(byte)0x64,(byte)0x72,
(byte)0x65,(byte)0x73,(byte)0x73,(byte)0x49,(byte)0x00,(byte)0x06,
(byte)0x66,(byte)0x61,(byte)0x6d,(byte)0x69,(byte)0x6c,(byte)0x79,
(byte)0x4c,(byte)0x00,(byte)0x08,(byte)0x68,(byte)0x6f,(byte)0x73,
(byte)0x74,(byte)0x4e,(byte)0x61,(byte)0x6d,(byte)0x65,(byte)0x71,
(byte)0x00,(byte)0x7e,(byte)0x00,(byte)0x01,(byte)0x78,(byte)0x70,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x02,(byte)0x70,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x70,(byte)0x75,(byte)0x72,
(byte)0x00,(byte)0x02,(byte)0x5b,(byte)0x42,(byte)0xac,(byte)0xf3,
(byte)0x17,(byte)0xf8,(byte)0x06,(byte)0x08,(byte)0x54,(byte)0xe0,
(byte)0x02,(byte)0x00,(byte)0x00,(byte)0x78,(byte)0x70,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x10,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
(byte)0x01,(byte)0x78
};
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册