summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-01-28 11:51:49 +0100
committerThomas Haller <thaller@redhat.com>2020-01-28 11:51:49 +0100
commit19d0b035ddfa918d0fd71375665e7ce0af61aaf9 (patch)
tree06e33a79fcec1ae49989d4e213d9515fa942aee5
parent8590d2ecfb9aec9d78ddfa0f6cbc8adce3d3669b (diff)
parent07b66da4a14b75565c359b1aaf78f222ebb25ca2 (diff)
downloadNetworkManager-19d0b035ddfa918d0fd71375665e7ce0af61aaf9.tar.gz
all: merge branch 'th/inet-addr-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/389
-rw-r--r--clients/cloud-setup/main.c2
-rw-r--r--clients/common/nm-meta-setting-desc.c4
-rw-r--r--clients/tui/nm-editor-bindings.c6
-rw-r--r--libnm-core/nm-connection.c2
-rw-r--r--libnm-core/nm-core-internal.h28
-rw-r--r--libnm-core/nm-setting-ip-config.c43
-rw-r--r--libnm-core/nm-setting-ip-tunnel.c4
-rw-r--r--libnm-core/nm-setting-ip6-config.c2
-rw-r--r--libnm-core/nm-setting-ovs-patch.c4
-rw-r--r--libnm-core/nm-setting-vxlan.c6
-rw-r--r--libnm-core/nm-utils.c33
-rw-r--r--libnm-core/tests/test-general.c29
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.c37
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.h86
-rw-r--r--shared/nm-keyfile/nm-keyfile.c2
-rw-r--r--shared/nm-utils/nm-test-utils.h8
-rw-r--r--src/devices/nm-acd-manager.c16
-rw-r--r--src/devices/nm-device-ip-tunnel.c117
-rw-r--r--src/devices/nm-device-vxlan.c8
-rw-r--r--src/devices/nm-device.c14
-rw-r--r--src/devices/tests/test-acd.c2
-rw-r--r--src/dhcp/nm-dhcp-nettools.c22
-rw-r--r--src/dhcp/nm-dhcp-systemd.c24
-rw-r--r--src/dhcp/nm-dhcp-utils.c6
-rw-r--r--src/dns/nm-dns-dnsmasq.c4
-rw-r--r--src/dns/nm-dns-manager.c8
-rw-r--r--src/dnsmasq/nm-dnsmasq-manager.c4
-rw-r--r--src/dnsmasq/nm-dnsmasq-utils.c5
-rw-r--r--src/initrd/nmi-cmdline-reader.c4
-rw-r--r--src/initrd/nmi-ibft-reader.c6
-rw-r--r--src/ndisc/nm-ndisc.c4
-rw-r--r--src/nm-config-data.c8
-rw-r--r--src/nm-core-utils.c6
-rw-r--r--src/nm-core-utils.h2
-rw-r--r--src/nm-ip4-config.c22
-rw-r--r--src/nm-ip6-config.c14
-rw-r--r--src/nm-pacrunner-manager.c8
-rw-r--r--src/nm-policy.c8
-rw-r--r--src/platform/nm-fake-platform.c4
-rw-r--r--src/platform/nm-linux-platform.c12
-rw-r--r--src/platform/nm-platform.c36
-rw-r--r--src/platform/nmp-object.c10
-rw-r--r--src/platform/tests/test-common.c48
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c14
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c4
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c2
-rw-r--r--src/settings/plugins/ifupdown/nms-ifupdown-parser.c4
-rw-r--r--src/vpn/nm-vpn-connection.c28
48 files changed, 428 insertions, 342 deletions
diff --git a/clients/cloud-setup/main.c b/clients/cloud-setup/main.c
index 743f931c0f..d46c88e424 100644
--- a/clients/cloud-setup/main.c
+++ b/clients/cloud-setup/main.c
@@ -335,7 +335,7 @@ _nmc_mangle_connection (NMDevice *device,
entry = nm_ip_routing_rule_new (AF_INET);
nm_ip_routing_rule_set_priority (entry, rt_table);
nm_ip_routing_rule_set_from (entry,
- nm_utils_inet4_ntop (config_data->ipv4s_arr[i], sbuf),
+ _nm_utils_inet4_ntop (config_data->ipv4s_arr[i], sbuf),
32);
nm_ip_routing_rule_set_table (entry, rt_table);
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index c5b8bb3166..d7423b6392 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -364,7 +364,7 @@ _parse_ip_route (int family,
for (i = 1; routev[i]; i++) {
gint64 tmp64;
- if (nm_utils_ipaddr_valid (family, routev[i])) {
+ if (nm_utils_ipaddr_is_valid (family, routev[i])) {
if (metric != -1 || attrs) {
g_set_error (error, 1, 0, _("the next hop ('%s') must be first"), routev[i]);
return NULL;
@@ -3336,7 +3336,7 @@ _set_fcn_ip_config_gateway (ARGS_SET_FCN)
value = nm_strstrip_avoid_copy_a (300, value, &value_to_free);
- if (!nm_utils_ipaddr_valid (addr_family, value)) {
+ if (!nm_utils_ipaddr_is_valid (addr_family, value)) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid gateway address '%s'"),
value);
diff --git a/clients/tui/nm-editor-bindings.c b/clients/tui/nm-editor-bindings.c
index 8e6c9600d7..c5606f11ef 100644
--- a/clients/tui/nm-editor-bindings.c
+++ b/clients/tui/nm-editor-bindings.c
@@ -192,7 +192,7 @@ ip_addresses_check_and_copy (GBinding *binding,
strings = g_value_get_boxed (source_value);
for (i = 0; strings[i]; i++) {
- if (!nm_utils_ipaddr_valid (addr_family, strings[i]))
+ if (!nm_utils_ipaddr_is_valid (addr_family, strings[i]))
return FALSE;
}
@@ -251,7 +251,7 @@ ip_gateway_from_string (GBinding *binding,
const char *gateway;
gateway = g_value_get_string (source_value);
- if (gateway && !nm_utils_ipaddr_valid (addr_family, gateway))
+ if (gateway && !nm_utils_ipaddr_is_valid (addr_family, gateway))
gateway = NULL;
g_value_set_string (target_value, gateway);
@@ -457,7 +457,7 @@ ip_route_transform_from_next_hop_string (GBinding *binding,
text = g_value_get_string (source_value);
if (*text) {
- if (!nm_utils_ipaddr_valid (addr_family, text))
+ if (!nm_utils_ipaddr_is_valid (addr_family, text))
return FALSE;
} else
text = NULL;
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 7c62bea2f3..36d2cd6dfe 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -999,7 +999,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
if ( inet_pton (AF_INET6, token, &i6_token) == 1
&& _nm_utils_inet6_is_token (&i6_token)) {
- nm_utils_inet6_ntop (&i6_token, normalized);
+ _nm_utils_inet6_ntop (&i6_token, normalized);
if (g_strcmp0 (token, normalized)) {
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, normalized, NULL);
changed = TRUE;
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index bd65432eee..2bc7a53aae 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -538,34 +538,6 @@ gboolean _nm_setting_bond_option_supported (const char *option, NMBondMode mode)
NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection);
-/*****************************************************************************/
-
-const char *nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst);
-
-static inline char *
-nm_utils_inet4_ntop_dup (in_addr_t addr)
-{
- char buf[NM_UTILS_INET_ADDRSTRLEN];
-
- return g_strdup (nm_utils_inet4_ntop (addr, buf));
-}
-
-static inline char *
-nm_utils_inet6_ntop_dup (const struct in6_addr *addr)
-{
- char buf[NM_UTILS_INET_ADDRSTRLEN];
-
- return g_strdup (nm_utils_inet6_ntop (addr, buf));
-}
-
-static inline char *
-nm_utils_inet_ntop_dup (int addr_family, gconstpointer addr)
-{
- char buf[NM_UTILS_INET_ADDRSTRLEN];
-
- return g_strdup (nm_utils_inet_ntop (addr_family, addr, buf));
-}
-
gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr);
/*****************************************************************************/
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 658b563798..fe59776e27 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -50,19 +50,6 @@ const NMUtilsDNSOptionDesc _nm_utils_dns_option_descs[] = {
{ NULL, FALSE, FALSE }
};
-static int
-_addr_size (int family)
-{
- switch (family) {
- case AF_INET:
- return sizeof (in_addr_t);
- case AF_INET6:
- return sizeof (struct in6_addr);
- default:
- g_return_val_if_reached (0);
- }
-}
-
static char *
canonicalize_ip (int family, const char *ip, gboolean null_any)
{
@@ -84,7 +71,7 @@ canonicalize_ip (int family, const char *ip, gboolean null_any)
g_return_val_if_fail (ret == 1, NULL);
if (null_any) {
- if (!memcmp (addr_bytes, &in6addr_any, _addr_size (family)))
+ if (!memcmp (addr_bytes, &in6addr_any, nm_utils_addr_family_to_size (family)))
return NULL;
}
@@ -106,7 +93,7 @@ canonicalize_ip_binary (int family, gconstpointer ip, gboolean null_any)
g_return_val_if_reached (NULL);
}
if (null_any) {
- if (!memcmp (ip, &in6addr_any, _addr_size (family)))
+ if (!memcmp (ip, &in6addr_any, nm_utils_addr_family_to_size (family)))
return NULL;
}
return g_strdup (inet_ntop (family, ip, string, sizeof (string)));
@@ -120,7 +107,7 @@ valid_ip (int family, const char *ip, GError **error)
family == AF_INET ? _("Missing IPv4 address") : _("Missing IPv6 address"));
return FALSE;
}
- if (!nm_utils_ipaddr_valid (family, ip)) {
+ if (!nm_utils_ipaddr_is_valid (family, ip)) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
family == AF_INET ? _("Invalid IPv4 address '%s'") : _("Invalid IPv6 address '%s'"),
ip);
@@ -446,7 +433,7 @@ nm_ip_address_set_address (NMIPAddress *address,
{
g_return_if_fail (address != NULL);
g_return_if_fail (addr != NULL);
- g_return_if_fail (nm_utils_ipaddr_valid (address->family, addr));
+ g_return_if_fail (nm_utils_ipaddr_is_valid (address->family, addr));
g_free (address->address);
address->address = canonicalize_ip (address->family, addr, FALSE);
@@ -900,14 +887,14 @@ nm_ip_route_get_dest (NMIPRoute *route)
* Sets the destination property of this route object.
*
* @dest must be a valid address of @route's family. If you aren't sure you
- * have a valid address, use nm_utils_ipaddr_valid() to check it.
+ * have a valid address, use nm_utils_ipaddr_is_valid() to check it.
**/
void
nm_ip_route_set_dest (NMIPRoute *route,
const char *dest)
{
g_return_if_fail (route != NULL);
- g_return_if_fail (nm_utils_ipaddr_valid (route->family, dest));
+ g_return_if_fail (nm_utils_ipaddr_is_valid (route->family, dest));
g_free (route->dest);
route->dest = canonicalize_ip (route->family, dest, FALSE);
@@ -1022,7 +1009,7 @@ nm_ip_route_set_next_hop (NMIPRoute *route,
const char *next_hop)
{
g_return_if_fail (route != NULL);
- g_return_if_fail (!next_hop || nm_utils_ipaddr_valid (route->family, next_hop));
+ g_return_if_fail (!next_hop || nm_utils_ipaddr_is_valid (route->family, next_hop));
g_free (route->next_hop);
route->next_hop = canonicalize_ip (route->family, next_hop, TRUE);
@@ -1051,7 +1038,7 @@ nm_ip_route_get_next_hop_binary (NMIPRoute *route,
inet_pton (route->family, route->next_hop, next_hop);
return TRUE;
} else {
- memset (next_hop, 0, _addr_size (route->family));
+ memset (next_hop, 0, nm_utils_addr_family_to_size (route->family));
return FALSE;
}
}
@@ -1310,7 +1297,7 @@ nm_ip_route_attribute_validate (const char *name,
switch (spec->str_type) {
case 'a': /* IP address */
- if (!nm_utils_ipaddr_valid (family, string)) {
+ if (!nm_utils_ipaddr_is_valid (family, string)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_FAILED,
@@ -1338,7 +1325,7 @@ nm_ip_route_attribute_validate (const char *name,
return FALSE;
}
}
- if (!nm_utils_ipaddr_valid (family, addr)) {
+ if (!nm_utils_ipaddr_is_valid (family, addr)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_FAILED,
@@ -3698,7 +3685,7 @@ nm_setting_ip_config_add_dns (NMSettingIPConfig *setting, const char *dns)
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
+ g_return_val_if_fail (nm_utils_ipaddr_is_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
@@ -3754,7 +3741,7 @@ nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting, const char
g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), FALSE);
g_return_val_if_fail (dns != NULL, FALSE);
- g_return_val_if_fail (nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
+ g_return_val_if_fail (nm_utils_ipaddr_is_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns), FALSE);
priv = NM_SETTING_IP_CONFIG_GET_PRIVATE (setting);
@@ -4959,7 +4946,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
for (i = 0; i < priv->dns->len; i++) {
const char *dns = priv->dns->pdata[i];
- if (!nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns)) {
+ if (!nm_utils_ipaddr_is_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), dns)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -5019,7 +5006,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (!nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), priv->gateway)) {
+ if (!nm_utils_ipaddr_is_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), priv->gateway)) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -5441,7 +5428,7 @@ set_property (GObject *object, guint prop_id,
break;
case PROP_GATEWAY:
gateway = g_value_get_string (value);
- g_return_if_fail (!gateway || nm_utils_ipaddr_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway));
+ g_return_if_fail (!gateway || nm_utils_ipaddr_is_valid (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway));
g_free (priv->gateway);
priv->gateway = canonicalize_ip (NM_SETTING_IP_CONFIG_GET_FAMILY (setting), gateway, TRUE);
break;
diff --git a/libnm-core/nm-setting-ip-tunnel.c b/libnm-core/nm-setting-ip-tunnel.c
index cd5ccc4930..9c77630b01 100644
--- a/libnm-core/nm-setting-ip-tunnel.c
+++ b/libnm-core/nm-setting-ip-tunnel.c
@@ -341,7 +341,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (priv->local && !nm_utils_ipaddr_valid (family, priv->local)) {
+ if (priv->local && !nm_utils_ipaddr_is_valid (family, priv->local)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@@ -361,7 +361,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (!nm_utils_ipaddr_valid (family, priv->remote)) {
+ if (!nm_utils_ipaddr_is_valid (family, priv->remote)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c
index bef4e061c9..eba7bc7f9d 100644
--- a/libnm-core/nm-setting-ip6-config.c
+++ b/libnm-core/nm-setting-ip6-config.c
@@ -235,7 +235,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (g_strcmp0 (priv->token, nm_utils_inet6_ntop (&i6_token, s_token)))
+ if (g_strcmp0 (priv->token, _nm_utils_inet6_ntop (&i6_token, s_token)))
token_needs_normalization = TRUE;
} else {
g_set_error_literal (error,
diff --git a/libnm-core/nm-setting-ovs-patch.c b/libnm-core/nm-setting-ovs-patch.c
index b211cc1457..6a9c9f5681 100644
--- a/libnm-core/nm-setting-ovs-patch.c
+++ b/libnm-core/nm-setting-ovs-patch.c
@@ -81,8 +81,8 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if ( !nm_utils_ipaddr_valid (AF_INET, self->peer)
- && !nm_utils_ipaddr_valid (AF_INET6, self->peer)) {
+ if ( !nm_utils_ipaddr_is_valid (AF_INET, self->peer)
+ && !nm_utils_ipaddr_is_valid (AF_INET6, self->peer)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
diff --git a/libnm-core/nm-setting-vxlan.c b/libnm-core/nm-setting-vxlan.c
index 15c2687599..e38a720adc 100644
--- a/libnm-core/nm-setting-vxlan.c
+++ b/libnm-core/nm-setting-vxlan.c
@@ -327,9 +327,9 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
- if (nm_utils_ipaddr_valid (AF_INET, priv->remote))
+ if (nm_utils_ipaddr_is_valid (AF_INET, priv->remote))
family = AF_INET;
- else if (nm_utils_ipaddr_valid (AF_INET6, priv->remote))
+ else if (nm_utils_ipaddr_is_valid (AF_INET6, priv->remote))
family = AF_INET6;
else {
g_set_error (error,
@@ -344,7 +344,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
if (priv->local) {
- if (!nm_utils_ipaddr_valid (family, priv->local)) {
+ if (!nm_utils_ipaddr_is_valid (family, priv->local)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index b6d085d961..3fb067e046 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -4819,23 +4819,6 @@ 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);
- nm_assert (dst);
-
- s = inet_ntop (addr_family,
- addr,
- dst,
- 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.
@@ -4861,8 +4844,7 @@ nm_utils_inet4_ntop (in_addr_t inaddr, char *dst)
*
* However, still support it to be lenient against mistakes and because
* this is public API of libnm. */
- return inet_ntop (AF_INET, &inaddr, dst ?: _nm_utils_inet_ntop_buffer,
- INET_ADDRSTRLEN);
+ return _nm_utils_inet4_ntop (inaddr, dst ?: _nm_utils_inet_ntop_buffer);
}
/**
@@ -4892,8 +4874,7 @@ nm_utils_inet6_ntop (const struct in6_addr *in6addr, char *dst)
* However, still support it to be lenient against mistakes and because
* this is public API of libnm. */
g_return_val_if_fail (in6addr, NULL);
- return inet_ntop (AF_INET6, in6addr, dst ?: _nm_utils_inet_ntop_buffer,
- INET6_ADDRSTRLEN);
+ return _nm_utils_inet6_ntop (in6addr, dst ?: _nm_utils_inet_ntop_buffer);
}
/**
@@ -4909,17 +4890,9 @@ nm_utils_inet6_ntop (const struct in6_addr *in6addr, char *dst)
gboolean
nm_utils_ipaddr_valid (int family, const char *ip)
{
- guint8 buf[sizeof (struct in6_addr)];
-
g_return_val_if_fail (family == AF_INET || family == AF_INET6 || family == AF_UNSPEC, FALSE);
- if (!ip)
- return FALSE;
-
- if (family == AF_UNSPEC)
- family = strchr (ip, ':') ? AF_INET6 : AF_INET;
-
- return inet_pton (family, ip, buf) == 1;
+ return nm_utils_ipaddr_is_valid (family, ip);
}
/**
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 9ea3079e83..e42ac737e0 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -8328,6 +8328,33 @@ test_integrate_maincontext (gconstpointer test_data)
/*****************************************************************************/
+static void
+test_nm_ip_addr_zero (void)
+{
+ in_addr_t a4 = nmtst_inet4_from_string ("0.0.0.0");
+ struct in6_addr a6 = *nmtst_inet6_from_string ("::");
+ char buf[NM_UTILS_INET_ADDRSTRLEN];
+ NMIPAddr a = NM_IP_ADDR_INIT;
+
+ g_assert (memcmp (&a, &nm_ip_addr_zero, sizeof (a)) == 0);
+
+ g_assert (IN6_IS_ADDR_UNSPECIFIED (&nm_ip_addr_zero.addr6));
+ g_assert (memcmp (&nm_ip_addr_zero.addr6, &in6addr_any, sizeof (in6addr_any)) == 0);
+
+ g_assert (memcmp (&nm_ip_addr_zero, &a4, sizeof (a4)) == 0);
+ g_assert (memcmp (&nm_ip_addr_zero, &a6, sizeof (a6)) == 0);
+
+ g_assert_cmpstr (_nm_utils_inet4_ntop (nm_ip_addr_zero.addr4, buf), ==, "0.0.0.0");
+ g_assert_cmpstr (_nm_utils_inet6_ntop (&nm_ip_addr_zero.addr6, buf), ==, "::");
+
+ g_assert_cmpstr (nm_utils_inet_ntop (AF_INET, &nm_ip_addr_zero, buf), ==, "0.0.0.0");
+ g_assert_cmpstr (nm_utils_inet_ntop (AF_INET6, &nm_ip_addr_zero, buf), ==, "::");
+
+ G_STATIC_ASSERT_EXPR (sizeof (a) == sizeof (a.array));
+}
+
+/*****************************************************************************/
+
NMTST_DEFINE ();
int main (int argc, char **argv)
@@ -8492,5 +8519,7 @@ int main (int argc, char **argv)
g_test_add_data_func ("/core/general/test_integrate_maincontext/1", GUINT_TO_POINTER (1), test_integrate_maincontext);
g_test_add_data_func ("/core/general/test_integrate_maincontext/2", GUINT_TO_POINTER (2), test_integrate_maincontext);
+ g_test_add_func ("/core/general/test_nm_ip_addr_zero", test_nm_ip_addr_zero);
+
return g_test_run ();
}
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c
index 3207d8edf9..befde06d1f 100644
--- a/shared/nm-glib-aux/nm-shared-utils.c
+++ b/shared/nm-glib-aux/nm-shared-utils.c
@@ -882,6 +882,43 @@ nm_utils_parse_inaddr_prefix (int addr_family,
/*****************************************************************************/
+gboolean
+nm_utils_ipaddr_is_valid (int addr_family,
+ const char *str_addr)
+{
+ nm_assert (NM_IN_SET (addr_family, AF_UNSPEC, AF_INET, AF_INET6));
+
+ return str_addr
+ && nm_utils_parse_inaddr_bin (addr_family,
+ str_addr,
+ NULL,
+ NULL);
+}
+
+gboolean
+nm_utils_ipaddr_is_normalized (int addr_family,
+ const char *str_addr)
+{
+ NMIPAddr addr;
+ char sbuf[NM_UTILS_INET_ADDRSTRLEN];
+
+ nm_assert (NM_IN_SET (addr_family, AF_UNSPEC, AF_INET, AF_INET6));
+
+ if (!str_addr)
+ return FALSE;
+
+ if (!nm_utils_parse_inaddr_bin (addr_family,
+ str_addr,
+ &addr_family,
+ &addr))
+ return FALSE;
+
+ nm_utils_inet_ntop (addr_family, &addr, sbuf);
+ return nm_streq (sbuf, str_addr);
+}
+
+/*****************************************************************************/
+
/* _nm_utils_ascii_str_to_int64:
*
* A wrapper for g_ascii_strtoll, that checks whether the whole string
diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h
index e7934cf163..ebb526152a 100644
--- a/shared/nm-glib-aux/nm-shared-utils.h
+++ b/shared/nm-glib-aux/nm-shared-utils.h
@@ -115,11 +115,31 @@ typedef struct {
* However, as ethernet addresses fit in here nicely, use
* it also for an ethernet MAC address. */
guint8 addr_eth[6 /*ETH_ALEN*/];
+
+ guint8 array[sizeof (struct in6_addr)];
};
} NMIPAddr;
+#define NM_IP_ADDR_INIT { .array = { 0 } }
+
extern const NMIPAddr nm_ip_addr_zero;
+static inline int
+nm_ip_addr_cmp (int addr_family, gconstpointer a, gconstpointer b)
+{
+ nm_assert_addr_family (addr_family);
+ nm_assert (a);
+ nm_assert (b);
+
+ return memcmp (a, b, nm_utils_addr_family_to_size (addr_family));
+}
+
+static inline gboolean
+nm_ip_addr_equal (int addr_family, gconstpointer a, gconstpointer b)
+{
+ return nm_ip_addr_cmp (addr_family, a, b) == 0;
+}
+
static inline gboolean
nm_ip_addr_is_null (int addr_family, gconstpointer addr)
{
@@ -158,6 +178,72 @@ nm_ip4_addr_is_localhost (in_addr_t addr4)
/*****************************************************************************/
+#define NM_UTILS_INET_ADDRSTRLEN INET6_ADDRSTRLEN
+
+static inline const char *
+nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst)
+{
+ const char *s;
+
+ const char *inet_ntop (int af,
+ const void *src,
+ char *dst,
+ socklen_t size);
+
+ nm_assert_addr_family (addr_family);
+ nm_assert (addr);
+ nm_assert (dst);
+
+ s = inet_ntop (addr_family,
+ addr,
+ dst,
+ addr_family == AF_INET6 ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN);
+ nm_assert (s);
+ return s;
+}
+
+static inline const char *
+_nm_utils_inet4_ntop (in_addr_t addr, char dst[static INET_ADDRSTRLEN])
+{
+ return nm_utils_inet_ntop (AF_INET, &addr, dst);
+}
+
+static inline const char *
+_nm_utils_inet6_ntop (const struct in6_addr *addr, char dst[static INET6_ADDRSTRLEN])
+{
+ return nm_utils_inet_ntop (AF_INET6, addr, dst);
+}
+
+static inline char *
+nm_utils_inet_ntop_dup (int addr_family, gconstpointer addr)
+{
+ char buf[NM_UTILS_INET_ADDRSTRLEN];
+
+ return g_strdup (nm_utils_inet_ntop (addr_family, addr, buf));
+}
+
+static inline char *
+nm_utils_inet4_ntop_dup (in_addr_t addr)
+{
+ return nm_utils_inet_ntop_dup (AF_INET, &addr);
+}
+
+static inline char *
+nm_utils_inet6_ntop_dup (const struct in6_addr *addr)
+{
+ return nm_utils_inet_ntop_dup (AF_INET6, addr);
+}
+
+/*****************************************************************************/
+
+gboolean nm_utils_ipaddr_is_valid (int addr_family,
+ const char *str_addr);
+
+gboolean nm_utils_ipaddr_is_normalized (int addr_family,
+ const char *str_addr);
+
+/*****************************************************************************/
+
#define NM_CMP_RETURN(c) \
G_STMT_START { \
const int _cc = (c); \
diff --git a/shared/nm-keyfile/nm-keyfile.c b/shared/nm-keyfile/nm-keyfile.c
index 535acccf7d..1eed6748a4 100644
--- a/shared/nm-keyfile/nm-keyfile.c
+++ b/shared/nm-keyfile/nm-keyfile.c
@@ -248,7 +248,7 @@ build_route (KeyfileReaderInfo *info,
/* Next hop */
if (gateway_str && gateway_str[0]) {
- if (!nm_utils_ipaddr_valid (family, gateway_str)) {
+ if (!nm_utils_ipaddr_is_valid (family, gateway_str)) {
/* Try workaround for routes written by broken keyfile writer.
* Due to bug bgo#719851, an older version of writer would have
* written "a:b:c:d::/plen,metric" if the gateway was ::, instead
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index a3938e0121..fc7025bf8e 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -1597,9 +1597,9 @@ nmtst_setting_ip_config_add_address (NMSettingIPConfig *s_ip,
g_assert (s_ip);
- if (nm_utils_ipaddr_valid (AF_INET, address))
+ if (nm_utils_ipaddr_is_valid (AF_INET, address))
family = AF_INET;
- else if (nm_utils_ipaddr_valid (AF_INET6, address))
+ else if (nm_utils_ipaddr_is_valid (AF_INET6, address))
family = AF_INET6;
else
g_assert_not_reached ();
@@ -1622,9 +1622,9 @@ nmtst_setting_ip_config_add_route (NMSettingIPConfig *s_ip,
g_assert (s_ip);
- if (nm_utils_ipaddr_valid (AF_INET, dest))
+ if (nm_utils_ipaddr_is_valid (AF_INET, dest))
family = AF_INET;
- else if (nm_utils_ipaddr_valid (AF_INET6, dest))
+ else if (nm_utils_ipaddr_is_valid (AF_INET6, dest))
family = AF_INET6;
else
g_assert_not_reached ();
diff --git a/src/devices/nm-acd-manager.c b/src/devices/nm-acd-manager.c
index c771147968..735dd25b09 100644
--- a/src/devices/nm-acd-manager.c
+++ b/src/devices/nm-acd-manager.c
@@ -184,12 +184,12 @@ acd_event (int fd,
r = n_acd_probe_announce (info->probe, N_ACD_DEFEND_ONCE);
if (r) {
_LOGW ("couldn't announce address %s on interface '%s': %s",
- nm_utils_inet4_ntop (info->address, address_str),
+ _nm_utils_inet4_ntop (info->address, address_str),
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
acd_error_to_string (r));
} else {
_LOGD ("announcing address %s",
- nm_utils_inet4_ntop (info->address, address_str));
+ _nm_utils_inet4_ntop (info->address, address_str));
}
}
check_probing_done = TRUE;
@@ -202,14 +202,14 @@ acd_event (int fd,
case N_ACD_EVENT_DEFENDED:
n_acd_probe_get_userdata (event->defended.probe, (void **) &info);
_LOGD ("defended address %s from host %s",
- nm_utils_inet4_ntop (info->address, address_str),
+ _nm_utils_inet4_ntop (info->address, address_str),
(hwaddr_str = nm_utils_hwaddr_ntoa (event->defended.sender,
event->defended.n_sender)));
break;
case N_ACD_EVENT_CONFLICT:
n_acd_probe_get_userdata (event->conflict.probe, (void **) &info);
_LOGW ("conflict for address %s detected with host %s on interface '%s'",
- nm_utils_inet4_ntop (info->address, address_str),
+ _nm_utils_inet4_ntop (info->address, address_str),
(hwaddr_str = nm_utils_hwaddr_ntoa (event->defended.sender,
event->defended.n_sender)),
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex));
@@ -249,7 +249,7 @@ acd_probe_add (NMAcdManager *self,
r = n_acd_probe_config_new (&probe_config);
if (r) {
_LOGW ("could not create probe config for %s on interface '%s': %s",
- nm_utils_inet4_ntop (info->address, sbuf),
+ _nm_utils_inet4_ntop (info->address, sbuf),
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
acd_error_to_string (r));
return FALSE;
@@ -261,7 +261,7 @@ acd_probe_add (NMAcdManager *self,
r = n_acd_probe (self->acd, &info->probe, probe_config);
if (r) {
_LOGW ("could not start probe for %s on interface '%s': %s",
- nm_utils_inet4_ntop (info->address, sbuf),
+ _nm_utils_inet4_ntop (info->address, sbuf),
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
acd_error_to_string (r));
n_acd_probe_config_free (probe_config);
@@ -417,12 +417,12 @@ nm_acd_manager_announce_addresses (NMAcdManager *self)
r = n_acd_probe_announce (info->probe, N_ACD_DEFEND_ONCE);
if (r) {
_LOGW ("couldn't announce address %s on interface '%s': %s",
- nm_utils_inet4_ntop (info->address, sbuf),
+ _nm_utils_inet4_ntop (info->address, sbuf),
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
acd_error_to_string (r));
success = FALSE;
} else
- _LOGD ("announcing address %s", nm_utils_inet4_ntop (info->address, sbuf));
+ _LOGD ("announcing address %s", _nm_utils_inet4_ntop (info->address, sbuf));
}
}
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
index 87c8c7ba5b..b08d76ae0d 100644
--- a/src/devices/nm-device-ip-tunnel.c
+++ b/src/devices/nm-device-ip-tunnel.c
@@ -96,35 +96,63 @@ ip6tnl_flags_plat_to_setting (guint32 flags)
/*****************************************************************************/
static gboolean
-address_equal_pp (int family, const char *a, const char *b)
+address_equal_pp (int addr_family, const char *a, const char *b)
{
- char buffer1[sizeof (struct in6_addr)] = { };
- char buffer2[sizeof (struct in6_addr)] = { };
+ const NMIPAddr *addr_a = &nm_ip_addr_zero;
+ const NMIPAddr *addr_b = &nm_ip_addr_zero;
+ NMIPAddr addr_a_val;
+ NMIPAddr addr_b_val;
- g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE);
+ nm_assert_addr_family (addr_family);
- if (a)
- inet_pton (family, a, buffer1);
- if (b)
- inet_pton (family, b, buffer2);
+ if (a) {
+ if (!nm_utils_parse_inaddr_bin (addr_family, a, NULL, &addr_a_val))
+ nm_assert_not_reached ();
+ addr_a = &addr_a_val;
+ }
+ if (b) {
+ if (!nm_utils_parse_inaddr_bin (addr_family, b, NULL, &addr_b_val))
+ nm_assert_not_reached ();
+ addr_b = &addr_b_val;
+ }
- return !memcmp (buffer1, buffer2,
- family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr));
+ return nm_ip_addr_equal (addr_family, addr_a, addr_b);
}
static gboolean
-address_equal_pn (int family, const char *a, const void *b)
+address_set (int addr_family,
+ char **p_addr,
+ const NMIPAddr *addr_new)
{
- char buffer1[sizeof (struct in6_addr)] = { };
+ nm_assert_addr_family (addr_family);
+ nm_assert (p_addr);
+ nm_assert ( !*p_addr
+ || nm_utils_ipaddr_is_normalized (addr_family, *p_addr));
+
+ if ( !addr_new
+ || nm_ip_addr_is_null (addr_family, addr_new)) {
+ if (nm_clear_g_free (p_addr))
+ return TRUE;
+ return FALSE;
+ }
+
+ if (*p_addr) {
+ NMIPAddr addr_val;
- g_return_val_if_fail (family == AF_INET || family == AF_INET6, FALSE);
+ if (!nm_utils_parse_inaddr_bin (addr_family,
+ *p_addr,
+ NULL,
+ &addr_val))
+ nm_assert_not_reached ();
- if (a)
- inet_pton (family, a, buffer1);
+ if (nm_ip_addr_equal (addr_family, &addr_val, addr_new))
+ return FALSE;
- return !memcmp (buffer1, b,
- family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr));
+ g_free (*p_addr);
+ }
+ *p_addr = nm_utils_inet_ntop_dup (addr_family, addr_new);
+ return TRUE;
}
static void
@@ -133,10 +161,8 @@ update_properties_from_ifindex (NMDevice *device, int ifindex)
NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device);
NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self);
int parent_ifindex = 0;
- in_addr_t local4 = 0;
- in_addr_t remote4 = 0;
- struct in6_addr local6 = IN6ADDR_ANY_INIT;
- struct in6_addr remote6 = IN6ADDR_ANY_INIT;
+ NMIPAddr local = NM_IP_ADDR_INIT;
+ NMIPAddr remote = NM_IP_ADDR_INIT;
guint8 ttl = 0;
guint8 tos = 0;
guint8 encap_limit = 0;
@@ -181,8 +207,8 @@ clear:
}
parent_ifindex = lnk->parent_ifindex;
- local4 = lnk->local;
- remote4 = lnk->remote;
+ local.addr4 = lnk->local;
+ remote.addr4 = lnk->remote;
ttl = lnk->ttl;
tos = lnk->tos;
pmtud = lnk->path_mtu_discovery;
@@ -226,8 +252,8 @@ clear:
}
parent_ifindex = lnk->parent_ifindex;
- local4 = lnk->local;
- remote4 = lnk->remote;
+ local.addr4 = lnk->local;
+ remote.addr4 = lnk->remote;
ttl = lnk->ttl;
tos = lnk->tos;
pmtud = lnk->path_mtu_discovery;
@@ -241,8 +267,8 @@ clear:
}
parent_ifindex = lnk->parent_ifindex;
- local4 = lnk->local;
- remote4 = lnk->remote;
+ local.addr4 = lnk->local;
+ remote.addr4 = lnk->remote;
ttl = lnk->ttl;
tos = lnk->tos;
pmtud = lnk->path_mtu_discovery;
@@ -267,8 +293,8 @@ clear:
}
parent_ifindex = lnk->parent_ifindex;
- local6 = lnk->local;
- remote6 = lnk->remote;
+ local.addr6 = lnk->local;
+ remote.addr6 = lnk->remote;
ttl = lnk->ttl;
tos = lnk->tclass;
encap_limit = lnk->encap_limit;
@@ -313,35 +339,10 @@ clear:
nm_device_parent_set_ifindex (device, parent_ifindex);
- if (priv->addr_family == AF_INET) {
- if (!address_equal_pn (AF_INET, priv->local, &local4)) {
- g_clear_pointer (&priv->local, g_free);
- if (local4)
- priv->local = nm_utils_inet4_ntop_dup (local4);
- _notify (self, PROP_LOCAL);
- }
-
- if (!address_equal_pn (AF_INET, priv->remote, &remote4)) {
- g_clear_pointer (&priv->remote, g_free);
- if (remote4)
- priv->remote = nm_utils_inet4_ntop_dup (remote4);
- _notify (self, PROP_REMOTE);
- }
- } else {
- if (!address_equal_pn (AF_INET6, priv->local, &local6)) {
- g_clear_pointer (&priv->local, g_free);
- if (memcmp (&local6, &in6addr_any, sizeof (in6addr_any)))
- priv->local = nm_utils_inet6_ntop_dup (&local6);
- _notify (self, PROP_LOCAL);
- }
-
- if (!address_equal_pn (AF_INET6, priv->remote, &remote6)) {
- g_clear_pointer (&priv->remote, g_free);
- if (memcmp (&remote6, &in6addr_any, sizeof (in6addr_any)))
- priv->remote = nm_utils_inet6_ntop_dup (&remote6);
- _notify (self, PROP_REMOTE);
- }
- }
+ if (address_set (priv->addr_family, &priv->local, &local))
+ _notify (self, PROP_LOCAL);
+ if (address_set (priv->addr_family, &priv->remote, &remote))
+ _notify (self, PROP_REMOTE);
out:
diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c
index 29be6854be..9be385bf93 100644
--- a/src/devices/nm-device-vxlan.c
+++ b/src/devices/nm-device-vxlan.c
@@ -390,11 +390,11 @@ update_connection (NMDevice *device, NMConnection *connection)
if (!address_matches (nm_setting_vxlan_get_remote (s_vxlan), priv->props.group, &priv->props.group6)) {
if (priv->props.group) {
g_object_set (s_vxlan, NM_SETTING_VXLAN_REMOTE,
- nm_utils_inet4_ntop (priv->props.group, sbuf),
+ _nm_utils_inet4_ntop (priv->props.group, sbuf),
NULL);
} else {
g_object_set (s_vxlan, NM_SETTING_VXLAN_REMOTE,
- nm_utils_inet6_ntop (&priv->props.group6, sbuf),
+ _nm_utils_inet6_ntop (&priv->props.group6, sbuf),
NULL);
}
}
@@ -402,11 +402,11 @@ update_connection (NMDevice *device, NMConnection *connection)
if (!address_matches (nm_setting_vxlan_get_local (s_vxlan), priv->props.local, &priv->props.local6)) {
if (priv->props.local) {
g_object_set (s_vxlan, NM_SETTING_VXLAN_LOCAL,
- nm_utils_inet4_ntop (priv->props.local, sbuf),
+ _nm_utils_inet4_ntop (priv->props.local, sbuf),
NULL);
} else if (memcmp (&priv->props.local6, &in6addr_any, sizeof (in6addr_any))) {
g_object_set (s_vxlan, NM_SETTING_VXLAN_LOCAL,
- nm_utils_inet6_ntop (&priv->props.local6, sbuf),
+ _nm_utils_inet6_ntop (&priv->props.local6, sbuf),
NULL);
}
}
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 9d70bb54f5..dc23b3b9aa 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7172,7 +7172,7 @@ acd_manager_probe_terminated (NMAcdManager *acd_manager, gpointer user_data)
_NMLOG (result ? LOGL_DEBUG : LOGL_WARN,
LOGD_DEVICE,
"IPv4 DAD result: address %s is %s",
- nm_utils_inet4_ntop (address->address, sbuf),
+ _nm_utils_inet4_ntop (address->address, sbuf),
result ? "unique" : "duplicate");
}
}
@@ -9277,7 +9277,7 @@ nm_device_use_ip6_subnet (NMDevice *self, const NMPlatformIP6Address *subnet)
applied_config_add_address (&priv->ac_ip6_config, NM_PLATFORM_IP_ADDRESS_CAST (&address));
_LOGD (LOGD_IP6, "ipv6-pd: using %s address (preferred for %u seconds)",
- nm_utils_inet6_ntop (&address.address, sbuf),
+ _nm_utils_inet6_ntop (&address.address, sbuf),
subnet->preferred);
/* This also updates the ndisc if there are actual changes. */
@@ -9457,7 +9457,7 @@ check_and_add_ipv6ll_addr (NMDevice *self)
}
_LOGD (LOGD_IP6, "linklocal6: generated %s IPv6LL address %s",
- addr_type, nm_utils_inet6_ntop (&lladdr, sbuf));
+ addr_type, _nm_utils_inet6_ntop (&lladdr, sbuf));
priv->ipv6ll_has = TRUE;
priv->ipv6ll_addr = lladdr;
ip_config_merge_and_apply (self, AF_INET6, TRUE);
@@ -10920,10 +10920,10 @@ start_sharing (NMDevice *self, NMIP4Config *config, GError **error)
g_return_val_if_fail (req, FALSE);
netmask = _nm_utils_ip4_prefix_to_netmask (ip4_addr->plen);
- nm_utils_inet4_ntop (netmask, str_mask);
+ _nm_utils_inet4_ntop (netmask, str_mask);
network = ip4_addr->address & netmask;
- nm_utils_inet4_ntop (network, str_addr);
+ _nm_utils_inet4_ntop (network, str_addr);
add_share_rule (req, "nat", "POSTROUTING --source %s/%s ! --destination %s/%s --jump MASQUERADE", str_addr, str_mask, str_addr, str_mask);
add_share_rule (req, "filter", "FORWARD --destination %s/%s --out-interface %s --match state --state ESTABLISHED,RELATED --jump ACCEPT", str_addr, str_mask, ip_iface);
@@ -13204,14 +13204,14 @@ nm_device_start_ip_check (NMDevice *self)
if (priv->ip_config_4 && priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE) {
gw = nm_ip4_config_best_default_route_get (priv->ip_config_4);
if (gw) {
- nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (gw)->gateway, buf);
+ _nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (gw)->gateway, buf);
ping_binary = nm_utils_find_helper ("ping", "/usr/bin/ping", NULL);
log_domain = LOGD_IP4;
}
} else if (priv->ip_config_6 && priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE) {
gw = nm_ip6_config_best_default_route_get (priv->ip_config_6);
if (gw) {
- nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (gw)->gateway, buf);
+ _nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (gw)->gateway, buf);
ping_binary = nm_utils_find_helper ("ping6", "/usr/bin/ping6", NULL);
log_domain = LOGD_IP6;
}
diff --git a/src/devices/tests/test-acd.c b/src/devices/tests/test-acd.c
index da5e4f2d71..32d6f6695a 100644
--- a/src/devices/tests/test-acd.c
+++ b/src/devices/tests/test-acd.c
@@ -157,7 +157,7 @@ again:
}
g_error ("expected check for address #%d (%s) to %s, but it didn't",
- i, nm_utils_inet4_ntop (info->addresses[i], sbuf),
+ i, _nm_utils_inet4_ntop (info->addresses[i], sbuf),
info->expected_result[i] ? "detect no duplicated" : "detect a duplicate");
}
}
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c
index c4547f4114..1119b3bf89 100644
--- a/src/dhcp/nm-dhcp-nettools.c
+++ b/src/dhcp/nm-dhcp-nettools.c
@@ -406,7 +406,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
return FALSE;
}
- nm_utils_inet4_ntop (a_address.s_addr, addr_str);
+ _nm_utils_inet4_ntop (a_address.s_addr, addr_str);
a_plen = nm_utils_ip4_netmask_to_prefix (a_netmask.s_addr);
nm_dhcp_option_add_option (options,
@@ -416,7 +416,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
- nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
+ _nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
nm_dhcp_option_add_option_u64 (options,
_nm_dhcp_option_dhcp4_options,
@@ -433,7 +433,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
n_dhcp4_client_lease_get_siaddr (lease, &a_next_server);
if (a_next_server.s_addr != INADDR_ANY) {
- nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
+ _nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
@@ -474,7 +474,7 @@ lease_parse_domain_name_servers (NDhcp4ClientLease *lease,
while (lease_option_next_in_addr (&addr, &data, &n_data)) {
- nm_utils_inet4_ntop (addr.s_addr, addr_str);
+ _nm_utils_inet4_ntop (addr.s_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
if ( addr.s_addr == 0
@@ -520,8 +520,8 @@ lease_parse_routes (NDhcp4ClientLease *lease,
while (lease_option_next_route (&dest, &plen, &gateway, TRUE, &data, &n_data)) {
- nm_utils_inet4_ntop (dest.s_addr, dest_str);
- nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+ _nm_utils_inet4_ntop (dest.s_addr, dest_str);
+ _nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
g_string_append_printf (nm_gstring_add_space_delimiter (str),
"%s/%d %s",
@@ -564,8 +564,8 @@ lease_parse_routes (NDhcp4ClientLease *lease,
while (lease_option_next_route (&dest, &plen, &gateway, FALSE, &data, &n_data)) {
- nm_utils_inet4_ntop (dest.s_addr, dest_str);
- nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+ _nm_utils_inet4_ntop (dest.s_addr, dest_str);
+ _nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
g_string_append_printf (nm_gstring_add_space_delimiter (str),
"%s/%d %s",
@@ -610,7 +610,7 @@ lease_parse_routes (NDhcp4ClientLease *lease,
nm_gstring_prepare (&str);
while (lease_option_next_in_addr (&gateway, &data, &n_data)) {
- s = nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
+ s = _nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
g_string_append (nm_gstring_add_space_delimiter (str), s);
if (gateway.s_addr == 0) {
@@ -709,7 +709,7 @@ lease_parse_ntps (NDhcp4ClientLease *lease,
nm_gstring_prepare (&str);
while (lease_option_next_in_addr (&addr, &data, &n_data)) {
- nm_utils_inet4_ntop (addr.s_addr, addr_str);
+ _nm_utils_inet4_ntop (addr.s_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
}
@@ -966,7 +966,7 @@ lease_save (NMDhcpNettools *self, NDhcp4ClientLease *lease, const char *lease_fi
return;
g_string_append_printf (new_contents,
- "ADDRESS=%s\n", nm_utils_inet4_ntop (a_address.s_addr, sbuf));
+ "ADDRESS=%s\n", _nm_utils_inet4_ntop (a_address.s_addr, sbuf));
if (!g_file_set_contents (lease_file,
new_contents->str,
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index b5ebd1bc98..3447ebf684 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -128,7 +128,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
options = out_options ? nm_dhcp_option_create_options_dict () : NULL;
- nm_utils_inet4_ntop (a_address.s_addr, addr_str);
+ _nm_utils_inet4_ntop (a_address.s_addr, addr_str);
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS,
@@ -138,7 +138,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
- nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
+ _nm_utils_inet4_ntop (a_netmask.s_addr, addr_str));
nm_dhcp_option_add_option_u64 (options,
_nm_dhcp_option_dhcp4_options,
@@ -150,7 +150,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
(guint64) (ts_time + a_lifetime));
if (sd_dhcp_lease_get_next_server (lease, &a_next_server) == 0) {
- nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
+ _nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
@@ -169,7 +169,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
}));
if (sd_dhcp_lease_get_server_identifier (lease, &server_id) >= 0) {
- nm_utils_inet4_ntop (server_id.s_addr, addr_str);
+ _nm_utils_inet4_ntop (server_id.s_addr, addr_str);
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_SERVER_ID,
@@ -177,7 +177,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
}
if (sd_dhcp_lease_get_broadcast (lease, &broadcast) >= 0) {
- nm_utils_inet4_ntop (broadcast.s_addr, addr_str);
+ _nm_utils_inet4_ntop (broadcast.s_addr, addr_str);
nm_dhcp_option_add_option (options,
_nm_dhcp_option_dhcp4_options,
NM_DHCP_OPTION_DHCP4_BROADCAST,
@@ -188,7 +188,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
if (num > 0) {
nm_gstring_prepare (&str);
for (i = 0; i < num; i++) {
- nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
+ _nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
if ( addr_list[i].s_addr == 0
@@ -288,8 +288,8 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
network_net = nm_utils_ip4_address_clear_host_address (r_network.s_addr,
r_plen);
- nm_utils_inet4_ntop (network_net, network_net_str);
- nm_utils_inet4_ntop (r_gateway.s_addr, gateway_str);
+ _nm_utils_inet4_ntop (network_net, network_net_str);
+ _nm_utils_inet4_ntop (r_gateway.s_addr, gateway_str);
g_string_append_printf (nm_gstring_add_space_delimiter ( option == NM_DHCP_OPTION_DHCP4_CLASSLESS_STATIC_ROUTE
? str_classless
@@ -359,7 +359,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
for (i = 0; i < num; i++) {
guint32 m;
- s = nm_utils_inet4_ntop (a_router[i].s_addr, addr_str);
+ s = _nm_utils_inet4_ntop (a_router[i].s_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), s);
if (a_router[i].s_addr == 0) {
@@ -411,7 +411,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
if (num > 0) {
nm_gstring_prepare (&str);
for (i = 0; i < num; i++) {
- nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
+ _nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
}
nm_dhcp_option_add_option (options,
@@ -750,7 +750,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
nm_ip6_config_add_address (ip6_config, &address);
- nm_utils_inet6_ntop (&tmp_addr, addr_str);
+ _nm_utils_inet6_ntop (&tmp_addr, addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
};
if (str->len)
@@ -772,7 +772,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
if (num > 0) {
nm_gstring_prepare (&str);
for (i = 0; i < num; i++) {
- nm_utils_inet6_ntop (&dns[i], addr_str);
+ _nm_utils_inet6_ntop (&dns[i], addr_str);
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
}
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c
index e1c1fa1d85..d8e5a65328 100644
--- a/src/dhcp/nm-dhcp-utils.c
+++ b/src/dhcp/nm-dhcp-utils.c
@@ -181,9 +181,9 @@ ip4_process_dhclient_rfc3442_routes (const char *iface,
nm_ip4_config_add_route (ip4_config, &route, NULL);
_LOG2I (LOGD_DHCP4, iface, " classless static route %s/%d gw %s",
- nm_utils_inet4_ntop (route.network, b1),
+ _nm_utils_inet4_ntop (route.network, b1),
route.plen,
- nm_utils_inet4_ntop (route.gateway, b2));
+ _nm_utils_inet4_ntop (route.gateway, b2));
}
}
@@ -414,7 +414,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx,
process_classful_routes (iface, options, route_table, route_metric, ip4_config);
if (gateway) {
- _LOG2I (LOGD_DHCP4, iface, " gateway %s", nm_utils_inet4_ntop (gateway, sbuf));
+ _LOG2I (LOGD_DHCP4, iface, " gateway %s", _nm_utils_inet4_ntop (gateway, sbuf));
gateway_has = TRUE;
} else {
/* If the gateway wasn't provided as a classless static route with a
diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c
index e2bd0b790d..81a55834fd 100644
--- a/src/dns/nm-dns-dnsmasq.c
+++ b/src/dns/nm-dns-dnsmasq.c
@@ -726,9 +726,9 @@ ip_addr_to_string (int addr_family, gconstpointer addr, const char *iface, char
separator = "@";
} else {
if (IN6_IS_ADDR_V4MAPPED (addr))
- nm_utils_inet4_ntop (((const struct in6_addr *) addr)->s6_addr32[3], buf2);
+ _nm_utils_inet4_ntop (((const struct in6_addr *) addr)->s6_addr32[3], buf2);
else
- nm_utils_inet6_ntop (addr, buf2);
+ _nm_utils_inet6_ntop (addr, buf2);
/* Need to scope link-local addresses with %<zone-id>. Before dnsmasq 2.58,
* only '@' was supported as delimiter. Since 2.58, '@' and '%' are
* supported. Due to a bug, since 2.73 only '%' works properly as "server"
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c
index c7ca0b47f4..58dad0257b 100644
--- a/src/dns/nm-dns-manager.c
+++ b/src/dns/nm-dns-manager.c
@@ -425,9 +425,9 @@ merge_one_ip_config (NMResolvConfData *rc,
if (addr_family == AF_INET)
nm_utils_inet_ntop (addr_family, addr, buf);
else if (IN6_IS_ADDR_V4MAPPED (addr))
- nm_utils_inet4_ntop (addr->addr6.s6_addr32[3], buf);
+ _nm_utils_inet4_ntop (addr->addr6.s6_addr32[3], buf);
else {
- nm_utils_inet6_ntop (&addr->addr6, buf);
+ _nm_utils_inet6_ntop (&addr->addr6, buf);
if (IN6_IS_ADDR_LINKLOCAL (addr)) {
const char *ifname;
@@ -457,7 +457,7 @@ merge_one_ip_config (NMResolvConfData *rc,
num = nm_ip4_config_get_num_nis_servers (ip4_config);
for (i = 0; i < num; i++) {
add_string_item (rc->nis_servers,
- nm_utils_inet4_ntop (nm_ip4_config_get_nis_server (ip4_config, i), buf),
+ _nm_utils_inet4_ntop (nm_ip4_config_get_nis_server (ip4_config, i), buf),
TRUE);
}
@@ -1161,7 +1161,7 @@ _collect_resolv_conf_data (NMDnsManager *self,
const char *hostdomain = strchr (priv->hostname, '.');
if ( hostdomain
- && !nm_utils_ipaddr_valid (AF_UNSPEC, priv->hostname)) {
+ && !nm_utils_ipaddr_is_valid (AF_UNSPEC, priv->hostname)) {
hostdomain++;
if (domain_is_valid (hostdomain, TRUE))
add_string_item (rc.searches, hostdomain, TRUE);
diff --git a/src/dnsmasq/nm-dnsmasq-manager.c b/src/dnsmasq/nm-dnsmasq-manager.c
index 735605eec0..983c525a00 100644
--- a/src/dnsmasq/nm-dnsmasq-manager.c
+++ b/src/dnsmasq/nm-dnsmasq-manager.c
@@ -140,7 +140,7 @@ create_dm_cmd_line (const char *iface,
*/
nm_strv_ptrarray_add_string_dup (cmd, "--strict-order");
- nm_utils_inet4_ntop (listen_address->address, listen_address_s);
+ _nm_utils_inet4_ntop (listen_address->address, listen_address_s);
nm_strv_ptrarray_add_string_concat (cmd, "--listen-address=", listen_address_s);
@@ -169,7 +169,7 @@ create_dm_cmd_line (const char *iface,
g_string_append (s, "--dhcp-option=option:dns-server");
for (i = 0; i < n; i++) {
g_string_append_c (s, ',');
- g_string_append (s, nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (ip4_config, i), tmpaddr));
+ g_string_append (s, _nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (ip4_config, i), tmpaddr));
}
nm_strv_ptrarray_take_gstring (cmd, &s);
}
diff --git a/src/dnsmasq/nm-dnsmasq-utils.c b/src/dnsmasq/nm-dnsmasq-utils.c
index 01d59eccc7..2373b4220b 100644
--- a/src/dnsmasq/nm-dnsmasq-utils.c
+++ b/src/dnsmasq/nm-dnsmasq-utils.c
@@ -95,9 +95,8 @@ nm_dnsmasq_utils_get_range (const NMPlatformIP4Address *addr,
first = htonl (first);
last = htonl (last);
- nm_utils_inet4_ntop (first, out_first);
- nm_utils_inet4_ntop (last, out_last);
+ _nm_utils_inet4_ntop (first, out_first);
+ _nm_utils_inet4_ntop (last, out_last);
return TRUE;
}
-
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c
index 2cb93a2d19..ed2e5b226e 100644
--- a/src/initrd/nmi-cmdline-reader.c
+++ b/src/initrd/nmi-cmdline-reader.c
@@ -445,7 +445,7 @@ parse_ip (GHashTable *connections, const char *sysfs_dir, char *argument)
if (gateway_ip && *gateway_ip) {
int addr_family = guess_ip_address_family (gateway_ip);
- if (nm_utils_ipaddr_valid (addr_family, gateway_ip)) {
+ if (nm_utils_ipaddr_is_valid (addr_family, gateway_ip)) {
switch (addr_family) {
case AF_INET:
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, gateway_ip, NULL);
@@ -470,7 +470,7 @@ parse_ip (GHashTable *connections, const char *sysfs_dir, char *argument)
for (i = 0; i < 2; i++) {
if (dns_addr_family[i] == AF_UNSPEC)
break;
- if (nm_utils_ipaddr_valid (dns_addr_family[i], dns[i])) {
+ if (nm_utils_ipaddr_is_valid (dns_addr_family[i], dns[i])) {
switch (dns_addr_family[i]) {
case AF_INET:
nm_setting_ip_config_add_dns (s_ip4, dns[i]);
diff --git a/src/initrd/nmi-ibft-reader.c b/src/initrd/nmi-ibft-reader.c
index 47b90ebfdb..ca44b399f0 100644
--- a/src/initrd/nmi-ibft-reader.c
+++ b/src/initrd/nmi-ibft-reader.c
@@ -204,19 +204,19 @@ ip_setting_add_from_block (GHashTable *nic,
NM_SETTING_IP_CONFIG_MAY_FAIL, FALSE,
NULL);
- if (s_gateway && !nm_utils_ipaddr_valid (family, s_gateway)) {
+ if (s_gateway && !nm_utils_ipaddr_is_valid (family, s_gateway)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"iBFT: invalid IP gateway '%s'.", s_gateway);
return FALSE;
}
- if (s_dns1 && !nm_utils_ipaddr_valid (family, s_dns1)) {
+ if (s_dns1 && !nm_utils_ipaddr_is_valid (family, s_dns1)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"iBFT: invalid DNS1 address '%s'.", s_dns1);
return FALSE;
}
- if (s_dns2 && !nm_utils_ipaddr_valid (family, s_dns2)) {
+ if (s_dns2 && !nm_utils_ipaddr_is_valid (family, s_dns2)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"iBFT: invalid DNS2 address '%s'.", s_dns2);
return FALSE;
diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c
index 7369bacddc..e6174a99b6 100644
--- a/src/ndisc/nm-ndisc.c
+++ b/src/ndisc/nm-ndisc.c
@@ -951,7 +951,7 @@ nm_ndisc_dad_failed (NMNDisc *ndisc, const struct in6_addr *address, gboolean em
if (IN6_ARE_ADDR_EQUAL (&item->address, address)) {
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
- _LOGD ("DAD failed for discovered address %s", nm_utils_inet6_ntop (address, sbuf));
+ _LOGD ("DAD failed for discovered address %s", _nm_utils_inet6_ntop (address, sbuf));
changed = TRUE;
if (!complete_address (ndisc, item)) {
g_array_remove_index (rdata->addresses, i);
@@ -1054,7 +1054,7 @@ _config_changed_log (NMNDisc *ndisc, NMNDiscConfigMap changed)
inet_ntop (AF_INET6, &route->network, addrstr, sizeof (addrstr));
_LOGD (" route %s/%u via %s pref %s exp %s", addrstr, (guint) route->plen,
- nm_utils_inet6_ntop (&route->gateway, sbuf),
+ _nm_utils_inet6_ntop (&route->gateway, sbuf),
nm_icmpv6_router_pref_to_string (route->preference, str_pref, sizeof (str_pref)),
get_exp (str_exp, now_ns, route));
}
diff --git a/src/nm-config-data.c b/src/nm-config-data.c
index c019f65867..e5593d822a 100644
--- a/src/nm-config-data.c
+++ b/src/nm-config-data.c
@@ -1024,8 +1024,8 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
if (strv) {
_nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
for (i = 0, j = 0; strv[i]; i++) {
- if ( nm_utils_ipaddr_valid (AF_INET, strv[i])
- || nm_utils_ipaddr_valid (AF_INET6, strv[i]))
+ if ( nm_utils_ipaddr_is_valid (AF_INET, strv[i])
+ || nm_utils_ipaddr_is_valid (AF_INET6, strv[i]))
strv[j++] = strv[i];
else
g_free (strv[i]);
@@ -1147,8 +1147,8 @@ global_dns_domain_from_dbus (char *name, GVariant *variant)
strv = g_variant_dup_strv (val, NULL);
_nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
for (i = 0, j = 0; strv && strv[i]; i++) {
- if ( nm_utils_ipaddr_valid (AF_INET, strv[i])
- || nm_utils_ipaddr_valid (AF_INET6, strv[i]))
+ if ( nm_utils_ipaddr_is_valid (AF_INET, strv[i])
+ || nm_utils_ipaddr_is_valid (AF_INET6, strv[i]))
strv[j++] = strv[i];
else
g_free (strv[i]);
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 1438a0bb5e..cbbac2816b 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -2999,12 +2999,14 @@ nm_utils_ipv6_interface_identifier_get_from_token (NMUtilsIPv6IfaceId *iid,
* Returns: the input buffer filled with the id as string.
*/
const char *
-nm_utils_inet6_interface_identifier_to_token (NMUtilsIPv6IfaceId iid, char *buf)
+nm_utils_inet6_interface_identifier_to_token (NMUtilsIPv6IfaceId iid,
+ char buf[static INET6_ADDRSTRLEN])
{
struct in6_addr i6_token = { .s6_addr = { 0, } };
+ nm_assert (buf);
nm_utils_ipv6_addr_set_interface_identifier (&i6_token, iid);
- return nm_utils_inet6_ntop (&i6_token, buf);
+ return _nm_utils_inet6_ntop (&i6_token, buf);
}
/*****************************************************************************/
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h
index 7d63d06afc..fbb7987573 100644
--- a/src/nm-core-utils.h
+++ b/src/nm-core-utils.h
@@ -316,7 +316,7 @@ gboolean nm_utils_ipv6_interface_identifier_get_from_token (NMUtilsIPv6IfaceId *
const char *token);
const char *nm_utils_inet6_interface_identifier_to_token (NMUtilsIPv6IfaceId iid,
- char *buf);
+ char buf[static INET6_ADDRSTRLEN]);
gboolean nm_utils_get_ipv6_interface_identifier (NMLinkType link_type,
const guint8 *hwaddr,
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index cd14fb8f94..ae637aeedc 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -1097,8 +1097,8 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
&& nm_setting_ip_config_get_num_addresses (s_ip4) > 0) {
g_object_set (s_ip4,
NM_SETTING_IP_CONFIG_GATEWAY,
- nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
- sbuf),
+ _nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
+ sbuf),
NULL);
}
@@ -1133,7 +1133,7 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
for (i = 0; i < nnameservers; i++) {
guint32 nameserver = nm_ip4_config_get_nameserver (self, i);
- nm_setting_ip_config_add_dns (s_ip4, nm_utils_inet4_ntop (nameserver, sbuf));
+ nm_setting_ip_config_add_dns (s_ip4, _nm_utils_inet4_ntop (nameserver, sbuf));
}
for (i = 0; i < nsearches; i++) {
const char *search = nm_ip4_config_get_search (self, i);
@@ -3096,14 +3096,14 @@ get_property (GObject *object, guint prop_id,
g_variant_builder_init (&addr_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&addr_builder, "{sv}",
"address",
- g_variant_new_string (nm_utils_inet4_ntop (address->address, addr_str)));
+ g_variant_new_string (_nm_utils_inet4_ntop (address->address, addr_str)));
g_variant_builder_add (&addr_builder, "{sv}",
"prefix",
g_variant_new_uint32 (address->plen));
if (address->peer_address != address->address) {
g_variant_builder_add (&addr_builder, "{sv}",
"peer",
- g_variant_new_string (nm_utils_inet4_ntop (address->peer_address, addr_str)));
+ g_variant_new_string (_nm_utils_inet4_ntop (address->peer_address, addr_str)));
}
if (*address->label) {
@@ -3158,14 +3158,14 @@ out_addresses_cached:
g_variant_builder_init (&route_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&route_builder, "{sv}",
"dest",
- g_variant_new_string (nm_utils_inet4_ntop (route->network, addr_str)));
+ g_variant_new_string (_nm_utils_inet4_ntop (route->network, addr_str)));
g_variant_builder_add (&route_builder, "{sv}",
"prefix",
g_variant_new_uint32 (route->plen));
if (route->gateway) {
g_variant_builder_add (&route_builder, "{sv}",
"next-hop",
- g_variant_new_string (nm_utils_inet4_ntop (route->gateway, addr_str)));
+ g_variant_new_string (_nm_utils_inet4_ntop (route->gateway, addr_str)));
}
g_variant_builder_add (&route_builder, "{sv}",
"metric",
@@ -3218,8 +3218,8 @@ out_routes_cached:
for (i = 0; i < priv->nameservers->len; i++) {
GVariantBuilder nested_builder;
- nm_utils_inet4_ntop (g_array_index (priv->nameservers, in_addr_t, i),
- addr_str);
+ _nm_utils_inet4_ntop (g_array_index (priv->nameservers, in_addr_t, i),
+ addr_str);
g_variant_builder_init (&nested_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&nested_builder, "{sv}",
@@ -3255,8 +3255,8 @@ out_routes_cached:
for (i = 0; i < priv->wins->len; i++) {
g_variant_builder_add (&builder_data,
"s",
- nm_utils_inet4_ntop (g_array_index (priv->wins, in_addr_t, i),
- addr_str));
+ _nm_utils_inet4_ntop (g_array_index (priv->wins, in_addr_t, i),
+ addr_str));
}
g_value_take_variant (value,
g_variant_builder_end (&builder_data));
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 1255365745..5acb3932d0 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -764,8 +764,8 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
&& nm_setting_ip_config_get_num_addresses (s_ip6) > 0) {
g_object_set (s_ip6,
NM_SETTING_IP_CONFIG_GATEWAY,
- nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
- sbuf),
+ _nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
+ sbuf),
NULL);
}
@@ -807,7 +807,7 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
for (i = 0; i < nnameservers; i++) {
const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (self, i);
- nm_setting_ip_config_add_dns (s_ip6, nm_utils_inet6_ntop (nameserver, sbuf));
+ nm_setting_ip_config_add_dns (s_ip6, _nm_utils_inet6_ntop (nameserver, sbuf));
}
for (i = 0; i < nsearches; i++) {
const char *search = nm_ip6_config_get_search (self, i);
@@ -2556,7 +2556,7 @@ get_property (GObject *object, guint prop_id,
g_variant_builder_init (&addr_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&addr_builder, "{sv}",
"address",
- g_variant_new_string (nm_utils_inet6_ntop (&address->address, sbuf)));
+ g_variant_new_string (_nm_utils_inet6_ntop (&address->address, sbuf)));
g_variant_builder_add (&addr_builder, "{sv}",
"prefix",
g_variant_new_uint32 (address->plen));
@@ -2564,7 +2564,7 @@ get_property (GObject *object, guint prop_id,
&& !IN6_ARE_ADDR_EQUAL (&address->peer_address, &address->address)) {
g_variant_builder_add (&addr_builder, "{sv}",
"peer",
- g_variant_new_string (nm_utils_inet6_ntop (&address->peer_address, sbuf)));
+ g_variant_new_string (_nm_utils_inet6_ntop (&address->peer_address, sbuf)));
}
g_variant_builder_add (&builder_data, "a{sv}", &addr_builder);
@@ -2609,14 +2609,14 @@ out_addresses_cached:
g_variant_builder_init (&route_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&route_builder, "{sv}",
"dest",
- g_variant_new_string (nm_utils_inet6_ntop (&route->network, sbuf)));
+ g_variant_new_string (_nm_utils_inet6_ntop (&route->network, sbuf)));
g_variant_builder_add (&route_builder, "{sv}",
"prefix",
g_variant_new_uint32 (route->plen));
if (!IN6_IS_ADDR_UNSPECIFIED (&route->gateway)) {
g_variant_builder_add (&route_builder, "{sv}",
"next-hop",
- g_variant_new_string (nm_utils_inet6_ntop (&route->gateway, sbuf)));
+ g_variant_new_string (_nm_utils_inet6_ntop (&route->gateway, sbuf)));
}
g_variant_builder_add (&route_builder, "{sv}",
diff --git a/src/nm-pacrunner-manager.c b/src/nm-pacrunner-manager.c
index b5c7bc026a..091a630536 100644
--- a/src/nm-pacrunner-manager.c
+++ b/src/nm-pacrunner-manager.c
@@ -145,7 +145,7 @@ get_ip_domains (GPtrArray *domains, NMIPConfig *ip_config)
nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, (NMIP4Config *) ip_config, &address) {
cidr = g_strdup_printf ("%s/%u",
- nm_utils_inet4_ntop (address->address, sbuf),
+ _nm_utils_inet4_ntop (address->address, sbuf),
address->plen);
g_ptr_array_add (domains, cidr);
}
@@ -154,7 +154,7 @@ get_ip_domains (GPtrArray *domains, NMIPConfig *ip_config)
nm_ip_config_iter_ip6_address_for_each (&ipconf_iter, (NMIP6Config *) ip_config, &address) {
cidr = g_strdup_printf ("%s/%u",
- nm_utils_inet6_ntop (&address->address, sbuf),
+ _nm_utils_inet6_ntop (&address->address, sbuf),
address->plen);
g_ptr_array_add (domains, cidr);
}
@@ -167,7 +167,7 @@ get_ip_domains (GPtrArray *domains, NMIPConfig *ip_config)
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
continue;
cidr = g_strdup_printf ("%s/%u",
- nm_utils_inet4_ntop (routes->network, sbuf),
+ _nm_utils_inet4_ntop (routes->network, sbuf),
routes->plen);
g_ptr_array_add (domains, cidr);
}
@@ -178,7 +178,7 @@ get_ip_domains (GPtrArray *domains, NMIPConfig *ip_config)
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
continue;
cidr = g_strdup_printf ("%s/%u",
- nm_utils_inet6_ntop (&routes->network, sbuf),
+ _nm_utils_inet6_ntop (&routes->network, sbuf),
routes->plen);
g_ptr_array_add (domains, cidr);
}
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 56bec87b3d..b79ea8f0cf 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -184,7 +184,7 @@ clear_ip6_prefix_delegation (gpointer data)
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
_LOGD (LOGD_IP6, "ipv6-pd: undelegating prefix %s/%d",
- nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
+ _nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
delegation->prefix.plen);
g_hash_table_foreach (delegation->subnets, _clear_ip6_subnet, NULL);
@@ -225,7 +225,7 @@ ip6_subnet_from_delegation (IP6PrefixDelegation *delegation, NMDevice *device)
/* Check for out-of-prefixes condition. */
if (delegation->next_subnet >= (1 << (64 - delegation->prefix.plen))) {
_LOGD (LOGD_IP6, "ipv6-pd: no more prefixes in %s/%d",
- nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
+ _nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
delegation->prefix.plen);
return FALSE;
}
@@ -253,7 +253,7 @@ ip6_subnet_from_delegation (IP6PrefixDelegation *delegation, NMDevice *device)
subnet->preferred = delegation->prefix.preferred;
_LOGD (LOGD_IP6, "ipv6-pd: %s allocated from a /%d prefix on %s",
- nm_utils_inet6_ntop (&subnet->address, sbuf),
+ _nm_utils_inet6_ntop (&subnet->address, sbuf),
delegation->prefix.plen,
nm_device_get_iface (device));
@@ -327,7 +327,7 @@ device_ip6_prefix_delegated (NMDevice *device,
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
_LOGI (LOGD_IP6, "ipv6-pd: received a prefix %s/%d from %s",
- nm_utils_inet6_ntop (&prefix->address, sbuf),
+ _nm_utils_inet6_ntop (&prefix->address, sbuf),
prefix->plen,
nm_device_get_iface (device));
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index a3c12becdd..2d2524624d 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -1237,10 +1237,10 @@ ip_route_add (NMPlatform *platform,
if (addr_family == AF_INET) {
nm_log_warn (LOGD_PLATFORM, "Fake platform: failure adding ip4-route '%d: %s/%d %d': Network Unreachable",
- r->ifindex, nm_utils_inet4_ntop (r4->network, sbuf), r->plen, r->metric);
+ r->ifindex, _nm_utils_inet4_ntop (r4->network, sbuf), r->plen, r->metric);
} else {
nm_log_warn (LOGD_PLATFORM, "Fake platform: failure adding ip6-route '%d: %s/%d %d': Network Unreachable",
- r->ifindex, nm_utils_inet6_ntop (&r6->network, sbuf), r->plen, r->metric);
+ r->ifindex, _nm_utils_inet6_ntop (&r6->network, sbuf), r->plen, r->metric);
}
return -NME_UNSPEC;
}
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index c6e58284e0..3ae5726d1c 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -3790,12 +3790,12 @@ _nl_msg_new_link_set_linkinfo (struct nl_msg *msg,
if (props->group)
NLA_PUT (msg, IFLA_VXLAN_GROUP, sizeof (props->group), &props->group);
- else if (memcmp (&props->group6, &in6addr_any, sizeof (in6addr_any)))
+ else if (!IN6_IS_ADDR_UNSPECIFIED (&props->group6))
NLA_PUT (msg, IFLA_VXLAN_GROUP6, sizeof (props->group6), &props->group6);
if (props->local)
NLA_PUT (msg, IFLA_VXLAN_LOCAL, sizeof (props->local), &props->local);
- else if (memcmp (&props->local6, &in6addr_any, sizeof (in6addr_any)))
+ else if (!IN6_IS_ADDR_UNSPECIFIED (&props->local6))
NLA_PUT (msg, IFLA_VXLAN_LOCAL6, sizeof (props->local6), &props->local6);
if (props->parent_ifindex >= 0)
@@ -3893,9 +3893,9 @@ _nl_msg_new_link_set_linkinfo (struct nl_msg *msg,
if (props->parent_ifindex)
NLA_PUT_U32 (msg, IFLA_IPTUN_LINK, props->parent_ifindex);
- if (memcmp (&props->local, &in6addr_any, sizeof (in6addr_any)))
+ if (!IN6_IS_ADDR_UNSPECIFIED (&props->local))
NLA_PUT (msg, IFLA_IPTUN_LOCAL, sizeof (props->local), &props->local);
- if (memcmp (&props->remote, &in6addr_any, sizeof (in6addr_any)))
+ if (!IN6_IS_ADDR_UNSPECIFIED (&props->remote))
NLA_PUT (msg, IFLA_IPTUN_REMOTE, sizeof (props->remote), &props->remote);
NLA_PUT_U8 (msg, IFLA_IPTUN_TTL, props->ttl);
@@ -3928,9 +3928,9 @@ _nl_msg_new_link_set_linkinfo (struct nl_msg *msg,
NLA_PUT_U16 (msg, IFLA_GRE_IFLAGS, htons (props->input_flags));
NLA_PUT_U16 (msg, IFLA_GRE_OFLAGS, htons (props->output_flags));
- if (memcmp (&props->local, &in6addr_any, sizeof (in6addr_any)))
+ if (!IN6_IS_ADDR_UNSPECIFIED (&props->local))
NLA_PUT (msg, IFLA_GRE_LOCAL, sizeof (props->local), &props->local);
- if (memcmp (&props->remote, &in6addr_any, sizeof (in6addr_any)))
+ if (!IN6_IS_ADDR_UNSPECIFIED (&props->local))
NLA_PUT (msg, IFLA_GRE_REMOTE, sizeof (props->remote), &props->remote);
NLA_PUT_U8 (msg, IFLA_GRE_TTL, props->ttl);
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 82d79d7a44..2b554cb4b9 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -3399,12 +3399,12 @@ nm_platform_ip4_address_delete (NMPlatform *self, int ifindex, in_addr_t address
g_return_val_if_fail (plen <= 32, FALSE);
_LOG3D ("address: deleting IPv4 address %s/%d, %s%s",
- nm_utils_inet4_ntop (address, b1),
+ _nm_utils_inet4_ntop (address, b1),
plen,
peer_address != address
? nm_sprintf_buf (str_peer,
"peer %s, ",
- nm_utils_inet4_ntop (peer_address, b2))
+ _nm_utils_inet4_ntop (peer_address, b2))
: "",
_to_string_dev (self, ifindex, str_dev, sizeof (str_dev)));
return klass->ip4_address_delete (self, ifindex, address, plen, peer_address);
@@ -3422,7 +3422,7 @@ nm_platform_ip6_address_delete (NMPlatform *self, int ifindex, struct in6_addr a
g_return_val_if_fail (plen <= 128, FALSE);
_LOG3D ("address: deleting IPv6 address %s/%d, %s",
- nm_utils_inet6_ntop (&address, sbuf), plen,
+ _nm_utils_inet6_ntop (&address, sbuf), plen,
_to_string_dev (self, ifindex, str_dev, sizeof (str_dev)));
return klass->ip6_address_delete (self, ifindex, address, plen);
}
@@ -5255,16 +5255,16 @@ nm_platform_lnk_gre_to_string (const NMPlatformLnkGre *lnk, char *buf, gsize len
"%s" /* okey */
"",
lnk->is_tap ? "tap" : "",
- lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
- lnk->local ? nm_sprintf_buf (str_local, " local %s", nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
+ lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", _nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
+ lnk->local ? nm_sprintf_buf (str_local, " local %s", _nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
lnk->parent_ifindex ? nm_sprintf_buf (str_parent_ifindex, " dev %d", lnk->parent_ifindex) : "",
lnk->ttl ? nm_sprintf_buf (str_ttl, " ttl %u", lnk->ttl) : " ttl inherit",
lnk->tos ? (lnk->tos == 1 ? " tos inherit" : nm_sprintf_buf (str_tos, " tos 0x%x", lnk->tos)) : "",
lnk->path_mtu_discovery ? "" : " nopmtudisc",
lnk->input_flags ? nm_sprintf_buf (str_input_flags, " iflags 0x%x", lnk->input_flags) : "",
lnk->output_flags ? nm_sprintf_buf (str_output_flags, " oflags 0x%x", lnk->output_flags) : "",
- NM_FLAGS_HAS (lnk->input_flags, GRE_KEY) || lnk->input_key ? nm_sprintf_buf (str_input_key, " ikey %s", nm_utils_inet4_ntop (lnk->input_key, str_input_key1)) : "",
- NM_FLAGS_HAS (lnk->output_flags, GRE_KEY) || lnk->output_key ? nm_sprintf_buf (str_output_key, " okey %s", nm_utils_inet4_ntop (lnk->output_key, str_output_key1)) : "");
+ NM_FLAGS_HAS (lnk->input_flags, GRE_KEY) || lnk->input_key ? nm_sprintf_buf (str_input_key, " ikey %s", _nm_utils_inet4_ntop (lnk->input_key, str_input_key1)) : "",
+ NM_FLAGS_HAS (lnk->output_flags, GRE_KEY) || lnk->output_key ? nm_sprintf_buf (str_output_key, " okey %s", _nm_utils_inet4_ntop (lnk->output_key, str_output_key1)) : "");
return buf;
}
@@ -5323,8 +5323,8 @@ nm_platform_lnk_ip6tnl_to_string (const NMPlatformLnkIp6Tnl *lnk, char *buf, gsi
" flags 0x%x"
"",
str_type,
- nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet6_ntop (&lnk->remote, str_remote1)),
- nm_sprintf_buf (str_local, " local %s", nm_utils_inet6_ntop (&lnk->local, str_local1)),
+ nm_sprintf_buf (str_remote, " remote %s", _nm_utils_inet6_ntop (&lnk->remote, str_remote1)),
+ nm_sprintf_buf (str_local, " local %s", _nm_utils_inet6_ntop (&lnk->local, str_local1)),
lnk->parent_ifindex ? nm_sprintf_buf (str_parent_ifindex, " dev %d", lnk->parent_ifindex) : "",
lnk->ttl ? nm_sprintf_buf (str_ttl, " ttl %u", lnk->ttl) : " ttl inherit",
lnk->tclass == 1 ? " tclass inherit" : nm_sprintf_buf (str_tclass, " tclass 0x%x", lnk->tclass),
@@ -5358,8 +5358,8 @@ nm_platform_lnk_ipip_to_string (const NMPlatformLnkIpIp *lnk, char *buf, gsize l
"%s" /* tos */
"%s" /* path_mtu_discovery */
"",
- lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
- lnk->local ? nm_sprintf_buf (str_local, " local %s", nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
+ lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", _nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
+ lnk->local ? nm_sprintf_buf (str_local, " local %s", _nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
lnk->parent_ifindex ? nm_sprintf_buf (str_parent_ifindex, " dev %d", lnk->parent_ifindex) : "",
lnk->ttl ? nm_sprintf_buf (str_ttl, " ttl %u", lnk->ttl) : " ttl inherit",
lnk->tos ? (lnk->tos == 1 ? " tos inherit" : nm_sprintf_buf (str_tos, " tos 0x%x", lnk->tos)) : "",
@@ -5441,8 +5441,8 @@ nm_platform_lnk_sit_to_string (const NMPlatformLnkSit *lnk, char *buf, gsize len
"%s" /* flags */
"%s" /* proto */
"",
- lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
- lnk->local ? nm_sprintf_buf (str_local, " local %s", nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
+ lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", _nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
+ lnk->local ? nm_sprintf_buf (str_local, " local %s", _nm_utils_inet4_ntop (lnk->local, str_local1)) : "",
lnk->parent_ifindex ? nm_sprintf_buf (str_parent_ifindex, " dev %d", lnk->parent_ifindex) : "",
lnk->ttl ? nm_sprintf_buf (str_ttl, " ttl %u", lnk->ttl) : " ttl inherit",
lnk->tos ? (lnk->tos == 1 ? " tos inherit" : nm_sprintf_buf (str_tos, " tos 0x%x", lnk->tos)) : "",
@@ -5543,7 +5543,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
g_snprintf (str_group, sizeof (str_group),
" %s %s",
IN_MULTICAST (ntohl (lnk->group)) ? "group" : "remote",
- nm_utils_inet4_ntop (lnk->group, sbuf));
+ _nm_utils_inet4_ntop (lnk->group, sbuf));
}
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->group6))
str_group6[0] = '\0';
@@ -5552,7 +5552,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
" %s%s %s",
IN6_IS_ADDR_MULTICAST (&lnk->group6) ? "group" : "remote",
str_group[0] ? "6" : "", /* usually, a vxlan has either v4 or v6 only. */
- nm_utils_inet6_ntop (&lnk->group6, sbuf));
+ _nm_utils_inet6_ntop (&lnk->group6, sbuf));
}
if (lnk->local == 0)
@@ -5560,7 +5560,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
else {
g_snprintf (str_local, sizeof (str_local),
" local %s",
- nm_utils_inet4_ntop (lnk->local, sbuf));
+ _nm_utils_inet4_ntop (lnk->local, sbuf));
}
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->local6))
str_local6[0] = '\0';
@@ -5568,7 +5568,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
g_snprintf (str_local6, sizeof (str_local6),
" local%s %s",
str_local[0] ? "6" : "", /* usually, a vxlan has either v4 or v6 only. */
- nm_utils_inet6_ntop (&lnk->local6, sbuf));
+ _nm_utils_inet6_ntop (&lnk->local6, sbuf));
}
g_snprintf (buf, len,
@@ -6064,7 +6064,7 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route, char *buf, gsi
route->mss,
nmp_utils_ip_config_source_to_string (route->rt_source, s_source, sizeof (s_source)),
route->src_plen || !IN6_IS_ADDR_UNSPECIFIED (&route->src)
- ? nm_sprintf_buf (s_src_all, " src %s/%u", nm_utils_inet6_ntop (&route->src, s_src), (unsigned) route->src_plen)
+ ? nm_sprintf_buf (s_src_all, " src %s/%u", _nm_utils_inet6_ntop (&route->src, s_src), (unsigned) route->src_plen)
: "",
_rtm_flags_to_string_full (str_rtm_flags, sizeof (str_rtm_flags), route->r_rtm_flags),
s_pref_src[0] ? " pref-src " : "",
diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c
index 12f90aee1c..309192c3a8 100644
--- a/src/platform/nmp-object.c
+++ b/src/platform/nmp-object.c
@@ -233,13 +233,13 @@ nm_sock_addr_union_to_string (const NMSockAddrUnion *sa,
case AF_INET:
g_snprintf (buf, len,
"%s:%u",
- nm_utils_inet4_ntop (sa->in.sin_addr.s_addr, s_addr),
+ _nm_utils_inet4_ntop (sa->in.sin_addr.s_addr, s_addr),
(guint) htons (sa->in.sin_port));
break;
case AF_INET6:
g_snprintf (buf, len,
"[%s%s]:%u",
- nm_utils_inet6_ntop (&sa->in6.sin6_addr, s_addr),
+ _nm_utils_inet6_ntop (&sa->in6.sin6_addr, s_addr),
( sa->in6.sin6_scope_id != 0
? nm_sprintf_buf (s_scope_id, "%u", sa->in6.sin6_scope_id)
: ""),
@@ -1082,10 +1082,10 @@ _vt_cmd_plobj_to_string_id_##type (const NMPlatformObject *_obj, char *buf, gsiz
return buf; \
}
_vt_cmd_plobj_to_string_id (link, NMPlatformLink, "%d", obj->ifindex);
-_vt_cmd_plobj_to_string_id (ip4_address, NMPlatformIP4Address, "%d: %s/%d%s%s", obj->ifindex, nm_utils_inet4_ntop ( obj->address, buf1), obj->plen,
+_vt_cmd_plobj_to_string_id (ip4_address, NMPlatformIP4Address, "%d: %s/%d%s%s", obj->ifindex, _nm_utils_inet4_ntop ( obj->address, buf1), obj->plen,
obj->peer_address != obj->address ? "," : "",
- obj->peer_address != obj->address ? nm_utils_inet4_ntop (nm_utils_ip4_address_clear_host_address (obj->peer_address, obj->plen), buf2) : "");
-_vt_cmd_plobj_to_string_id (ip6_address, NMPlatformIP6Address, "%d: %s", obj->ifindex, nm_utils_inet6_ntop (&obj->address, buf1));
+ obj->peer_address != obj->address ? _nm_utils_inet4_ntop (nm_utils_ip4_address_clear_host_address (obj->peer_address, obj->plen), buf2) : "");
+_vt_cmd_plobj_to_string_id (ip6_address, NMPlatformIP6Address, "%d: %s", obj->ifindex, _nm_utils_inet6_ntop (&obj->address, buf1));
_vt_cmd_plobj_to_string_id (qdisc, NMPlatformQdisc, "%d: %d", obj->ifindex, obj->parent);
_vt_cmd_plobj_to_string_id (tfilter, NMPlatformTfilter, "%d: %d", obj->ifindex, obj->parent);
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index f6a77daa08..2b27d15414 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -356,7 +356,7 @@ _nmtstp_assert_ip4_route_exists (const char *file,
g_error ("[%s:%u] %s(): The ip4 route %s/%d metric %u tos %u shall exist %u times, but platform has it %u times",
file, line, func,
- nm_utils_inet4_ntop (network, sbuf),
+ _nm_utils_inet4_ntop (network, sbuf),
plen,
metric,
tos,
@@ -467,10 +467,10 @@ _nmtstp_assert_ip6_route_exists (const char *file,
g_error ("[%s:%u] %s(): The ip6 route %s/%d metric %u src %s/%d shall exist %u times, but platform has it %u times",
file, line, func,
- nm_utils_inet6_ntop (network, s_network),
+ _nm_utils_inet6_ntop (network, s_network),
plen,
metric,
- nm_utils_inet6_ntop (src, s_src),
+ _nm_utils_inet6_ntop (src, s_src),
src_plen,
c_exists,
c);
@@ -831,12 +831,12 @@ _ip_address_add (NMPlatform *platform,
if ( peer_address->addr4 != address->addr4
|| nmtst_get_rand_uint32 () % 2) {
/* If the peer is the same as the local address, we can omit it. The result should be identical */
- nm_sprintf_buf (s_peer, " peer %s", nm_utils_inet4_ntop (peer_address->addr4, b2));
+ nm_sprintf_buf (s_peer, " peer %s", _nm_utils_inet4_ntop (peer_address->addr4, b2));
} else
s_peer[0] = '\0';
nmtstp_run_command_check ("ip address change %s%s/%d dev %s%s%s%s",
- nm_utils_inet4_ntop (address->addr4, b1),
+ _nm_utils_inet4_ntop (address->addr4, b1),
s_peer,
plen,
ifname,
@@ -849,9 +849,9 @@ _ip_address_add (NMPlatform *platform,
/* flags not implemented (yet) */
g_assert (flags == 0);
nmtstp_run_command_check ("ip address change %s%s%s/%d dev %s%s%s%s",
- nm_utils_inet6_ntop (&address->addr6, b1),
+ _nm_utils_inet6_ntop (&address->addr6, b1),
!IN6_IS_ADDR_UNSPECIFIED (&peer_address->addr6) ? " peer " : "",
- !IN6_IS_ADDR_UNSPECIFIED (&peer_address->addr6) ? nm_utils_inet6_ntop (&peer_address->addr6, b2) : "",
+ !IN6_IS_ADDR_UNSPECIFIED (&peer_address->addr6) ? _nm_utils_inet6_ntop (&peer_address->addr6, b2) : "",
plen,
ifname,
s_valid ?: "",
@@ -1059,15 +1059,15 @@ _ip_address_del (NMPlatform *platform,
if (is_v4) {
success = nmtstp_run_command ("ip address delete %s%s%s/%d dev %s",
- nm_utils_inet4_ntop (address->addr4, b1),
+ _nm_utils_inet4_ntop (address->addr4, b1),
peer_address->addr4 != address->addr4 ? " peer " : "",
- peer_address->addr4 != address->addr4 ? nm_utils_inet4_ntop (peer_address->addr4, b2) : "",
+ peer_address->addr4 != address->addr4 ? _nm_utils_inet4_ntop (peer_address->addr4, b2) : "",
plen,
ifname);
} else {
g_assert (!peer_address);
success = nmtstp_run_command ("ip address delete %s/%d dev %s",
- nm_utils_inet6_ntop (&address->addr6, b1),
+ _nm_utils_inet6_ntop (&address->addr6, b1),
plen,
ifname);
}
@@ -1258,8 +1258,8 @@ nmtstp_link_gre_add (NMPlatform *platform,
name,
type,
dev ?: "",
- nm_utils_inet4_ntop (lnk->local, b1),
- nm_utils_inet4_ntop (lnk->remote, b2),
+ _nm_utils_inet4_ntop (lnk->local, b1),
+ _nm_utils_inet4_ntop (lnk->remote, b2),
lnk->ttl,
lnk->tos,
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
@@ -1320,8 +1320,8 @@ nmtstp_link_ip6tnl_add (NMPlatform *platform,
name,
mode,
dev,
- nm_utils_inet6_ntop (&lnk->local, b1),
- nm_utils_inet6_ntop (&lnk->remote, b2),
+ _nm_utils_inet6_ntop (&lnk->local, b1),
+ _nm_utils_inet6_ntop (&lnk->remote, b2),
lnk->ttl,
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
encap_ignore ? "none" : nm_sprintf_buf (encap, "%u", lnk->encap_limit),
@@ -1368,8 +1368,8 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
name,
lnk->is_tap ? "ip6gretap" : "ip6gre",
dev,
- nm_utils_inet6_ntop (&lnk->local, b1),
- nm_utils_inet6_ntop (&lnk->remote, b2),
+ _nm_utils_inet6_ntop (&lnk->local, b1),
+ _nm_utils_inet6_ntop (&lnk->remote, b2),
lnk->ttl,
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
lnk->flow_label);
@@ -1413,8 +1413,8 @@ nmtstp_link_ipip_add (NMPlatform *platform,
success = !nmtstp_run_command ("ip tunnel add %s mode ipip %s local %s remote %s ttl %u tos %02x %s",
name,
dev,
- nm_utils_inet4_ntop (lnk->local, b1),
- nm_utils_inet4_ntop (lnk->remote, b2),
+ _nm_utils_inet4_ntop (lnk->local, b1),
+ _nm_utils_inet4_ntop (lnk->remote, b2),
lnk->ttl,
lnk->tos,
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
@@ -1507,8 +1507,8 @@ nmtstp_link_sit_add (NMPlatform *platform,
success = !nmtstp_run_command ("ip tunnel add %s mode sit%s local %s remote %s ttl %u tos %02x %s",
name,
dev,
- nm_utils_inet4_ntop (lnk->local, b1),
- nm_utils_inet4_ntop (lnk->remote, b2),
+ _nm_utils_inet4_ntop (lnk->local, b1),
+ _nm_utils_inet4_ntop (lnk->remote, b2),
lnk->ttl,
lnk->tos,
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
@@ -1644,16 +1644,16 @@ nmtstp_link_vxlan_add (NMPlatform *platform,
dev = g_strdup_printf ("dev %s", nm_platform_link_get_name (platform, lnk->parent_ifindex));
if (lnk->local)
- nm_utils_inet4_ntop (lnk->local, local);
+ _nm_utils_inet4_ntop (lnk->local, local);
else if (memcmp (&lnk->local6, &in6addr_any, sizeof (in6addr_any)))
- nm_utils_inet6_ntop (&lnk->local6, local);
+ _nm_utils_inet6_ntop (&lnk->local6, local);
else
local[0] = '\0';
if (lnk->group)
- nm_utils_inet4_ntop (lnk->group, group);
+ _nm_utils_inet4_ntop (lnk->group, group);
else if (memcmp (&lnk->group6, &in6addr_any, sizeof (in6addr_any)))
- nm_utils_inet6_ntop (&lnk->group6, group);
+ _nm_utils_inet6_ntop (&lnk->group6, group);
else
group[0] = '\0';
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 9110d68d75..e2738f7ce3 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -727,7 +727,7 @@ read_full_ip4_address (shvarFile *ifcfg,
else {
/* Try to autodetermine the prefix for the address' class */
prefix = _nm_utils_ip4_get_default_prefix (ipaddr);
- PARSE_WARNING ("missing %s, assuming %s/%d", prefix_tag, nm_utils_inet4_ntop (ipaddr, inet_buf), prefix);
+ PARSE_WARNING ("missing %s, assuming %s/%d", prefix_tag, _nm_utils_inet4_ntop (ipaddr, inet_buf), prefix);
}
}
}
@@ -1305,7 +1305,7 @@ read_one_ip4_route (shvarFile *ifcfg,
prefix = nm_utils_ip4_netmask_to_prefix (netmask);
if (netmask != _nm_utils_ip4_prefix_to_netmask (prefix)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
- "Invalid IP4 netmask '%s' \"%s\"", netmask_tag, nm_utils_inet4_ntop (netmask, inet_buf));
+ "Invalid IP4 netmask '%s' \"%s\"", netmask_tag, _nm_utils_inet4_ntop (netmask, inet_buf));
return FALSE;
}
} else {
@@ -1813,10 +1813,10 @@ make_ip4_setting (shvarFile *ifcfg,
nm_clear_g_free (&value);
v = svGetValueStr (ifcfg, tag, &value);
if (v) {
- if (nm_utils_ipaddr_valid (AF_INET, v)) {
+ if (nm_utils_ipaddr_is_valid (AF_INET, v)) {
if (!nm_setting_ip_config_add_dns (s_ip4, v))
PARSE_WARNING ("duplicate DNS server %s", tag);
- } else if (nm_utils_ipaddr_valid (AF_INET6, v)) {
+ } else if (nm_utils_ipaddr_is_valid (AF_INET6, v)) {
/* Ignore IPv6 addresses */
} else {
PARSE_WARNING ("invalid DNS server address %s", v);
@@ -2256,7 +2256,7 @@ make_ip6_setting (shvarFile *ifcfg,
char *ptr;
if ((ptr = strchr (v, '%')) != NULL)
*ptr = '\0'; /* remove %interface prefix if present */
- if (!nm_utils_ipaddr_valid (AF_INET6, v)) {
+ if (!nm_utils_ipaddr_is_valid (AF_INET6, v)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid IP6 address '%s'", v);
return NULL;
@@ -2295,10 +2295,10 @@ make_ip6_setting (shvarFile *ifcfg,
break;
}
- if (nm_utils_ipaddr_valid (AF_INET6, v)) {
+ if (nm_utils_ipaddr_is_valid (AF_INET6, v)) {
if (!nm_setting_ip_config_add_dns (s_ip6, v))
PARSE_WARNING ("duplicate DNS server %s", tag);
- } else if (nm_utils_ipaddr_valid (AF_INET, v)) {
+ } else if (nm_utils_ipaddr_is_valid (AF_INET, v)) {
/* Ignore IPv4 addresses */
} else {
PARSE_WARNING ("invalid DNS server address %s", v);
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index 7f26c3edf1..371ffafd0e 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -2036,7 +2036,7 @@ write_route_file_svformat (const char *filename, NMSettingIPConfig *s_ip4)
netmask = _nm_utils_ip4_prefix_to_netmask (nm_ip_route_get_prefix (route));
svSetValueStr (routefile, netmask_key,
- nm_utils_inet4_ntop (netmask, buf));
+ _nm_utils_inet4_ntop (netmask, buf));
svSetValueStr (routefile, gw_key, nm_ip_route_get_next_hop (route));
@@ -2430,7 +2430,7 @@ write_ip4_setting (NMConnection *connection,
char buf[INET_ADDRSTRLEN];
svSetValueStr (ifcfg, tag,
- nm_utils_inet4_ntop (_nm_utils_ip4_prefix_to_netmask (prefix), buf));
+ _nm_utils_inet4_ntop (_nm_utils_ip4_prefix_to_netmask (prefix), buf));
}
n++;
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 8ce1b0f709..1ff19f4408 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -2094,7 +2094,7 @@ test_read_wired_aliases_good (gconstpointer test_data)
g_assert (ip4_addr != NULL);
addr = nm_ip_address_get_address (ip4_addr);
- g_assert (nm_utils_ipaddr_valid (AF_INET, addr));
+ g_assert (nm_utils_ipaddr_is_valid (AF_INET, addr));
for (j = 0; j < expected_num_addresses; j++) {
if (!g_strcmp0 (addr, expected_address[j]))
diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-parser.c b/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
index 1db9ef15fe..64cd431d5d 100644
--- a/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
+++ b/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
@@ -484,7 +484,7 @@ update_ip4_setting_from_if_block (NMConnection *connection,
/* gateway */
gateway_v = ifparser_getkey (block, "gateway");
if (gateway_v) {
- if (!nm_utils_ipaddr_valid (AF_INET, gateway_v)) {
+ if (!nm_utils_ipaddr_is_valid (AF_INET, gateway_v)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid IPv4 gateway '%s'", gateway_v);
return FALSE;
@@ -596,7 +596,7 @@ update_ip6_setting_from_if_block (NMConnection *connection,
/* gateway */
gateway_v = ifparser_getkey (block, "gateway");
if (gateway_v) {
- if (!nm_utils_ipaddr_valid (AF_INET6, gateway_v)) {
+ if (!nm_utils_ipaddr_is_valid (AF_INET6, gateway_v)) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Invalid IPv6 gateway '%s'", gateway_v);
return FALSE;
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c
index 6a25dddaf0..97ff5b84be 100644
--- a/src/vpn/nm-vpn-connection.c
+++ b/src/vpn/nm-vpn-connection.c
@@ -984,10 +984,10 @@ print_vpn_config (NMVpnConnection *self)
if (priv->ip4_external_gw) {
_LOGI ("Data: VPN Gateway: %s",
- nm_utils_inet4_ntop (priv->ip4_external_gw, b1));
+ _nm_utils_inet4_ntop (priv->ip4_external_gw, b1));
} else if (priv->ip6_external_gw) {
_LOGI ("Data: VPN Gateway: %s",
- nm_utils_inet6_ntop (priv->ip6_external_gw, b1));
+ _nm_utils_inet6_ntop (priv->ip6_external_gw, b1));
}
_LOGI ("Data: Tunnel Device: %s%s%s", NM_PRINT_FMT_QUOTE_STRING (priv->ip_iface));
@@ -1001,22 +1001,22 @@ print_vpn_config (NMVpnConnection *self)
nm_assert (address4);
if (priv->ip4_internal_gw)
- _LOGI ("Data: Internal Gateway: %s", nm_utils_inet4_ntop (priv->ip4_internal_gw, b1));
- _LOGI ("Data: Internal Address: %s", address4 ? nm_utils_inet4_ntop (address4->address, b1) : "??");
+ _LOGI ("Data: Internal Gateway: %s", _nm_utils_inet4_ntop (priv->ip4_internal_gw, b1));
+ _LOGI ("Data: Internal Address: %s", address4 ? _nm_utils_inet4_ntop (address4->address, b1) : "??");
_LOGI ("Data: Internal Prefix: %d", address4 ? (int) address4->plen : -1);
- _LOGI ("Data: Internal Point-to-Point Address: %s", nm_utils_inet4_ntop (address4->peer_address, b1));
+ _LOGI ("Data: Internal Point-to-Point Address: %s", _nm_utils_inet4_ntop (address4->peer_address, b1));
nm_ip_config_iter_ip4_route_for_each (&ipconf_iter, priv->ip4_config, &route) {
_LOGI ("Data: Static Route: %s/%d Next Hop: %s",
- nm_utils_inet4_ntop (route->network, b1),
+ _nm_utils_inet4_ntop (route->network, b1),
route->plen,
- nm_utils_inet4_ntop (route->gateway, b2));
+ _nm_utils_inet4_ntop (route->gateway, b2));
}
num = nm_ip4_config_get_num_nameservers (priv->ip4_config);
for (i = 0; i < num; i++) {
_LOGI ("Data: Internal DNS: %s",
- nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (priv->ip4_config, i), b1));
+ _nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (priv->ip4_config, i), b1));
}
if (nm_ip4_config_get_num_domains (priv->ip4_config) > 0)
@@ -1035,22 +1035,22 @@ print_vpn_config (NMVpnConnection *self)
nm_assert (address6);
if (priv->ip6_internal_gw)
- _LOGI ("Data: Internal Gateway: %s", nm_utils_inet6_ntop (priv->ip6_internal_gw, b1));
- _LOGI ("Data: Internal Address: %s", nm_utils_inet6_ntop (&address6->address, b1));
+ _LOGI ("Data: Internal Gateway: %s", _nm_utils_inet6_ntop (priv->ip6_internal_gw, b1));
+ _LOGI ("Data: Internal Address: %s", _nm_utils_inet6_ntop (&address6->address, b1));
_LOGI ("Data: Internal Prefix: %d", address6->plen);
- _LOGI ("Data: Internal Point-to-Point Address: %s", nm_utils_inet6_ntop (&address6->peer_address, b1));
+ _LOGI ("Data: Internal Point-to-Point Address: %s", _nm_utils_inet6_ntop (&address6->peer_address, b1));
nm_ip_config_iter_ip6_route_for_each (&ipconf_iter, priv->ip6_config, &route) {
_LOGI ("Data: Static Route: %s/%d Next Hop: %s",
- nm_utils_inet6_ntop (&route->network, b1),
+ _nm_utils_inet6_ntop (&route->network, b1),
route->plen,
- nm_utils_inet6_ntop (&route->gateway, b2));
+ _nm_utils_inet6_ntop (&route->gateway, b2));
}
num = nm_ip6_config_get_num_nameservers (priv->ip6_config);
for (i = 0; i < num; i++) {
_LOGI ("Data: Internal DNS: %s",
- nm_utils_inet6_ntop (nm_ip6_config_get_nameserver (priv->ip6_config, i), b1));
+ _nm_utils_inet6_ntop (nm_ip6_config_get_nameserver (priv->ip6_config, i), b1));
}
if (nm_ip6_config_get_num_domains (priv->ip6_config) > 0)