diff options
-rw-r--r-- | libnm-core/nm-core-internal.h | 2 | ||||
-rw-r--r-- | libnm-core/nm-utils.c | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 59ebfcb132..60963c9cd9 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -429,6 +429,8 @@ NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection * /*****************************************************************************/ +const char *nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst); + gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr); /*****************************************************************************/ diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index bc9558347c..fadbcf342d 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -3762,6 +3762,22 @@ nm_utils_is_uuid (const char *str) static char _nm_utils_inet_ntop_buffer[NM_UTILS_INET_ADDRSTRLEN]; +const char * +nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst) +{ + const char *s; + + nm_assert_addr_family (addr_family); + nm_assert (addr); + + s = inet_ntop (addr_family, + addr, + dst ? dst : _nm_utils_inet_ntop_buffer, + addr_family == AF_INET6 ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN); + nm_assert (s); + return s; +} + /** * nm_utils_inet4_ntop: (skip) * @inaddr: the address that should be converted to string. |