提交 589fccae 编写于 作者: C chegar

6967937: Scope id no longer being set after 6931566

Reviewed-by: alanb, dsamersoff
上级 8063d839
...@@ -129,7 +129,7 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname); ...@@ -129,7 +129,7 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname);
static struct sockaddr *getBroadcast(JNIEnv *env, int sock, const char *name, struct sockaddr *brdcast_store); static struct sockaddr *getBroadcast(JNIEnv *env, int sock, const char *name, struct sockaddr *brdcast_store);
static short getSubnet(JNIEnv *env, int sock, const char *ifname); static short getSubnet(JNIEnv *env, int sock, const char *ifname);
static int getIndex(JNIEnv *env, int sock, const char *ifname); static int getIndex(int sock, const char *ifname);
static int getFlags(JNIEnv *env, int sock, const char *ifname); static int getFlags(JNIEnv *env, int sock, const char *ifname);
static int getMacAddress(JNIEnv *env, int sock, const char* ifname, const struct in_addr* addr, unsigned char *buf); static int getMacAddress(JNIEnv *env, int sock, const char* ifname, const struct in_addr* addr, unsigned char *buf);
...@@ -911,7 +911,7 @@ netif *addif(JNIEnv *env, int sock, const char * if_name, netif *ifs, struct soc ...@@ -911,7 +911,7 @@ netif *addif(JNIEnv *env, int sock, const char * if_name, netif *ifs, struct soc
CHECKED_MALLOC3(currif, netif *, sizeof(netif)+IFNAMSIZ ); CHECKED_MALLOC3(currif, netif *, sizeof(netif)+IFNAMSIZ );
currif->name = (char *) currif+sizeof(netif); currif->name = (char *) currif+sizeof(netif);
strcpy(currif->name, name); strcpy(currif->name, name);
currif->index = getIndex(env,sock,name); currif->index = getIndex(sock, name);
currif->addr = NULL; currif->addr = NULL;
currif->childs = NULL; currif->childs = NULL;
currif->virtual = isVirtual; currif->virtual = isVirtual;
...@@ -946,7 +946,7 @@ netif *addif(JNIEnv *env, int sock, const char * if_name, netif *ifs, struct soc ...@@ -946,7 +946,7 @@ netif *addif(JNIEnv *env, int sock, const char * if_name, netif *ifs, struct soc
CHECKED_MALLOC3(currif, netif *, sizeof(netif)+ IFNAMSIZ ); CHECKED_MALLOC3(currif, netif *, sizeof(netif)+ IFNAMSIZ );
currif->name = (char *) currif + sizeof(netif); currif->name = (char *) currif + sizeof(netif);
strcpy(currif->name, vname); strcpy(currif->name, vname);
currif->index = getIndex(env,sock,vname); currif->index = getIndex(sock, vname);
currif->addr = NULL; currif->addr = NULL;
/* Need to duplicate the addr entry? */ /* Need to duplicate the addr entry? */
currif->virtual = 1; currif->virtual = 1;
...@@ -1133,7 +1133,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { ...@@ -1133,7 +1133,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
#endif #endif
static int getIndex(JNIEnv *env, int sock, const char *name){ static int getIndex(int sock, const char *name){
/* /*
* Try to get the interface index * Try to get the interface index
* (Not supported on Solaris 2.6 or 7) * (Not supported on Solaris 2.6 or 7)
...@@ -1390,6 +1390,13 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family) ...@@ -1390,6 +1390,13 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family)
continue; continue;
} }
#ifdef AF_INET6
if (ifr->lifr_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *s6= (struct sockaddr_in6 *)&(ifr->lifr_addr);
s6->sin6_scope_id = getIndex(sock, ifr->lifr_name);
}
#endif
/* add to the list */ /* add to the list */
ifs = addif(env, sock,ifr->lifr_name, ifs, (struct sockaddr *)&(ifr->lifr_addr),family, (short) ifr->lifr_addrlen); ifs = addif(env, sock,ifr->lifr_name, ifs, (struct sockaddr *)&(ifr->lifr_addr),family, (short) ifr->lifr_addrlen);
...@@ -1407,7 +1414,7 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family) ...@@ -1407,7 +1414,7 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family)
return ifs; return ifs;
} }
static int getIndex(JNIEnv *env, int sock, const char *name){ static int getIndex(int sock, const char *name){
/* /*
* Try to get the interface index * Try to get the interface index
* (Not supported on Solaris 2.6 or 7) * (Not supported on Solaris 2.6 or 7)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/** /**
* @test * @test
* @bug 6214234 * @bug 6214234 6967937
* @summary IPv6 scope_id for local addresses not set in Solaris 10 * @summary IPv6 scope_id for local addresses not set in Solaris 10
*/ */
...@@ -51,6 +51,7 @@ public class B6214234 { ...@@ -51,6 +51,7 @@ public class B6214234 {
return; return;
} }
if (addr.getScopeId() == 0) { if (addr.getScopeId() == 0) {
System.out.println("addr: "+ addr);
throw new RuntimeException ("Non zero scope_id expected"); throw new RuntimeException ("Non zero scope_id expected");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册