Browse code

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
(cherry picked from commit 8102ca5f67de979a3597a97f96a05c99d13fb29d)

Alex Hermann authored on 21/07/2016 11:29:38
Showing 1 changed files
... ...
@@ -1406,8 +1406,8 @@ static int fix_socket_list(struct socket_info **list, int* type_flags)
1406 1406
 	for (si=*list;si;){
1407 1407
 		next=si->next;
1408 1408
 		ai_lst=0;
1409
-		if (add_interfaces(si->name.s, 0, si->port_no,
1410
-							si->proto, &ai_lst)!=-1){
1409
+		if (add_interfaces(si->name.s, auto_bind_ipv6 ? 0 : AF_INET,
1410
+							si->port_no, si->proto, &ai_lst)!=-1){
1411 1411
 			if (si->flags & SI_IS_MHOMED){
1412 1412
 				if((new_si=new_sock2list_after(ai_lst->name.s, 0, si->port_no,
1413 1413
 											si->proto, si->useinfo.name.s,