author | clanger |
Wed, 02 Nov 2016 11:52:51 +0100 | |
changeset 41834 | 99c4f72c0a91 |
parent 41771 | 18c9669e76ca |
child 43615 | 809f9acb701a |
permissions | -rw-r--r-- |
2 | 1 |
/* |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
2 |
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
41380
diff
changeset
|
25 |
#include <malloc.h> |
2 | 26 |
|
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
41380
diff
changeset
|
27 |
#include "net_util.h" |
2 | 28 |
|
29 |
#include "java_net_InetAddress.h" |
|
30 |
#include "java_net_Inet4AddressImpl.h" |
|
31 |
#include "java_net_Inet6AddressImpl.h" |
|
32 |
||
33 |
/* |
|
34 |
* Inet6AddressImpl |
|
35 |
*/ |
|
36 |
||
37 |
/* |
|
38 |
* Class: java_net_Inet6AddressImpl |
|
39 |
* Method: getLocalHostName |
|
40 |
* Signature: ()Ljava/lang/String; |
|
41 |
*/ |
|
42 |
JNIEXPORT jstring JNICALL |
|
43 |
Java_java_net_Inet6AddressImpl_getLocalHostName (JNIEnv *env, jobject this) { |
|
44 |
char hostname [256]; |
|
45 |
||
46 |
if (gethostname (hostname, sizeof (hostname)) == -1) { |
|
47 |
strcpy (hostname, "localhost"); |
|
48 |
} |
|
49 |
return JNU_NewStringPlatform (env, hostname); |
|
50 |
} |
|
51 |
||
52 |
JNIEXPORT jobjectArray JNICALL |
|
53 |
Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, |
|
54 |
jstring host) { |
|
55 |
const char *hostname; |
|
56 |
jobjectArray ret = 0; |
|
57 |
int retLen = 0; |
|
58 |
jboolean preferIPv6Address; |
|
59 |
||
60 |
int error=0; |
|
41380
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
38552
diff
changeset
|
61 |
struct addrinfo hints, *res = NULL, *resNew = NULL; |
2 | 62 |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
63 |
initInetAddressIDs(env); |
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
64 |
JNU_CHECK_EXCEPTION_RETURN(env, NULL); |
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
65 |
|
2 | 66 |
if (IS_NULL(host)) { |
67 |
JNU_ThrowNullPointerException(env, "host is null"); |
|
68 |
return 0; |
|
69 |
} |
|
70 |
hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE); |
|
71 |
CHECK_NULL_RETURN(hostname, NULL); |
|
72 |
||
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
73 |
/* get the address preference */ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
74 |
preferIPv6Address |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
75 |
= (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
76 |
|
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
77 |
/* Try once, with our static buffer. */ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
78 |
memset(&hints, 0, sizeof(hints)); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
79 |
hints.ai_flags = AI_CANONNAME; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
80 |
hints.ai_family = AF_UNSPEC; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
81 |
|
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
82 |
error = getaddrinfo(hostname, NULL, &hints, &res); |
2 | 83 |
|
21325
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
84 |
if (error) { |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
85 |
if (WSAGetLastError() == WSATRY_AGAIN) { |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
86 |
NET_ThrowByNameWithLastError(env, |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
87 |
JNU_JAVANETPKG "UnknownHostException", |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
88 |
hostname); |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
89 |
JNU_ReleaseStringPlatformChars(env, host, hostname); |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
90 |
return NULL; |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
91 |
} else { |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
92 |
/* report error */ |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
93 |
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
94 |
(char *)hostname); |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
95 |
JNU_ReleaseStringPlatformChars(env, host, hostname); |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
96 |
return NULL; |
8ccf86fcccda
8026806: Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
bpb
parents:
20857
diff
changeset
|
97 |
} |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
98 |
} else { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
99 |
int i = 0; |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
100 |
int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0; |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
101 |
struct addrinfo *itr, *last, *iterator = res; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
102 |
while (iterator != NULL) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
103 |
int skip = 0; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
104 |
itr = resNew; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
105 |
while (itr != NULL) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
106 |
if (iterator->ai_family == itr->ai_family && |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
107 |
iterator->ai_addrlen == itr->ai_addrlen) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
108 |
if (itr->ai_family == AF_INET) { /* AF_INET */ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
109 |
struct sockaddr_in *addr1, *addr2; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
110 |
addr1 = (struct sockaddr_in *)iterator->ai_addr; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
111 |
addr2 = (struct sockaddr_in *)itr->ai_addr; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
112 |
if (addr1->sin_addr.s_addr == |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
113 |
addr2->sin_addr.s_addr) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
114 |
skip = 1; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
115 |
break; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
116 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
117 |
} else { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
118 |
int t; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
119 |
struct sockaddr_in6 *addr1, *addr2; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
120 |
addr1 = (struct sockaddr_in6 *)iterator->ai_addr; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
121 |
addr2 = (struct sockaddr_in6 *)itr->ai_addr; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
122 |
|
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
123 |
for (t = 0; t < 16; t++) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
124 |
if (addr1->sin6_addr.s6_addr[t] != |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
125 |
addr2->sin6_addr.s6_addr[t]) { |
2 | 126 |
break; |
127 |
} |
|
128 |
} |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
129 |
if (t < 16) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
130 |
itr = itr->ai_next; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
131 |
continue; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
132 |
} else { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
133 |
skip = 1; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
134 |
break; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
135 |
} |
2 | 136 |
} |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
137 |
} else if (iterator->ai_family != AF_INET && |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
138 |
iterator->ai_family != AF_INET6) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
139 |
/* we can't handle other family types */ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
140 |
skip = 1; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
141 |
break; |
2 | 142 |
} |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
143 |
itr = itr->ai_next; |
2 | 144 |
} |
145 |
||
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
146 |
if (!skip) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
147 |
struct addrinfo *next |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
148 |
= (struct addrinfo*) malloc(sizeof(struct addrinfo)); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
149 |
if (!next) { |
13245
7ab3ef5b9520
7181353: Update error message to distinguish native OOM and java OOM in net
zhouyx
parents:
9050
diff
changeset
|
150 |
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); |
2 | 151 |
ret = NULL; |
152 |
goto cleanupAndReturn; |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
153 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
154 |
memcpy(next, iterator, sizeof(struct addrinfo)); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
155 |
next->ai_next = NULL; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
156 |
if (resNew == NULL) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
157 |
resNew = next; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
158 |
} else { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
159 |
last->ai_next = next; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
160 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
161 |
last = next; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
162 |
i++; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
163 |
if (iterator->ai_family == AF_INET) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
164 |
inetCount ++; |
2 | 165 |
} else if (iterator->ai_family == AF_INET6) { |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
166 |
inet6Count ++; |
2 | 167 |
} |
168 |
} |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
169 |
iterator = iterator->ai_next; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
170 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
171 |
retLen = i; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
172 |
iterator = resNew; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
173 |
i = 0; |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
174 |
ret = (*env)->NewObjectArray(env, retLen, ia_class, NULL); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
175 |
|
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
176 |
if (IS_NULL(ret)) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
177 |
/* we may have memory to free at the end of this */ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
178 |
goto cleanupAndReturn; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
179 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
180 |
|
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
181 |
if (preferIPv6Address == java_net_InetAddress_PREFER_IPV6_VALUE) { |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
182 |
inetIndex = inet6Count; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
183 |
inet6Index = 0; |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
184 |
} else if (preferIPv6Address == java_net_InetAddress_PREFER_IPV4_VALUE) { |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
185 |
inetIndex = 0; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
186 |
inet6Index = inetCount; |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
187 |
} else if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) { |
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
188 |
inetIndex = inet6Index = originalIndex = 0; |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
189 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
190 |
|
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
191 |
while (iterator != NULL) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
192 |
if (iterator->ai_family == AF_INET) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
193 |
jobject iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
194 |
if (IS_NULL(iaObj)) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
195 |
ret = NULL; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
196 |
goto cleanupAndReturn; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
197 |
} |
16870 | 198 |
setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); |
199 |
setInetAddress_hostName(env, iaObj, host); |
|
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
200 |
(*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj); |
41380
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
38552
diff
changeset
|
201 |
inetIndex ++; |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
202 |
} else if (iterator->ai_family == AF_INET6) { |
22956 | 203 |
jint scope = 0; |
204 |
jboolean ret1; |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
205 |
jobject iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
206 |
if (IS_NULL(iaObj)) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
207 |
ret = NULL; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
208 |
goto cleanupAndReturn; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
209 |
} |
20821 | 210 |
ret1 = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr)); |
211 |
if (ret1 == JNI_FALSE) { |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
212 |
ret = NULL; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
213 |
goto cleanupAndReturn; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
214 |
} |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
215 |
scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
216 |
if (scope != 0) { /* zero is default value, no need to set */ |
20821 | 217 |
setInet6Address_scopeid(env, iaObj, scope); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
218 |
} |
16870 | 219 |
setInetAddress_hostName(env, iaObj, host); |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
220 |
(*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
221 |
inet6Index ++; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
222 |
} |
38552
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
223 |
if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) { |
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
224 |
originalIndex++; |
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
225 |
inetIndex = inet6Index = 0; |
ca398af91529
8016521: InetAddress should not always re-order addresses returned from name service
vtewari
parents:
37362
diff
changeset
|
226 |
} |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
227 |
iterator = iterator->ai_next; |
2 | 228 |
} |
229 |
} |
|
230 |
||
231 |
cleanupAndReturn: |
|
232 |
{ |
|
233 |
struct addrinfo *iterator, *tmp; |
|
234 |
iterator = resNew; |
|
235 |
while (iterator != NULL) { |
|
236 |
tmp = iterator; |
|
237 |
iterator = iterator->ai_next; |
|
238 |
free(tmp); |
|
239 |
} |
|
240 |
JNU_ReleaseStringPlatformChars(env, host, hostname); |
|
241 |
} |
|
242 |
||
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
243 |
freeaddrinfo(res); |
2 | 244 |
|
245 |
return ret; |
|
246 |
} |
|
247 |
||
248 |
/* |
|
249 |
* Class: java_net_Inet6AddressImpl |
|
250 |
* Method: getHostByAddr |
|
251 |
* Signature: (I)Ljava/lang/String; |
|
252 |
*/ |
|
253 |
JNIEXPORT jstring JNICALL |
|
254 |
Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this, |
|
255 |
jbyteArray addrArray) { |
|
256 |
jstring ret = NULL; |
|
257 |
||
258 |
char host[NI_MAXHOST+1]; |
|
259 |
int error = 0; |
|
260 |
int len = 0; |
|
261 |
jbyte caddr[16]; |
|
262 |
||
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
263 |
struct sockaddr_in him4; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
264 |
struct sockaddr_in6 him6; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
265 |
struct sockaddr *sa; |
2 | 266 |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
267 |
/* |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
268 |
* For IPv4 addresses construct a sockaddr_in structure. |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
269 |
*/ |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
270 |
if ((*env)->GetArrayLength(env, addrArray) == 4) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
271 |
jint addr; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
272 |
(*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
273 |
addr = ((caddr[0]<<24) & 0xff000000); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
274 |
addr |= ((caddr[1] <<16) & 0xff0000); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
275 |
addr |= ((caddr[2] <<8) & 0xff00); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
276 |
addr |= (caddr[3] & 0xff); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
277 |
memset((char *) &him4, 0, sizeof(him4)); |
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
41380
diff
changeset
|
278 |
him4.sin_addr.s_addr = htonl(addr); |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
279 |
him4.sin_family = AF_INET; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
280 |
sa = (struct sockaddr *) &him4; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
281 |
len = sizeof(him4); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
282 |
} else { |
2 | 283 |
/* |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
284 |
* For IPv6 address construct a sockaddr_in6 structure. |
2 | 285 |
*/ |
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
286 |
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
287 |
memset((char *) &him6, 0, sizeof(him6)); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
288 |
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) ); |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
289 |
him6.sin6_family = AF_INET6; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
290 |
sa = (struct sockaddr *) &him6 ; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
291 |
len = sizeof(him6) ; |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
292 |
} |
2 | 293 |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
294 |
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD); |
2 | 295 |
|
9003
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
296 |
if (!error) { |
e1b0f0099915
7030256: Cleanup/Remove code supporting old Windows versions (98, NT, 2000, etc)
chegar
parents:
7814
diff
changeset
|
297 |
ret = (*env)->NewStringUTF(env, host); |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22640
diff
changeset
|
298 |
CHECK_NULL_RETURN(ret, NULL); |
2 | 299 |
} |
300 |
||
301 |
if (ret == NULL) { |
|
302 |
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL); |
|
303 |
} |
|
304 |
||
305 |
return ret; |
|
306 |
} |
|
307 |
||
37362
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
308 |
/** |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
309 |
* ping implementation using tcp port 7 (echo) |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
310 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
311 |
static jboolean |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
312 |
tcp_ping6(JNIEnv *env, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
313 |
jint timeout, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
314 |
jint ttl, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
315 |
struct sockaddr_in6 him6, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
316 |
struct sockaddr_in6* netif, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
317 |
int len) |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
318 |
{ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
319 |
jint fd; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
320 |
WSAEVENT hEvent; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
321 |
int connect_rv = -1; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
322 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
323 |
fd = NET_Socket(AF_INET6, SOCK_STREAM, 0); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
324 |
if (fd == SOCKET_ERROR) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
325 |
/* note: if you run out of fds, you may not be able to load |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
326 |
* the exception class, and get a NoClassDefFoundError |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
327 |
* instead. |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
328 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
329 |
NET_ThrowNew(env, errno, "Can't create socket"); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
330 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
331 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
332 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
333 |
/** |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
334 |
* A TTL was specified, let's set the socket option. |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
335 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
336 |
if (ttl > 0) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
337 |
setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, (const char *)&ttl, sizeof(ttl)); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
338 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
339 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
340 |
/** |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
341 |
* A network interface was specified, let's bind to it. |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
342 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
343 |
if (netif != NULL) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
344 |
if (NET_Bind(fd, (struct sockaddr*)netif, sizeof(struct sockaddr_in6)) < 0) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
345 |
NET_ThrowNew(env, WSAGetLastError(), "Can't bind socket to interface"); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
346 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
347 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
348 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
349 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
350 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
351 |
/** |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
352 |
* Make the socket non blocking. |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
353 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
354 |
hEvent = WSACreateEvent(); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
355 |
WSAEventSelect(fd, hEvent, FD_READ|FD_CONNECT|FD_CLOSE); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
356 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
357 |
/* no need to use NET_Connect as non-blocking */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
358 |
him6.sin6_port = htons((short) 7); /* Echo port */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
359 |
connect_rv = connect(fd, (struct sockaddr *)&him6, len); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
360 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
361 |
/** |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
362 |
* connection established or refused immediately, either way it means |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
363 |
* we were able to reach the host! |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
364 |
*/ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
365 |
if (connect_rv == 0 || WSAGetLastError() == WSAECONNREFUSED) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
366 |
WSACloseEvent(hEvent); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
367 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
368 |
return JNI_TRUE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
369 |
} else { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
370 |
int optlen; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
371 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
372 |
switch (WSAGetLastError()) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
373 |
case WSAEHOSTUNREACH: /* Host Unreachable */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
374 |
case WSAENETUNREACH: /* Network Unreachable */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
375 |
case WSAENETDOWN: /* Network is down */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
376 |
case WSAEPFNOSUPPORT: /* Protocol Family unsupported */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
377 |
WSACloseEvent(hEvent); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
378 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
379 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
380 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
381 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
382 |
if (WSAGetLastError() != WSAEWOULDBLOCK) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
383 |
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "ConnectException", |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
384 |
"connect failed"); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
385 |
WSACloseEvent(hEvent); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
386 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
387 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
388 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
389 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
390 |
timeout = NET_Wait(env, fd, NET_WAIT_CONNECT, timeout); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
391 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
392 |
if (timeout >= 0) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
393 |
/* has connection been established? */ |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
394 |
optlen = sizeof(connect_rv); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
395 |
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&connect_rv, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
396 |
&optlen) <0) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
397 |
connect_rv = WSAGetLastError(); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
398 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
399 |
|
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
400 |
if (connect_rv == 0 || connect_rv == WSAECONNREFUSED) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
401 |
WSACloseEvent(hEvent); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
402 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
403 |
return JNI_TRUE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
404 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
405 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
406 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
407 |
WSACloseEvent(hEvent); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
408 |
closesocket(fd); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
409 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
410 |
} |
2 | 411 |
|
412 |
/** |
|
413 |
* ping implementation. |
|
414 |
* Send a ICMP_ECHO_REQUEST packet every second until either the timeout |
|
415 |
* expires or a answer is received. |
|
416 |
* Returns true is an ECHO_REPLY is received, otherwise, false. |
|
417 |
*/ |
|
418 |
static jboolean |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
419 |
ping6(JNIEnv *env, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
420 |
struct sockaddr_in6* src, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
421 |
struct sockaddr_in6* dest, |
37362
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
422 |
jint timeout, |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
423 |
HANDLE hIcmpFile) |
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
424 |
{ |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
425 |
DWORD dwRetVal = 0; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
426 |
char SendData[32] = {0}; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
427 |
LPVOID ReplyBuffer = NULL; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
428 |
DWORD ReplySize = 0; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
429 |
IP_OPTION_INFORMATION ipInfo = {255, 0, 0, 0, NULL}; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
430 |
struct sockaddr_in6 sa6Source; |
2 | 431 |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
432 |
ReplySize = sizeof(ICMPV6_ECHO_REPLY) + sizeof(SendData); |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
433 |
ReplyBuffer = (VOID*) malloc(ReplySize); |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
434 |
if (ReplyBuffer == NULL) { |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
435 |
IcmpCloseHandle(hIcmpFile); |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
436 |
NET_ThrowNew(env, WSAGetLastError(), "Unable to allocate memory"); |
2 | 437 |
return JNI_FALSE; |
438 |
} |
|
439 |
||
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
440 |
//define local source information |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
441 |
sa6Source.sin6_addr = in6addr_any; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
442 |
sa6Source.sin6_family = AF_INET6; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
443 |
sa6Source.sin6_flowinfo = 0; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
444 |
sa6Source.sin6_port = 0; |
2 | 445 |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
446 |
dwRetVal = Icmp6SendEcho2(hIcmpFile, // HANDLE IcmpHandle, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
447 |
NULL, // HANDLE Event, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
448 |
NULL, // PIO_APC_ROUTINE ApcRoutine, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
449 |
NULL, // PVOID ApcContext, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
450 |
&sa6Source, // struct sockaddr_in6 *SourceAddress, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
451 |
dest, // struct sockaddr_in6 *DestinationAddress, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
452 |
SendData, // LPVOID RequestData, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
453 |
sizeof(SendData), // WORD RequestSize, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
454 |
&ipInfo, // PIP_OPTION_INFORMATION RequestOptions, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
455 |
ReplyBuffer, // LPVOID ReplyBuffer, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
456 |
ReplySize, // DWORD ReplySize, |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
457 |
timeout); // DWORD Timeout |
2 | 458 |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
459 |
free(ReplyBuffer); |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
460 |
IcmpCloseHandle(hIcmpFile); |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
461 |
|
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
462 |
|
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
463 |
if (dwRetVal != 0) { |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
464 |
return JNI_TRUE; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
465 |
} else { |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
466 |
return JNI_FALSE; |
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
467 |
} |
2 | 468 |
} |
469 |
||
470 |
/* |
|
471 |
* Class: java_net_Inet6AddressImpl |
|
472 |
* Method: isReachable0 |
|
473 |
* Signature: ([bII[bI)Z |
|
474 |
*/ |
|
475 |
JNIEXPORT jboolean JNICALL |
|
476 |
Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this, |
|
477 |
jbyteArray addrArray, |
|
478 |
jint scope, |
|
479 |
jint timeout, |
|
480 |
jbyteArray ifArray, |
|
481 |
jint ttl, jint if_scope) { |
|
482 |
jbyte caddr[16]; |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
483 |
jint sz; |
2 | 484 |
struct sockaddr_in6 him6; |
485 |
struct sockaddr_in6* netif = NULL; |
|
486 |
struct sockaddr_in6 inf6; |
|
487 |
int len = 0; |
|
37362
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
488 |
HANDLE hIcmpFile; |
2 | 489 |
|
490 |
/* |
|
491 |
* If IPv6 is not enable, then we can't reach an IPv6 address, can we? |
|
492 |
* Actually, we probably shouldn't even get here. |
|
493 |
*/ |
|
494 |
if (!ipv6_available()) { |
|
495 |
return JNI_FALSE; |
|
496 |
} |
|
497 |
/* |
|
498 |
* If it's an IPv4 address, ICMP won't work with IPv4 mapped address, |
|
499 |
* therefore, let's delegate to the Inet4Address method. |
|
500 |
*/ |
|
501 |
sz = (*env)->GetArrayLength(env, addrArray); |
|
502 |
if (sz == 4) { |
|
503 |
return Java_java_net_Inet4AddressImpl_isReachable0(env, this, |
|
504 |
addrArray, |
|
505 |
timeout, |
|
506 |
ifArray, ttl); |
|
507 |
} |
|
508 |
||
509 |
memset((char *) caddr, 0, 16); |
|
510 |
memset((char *) &him6, 0, sizeof(him6)); |
|
511 |
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr); |
|
512 |
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) ); |
|
513 |
him6.sin6_family = AF_INET6; |
|
514 |
if (scope > 0) { |
|
515 |
him6.sin6_scope_id = scope; |
|
516 |
} |
|
517 |
len = sizeof(struct sockaddr_in6); |
|
32266
e0a235a11254
8133015: InetAddress.isReachable(tmout) returning wrong value on Windows for IPv6
robm
parents:
25859
diff
changeset
|
518 |
|
2 | 519 |
/** |
520 |
* A network interface was specified, let's convert the address |
|
521 |
*/ |
|
522 |
if (!(IS_NULL(ifArray))) { |
|
523 |
memset((char *) caddr, 0, 16); |
|
524 |
memset((char *) &inf6, 0, sizeof(inf6)); |
|
525 |
(*env)->GetByteArrayRegion(env, ifArray, 0, 16, caddr); |
|
526 |
memcpy((void *)&(inf6.sin6_addr), caddr, sizeof(struct in6_addr) ); |
|
527 |
inf6.sin6_family = AF_INET6; |
|
528 |
inf6.sin6_port = 0; |
|
529 |
inf6.sin6_scope_id = if_scope; |
|
530 |
netif = &inf6; |
|
531 |
} |
|
532 |
||
37362
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
533 |
hIcmpFile = Icmp6CreateFile(); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
534 |
if (hIcmpFile == INVALID_HANDLE_VALUE) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
535 |
int err = WSAGetLastError(); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
536 |
if (err == ERROR_ACCESS_DENIED) { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
537 |
// fall back to TCP echo if access is denied to ICMP |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
538 |
return tcp_ping6(env, timeout, ttl, him6, netif, len); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
539 |
} else { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
540 |
NET_ThrowNew(env, err, "Unable to create ICMP file handle"); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
541 |
return JNI_FALSE; |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
542 |
} |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
543 |
} else { |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
544 |
return ping6(env, netif, &him6, timeout, hIcmpFile); |
9b3486880437
8150234: Windows 10 App Containers disallow access to ICMP calls
robm
parents:
32266
diff
changeset
|
545 |
} |
2 | 546 |
|
547 |
return JNI_FALSE; |
|
548 |
} |