Skip to content


Thomas Haller requested to merge th/inet-addr-cleanup into master

Various cleanup for handling IP addresses (and their string representations).

Let's recap why we don't use inet_ntop() directly. The only reason is that inet_ntop() pretends that it might fail. But the only reason when this function can fail is if the addr-family is wrong, or the input buffers are not pointing to valid memory. De facto, properlty used the function cannot fail. In the past we had gazillon of code trying to handle errors from inet_ntop(). Instead, we use nm_utils_inet_ntop() and the likes, which asserts for valid input arguments, and otherwise cannot fail.

We should consistently use the same helper functions. That implies, a helper function defined in libnm-core/libnm is not suitable, because it's not available everywhere.

Move some of the helper functions to shared and do various cleanup along the way.

Merge request reports