fix bad handling of link-local ipv6 addresses

This commit is contained in:
Simon Morlat 2014-05-05 11:27:35 +02:00
parent e942c6590b
commit eba52ef155

View file

@ -1094,7 +1094,7 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul
ms_error("getnameinfo error: %s",strerror(errno));
}
/*avoid ipv6 link-local addresses*/
if (type==AF_INET6 && strchr(result,'%')!=NULL){
if (p_addr->sa_family==AF_INET6 && strchr(result,'%')!=NULL){
strcpy(result,"::1");
close_socket(sock);
return -1;