[sr-dev] info: changes to ip addr code

Henning Westerholt hw at skalatan.de
Mon Oct 19 18:31:12 CEST 2020


Thanks Daniel,

sounds like a good fix and refactoring to me.

Cheers,

Henning

-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://gilawa.com 

-----Original Message-----
From: sr-dev <sr-dev-bounces at lists.kamailio.org> On Behalf Of Daniel-Constantin Mierla
Sent: Monday, October 19, 2020 1:25 PM
To: Kamailio (SER) - Development Mailing List <sr-dev at lists.kamailio.org>
Subject: [sr-dev] info: changes to ip addr code

Hello,

to highlight it better, I am sending a short announcement to sr-dev to inform about changes done to ip_addr.{c,h} earlier today.

First is about the use of inet_ntop() for converting IPv6 address to string representation, which does it conforming to rfc5952, this is happening when global parameter ipv6_hex_style="c" (this being the default now). According to manual page, inet_ntop() is conforming with POSIX 2001 and already used in core socket_info.c as well as a few modules such as rtpengine, thus I expect no problems with it, likely no older compilers will be used with kamailio. The benefit is the use a standard compliant function and output.

Second: becaise ip_addr.h had a lot of static inline functions, several of them being quite consistent in size, I relocated many implementations to ip_addr.c, removing the static inline declarators. As I read on the net, the benefit of inline for performances can be invalidated if it is abused, because it can make CPU instructions cache less efficient.
Moreover, because of their size, some of them were likely not inlined.
Moreover, functions calling inside other functions seems not to be inlined, therefore I tried to relocate those that have a chain of functions executed inside. Overall, the performance gain of inline is really minimal, even when inlining is applied by compiler.

The effect of the second change is that many static buffers used by the former static-inline functions are declared only once. It was well known that they used static buffer and the result was cloned after use of the functions, so it should be no regression introduced.

Anyhow, if someone observes problems with ip addresses in master branch, just open a bug and it will be fixed.

Cheers,
Daniel

--
Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev at lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev



More information about the sr-dev mailing list