Răsfoiți Sursa

core: Don't bind to IPv6 addresses if auto_bind_ipv6 is disabled

With the following listen statement:
   listen=udp:eth0:5060
Kamailio would try to bind to the IPv6 address(es) on that interface and fail with:

ERROR: <core> [udp_server.c:369]: udp_init(): might be caused by using a link local address, try site local or global
Alex Hermann 9 ani în urmă
părinte
comite
8102ca5f67
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      socket_info.c

+ 2 - 2
socket_info.c

@@ -1406,8 +1406,8 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
 	for (si=*list;si;){
 		next=si->next;
 		ai_lst=0;
-		if (add_interfaces(si->name.s, 0, si->port_no,
-							si->proto, &ai_lst)!=-1){
+		if (add_interfaces(si->name.s, auto_bind_ipv6 ? 0 : AF_INET,
+							si->port_no, si->proto, &ai_lst)!=-1){
 			if (si->flags & SI_IS_MHOMED){
 				if((new_si=new_sock2list_after(ai_lst->name.s, 0, si->port_no,
 											si->proto, si->useinfo.name.s,