[sr-dev] Possible code typo in socket_info.c, overhaul to use getifaddrs?

Christian Kühnke christian at kuehnke.de
Wed Dec 2 13:58:07 CET 2015


Hi all,
i think at some point a wrong boolean condition was introduced to 
fix_all_socket_lists in socket_info.c. Attached is a fix.

I am in the process of getting kamailio to run on my Solaris 11.3. I 
observed that add_interfaces does not work properly on Solaris for IPv6 
interfaces. Modern Solarises, however, have getifaddrs() which linuxes 
have since glibc-2.3 (2005 or so) and freebsd has it as well (don't know 
since when).

My plan is:

1. Replace add_interfaces with a getifaddrs() based implementation and 
get feedback from the community re: Solaris, FreeBSD and other platforms

2. Drop add_interfaces_via_netlink in favour of the above as well (for 
Linux).

What do you think?

Regards,
Christian

--- socket_info.c.orig  2015-11-25 14:42:32.000000000 +0100
+++ socket_info.c       2015-12-02 13:45:51.130418762 +0100
@@ -1809,7 +1809,7 @@
  #ifdef __OS_linux
                 &&  (!auto_bind_ipv6 || add_interfaces_via_netlink(0, 
AF_INET6, 0, PROTO_UDP, &ai_lst) == 0)
  #else
-               && ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,  
PROTO_UDP, &ai_lst) !=0 ) /* add_interface does not work for IPv6 on 
Linux */
+               && ( !auto_bind_ipv6 || add_interfaces(0, AF_INET6, 0,  
PROTO_UDP, &ai_lst) ==0 ) /* add_interface does not work for IPv6 on 
Linux */
  #endif /* __OS_linux */
                          ) && (addr_info_to_si_lst(ai_lst, 0, 
PROTO_UDP, 0, &udp_listen)==0)){
                         free_addr_info_lst(&ai_lst);




More information about the sr-dev mailing list