fix few bugs around ipv6 detection

This commit is contained in:
Simon Morlat 2014-03-09 22:18:37 +01:00
parent d1c6db8e3d
commit e022c57627
3 changed files with 9 additions and 5 deletions

View file

@ -1488,7 +1488,7 @@ void linphone_core_get_local_ip(LinphoneCore *lc, int af, char *result){
has_ipv6=linphone_core_get_local_ip_for(AF_INET6,NULL,result)==0;
if (strcmp(result,"::1")!=0)
return; /*this machine has real ipv6 connectivity*/
if (linphone_core_get_local_ip_for(AF_INET,NULL,result)==0 && strcmp(result,"::1")!=0)
if (linphone_core_get_local_ip_for(AF_INET,NULL,result)==0 && strcmp(result,"127.0.0.1")!=0)
return; /*this machine has only ipv4 connectivity*/
if (has_ipv6){
/*this machine has only local loopback for both ipv4 and ipv6, so prefer ipv6*/

View file

@ -1057,9 +1057,13 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul
if (err!=0){
ms_error("getnameinfo error: %s",strerror(errno));
}
/*avoid ipv6 link-local addresses*/
if (type==AF_INET6 && strchr(result,'%')!=NULL){
strcpy(result,"::1");
close_socket(sock);
return -1;
}
close_socket(sock);
return 0;
}
@ -1090,7 +1094,7 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
return -1;
}
#endif
return 0;
return 0;
}
SalReason linphone_reason_to_sal(LinphoneReason reason){

View file

@ -1464,11 +1464,11 @@ void linphone_gtk_show_parameters(void){
}
if (linphone_address_get_username(contact))
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact));
linphone_address_destroy(contact);
}
#ifdef BUILD_WIZARD
gtk_widget_show(linphone_gtk_get_widget(pb,"wizard"));
#endif
linphone_address_destroy(contact);
linphone_gtk_show_sip_accounts(pb);
/* CODECS CONFIG */
linphone_gtk_init_codec_list(GTK_TREE_VIEW(codec_list));