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

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 3 13:28:44 CET 2015


Hello,

it looks like you are right, I pushed the fix to master branch for now.

If you can rework that based on the more recent standard lib functions,
that would be very appreciated. The best way to contribute is to make a
pull request via github, that way we can see that the patch compiles on
different versions of operating systems. Some relevant details for
contributions via github:

  - https://www.kamailio.org/wiki/devel/github-contributions

Cheers,
Daniel

On 02/12/15 13:58, Christian Kühnke wrote:
> 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);
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu




More information about the sr-dev mailing list