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

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 19 13:25:20 CEST 2020


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




More information about the sr-dev mailing list