提交 9bd4755f 编写于 作者: R robm

8200719: Cannot connect to IPv6 host when exists any active network interface without IPv6 address

Reviewed-by: clanger, chegar
Contributed-by: joelpelaez@gmail.com
上级 8936a299
......@@ -96,7 +96,9 @@ void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
}
int defaultIndex;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him;
if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0)) {
if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0) &&
(IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) ||
IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) {
defaultIndex = (*env)->GetStaticIntField(env, ni_class,
ni_defaultIndexID);
sin6->sin6_scope_id = defaultIndex;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册