mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 04:10:28 +01:00
all: don't use static buffer for nm_utils_inet*_ntop()
While nm_utils_inet*_ntop() accepts a %NULL buffer to fallback to a static buffer, don't do that. I find the possibility of using a static buffer here error prone and something that should be avoided. There is of course the downside, that in some cases it requires an additional line of code to allocate the buffer on the stack as auto-variable.
This commit is contained in:
parent
898f7a5665
commit
a51c09dc12
22 changed files with 211 additions and 151 deletions
|
|
@ -1173,7 +1173,7 @@ nm_utils_ip4_dns_from_variant (GVariant *value)
|
|||
dns = g_new (char *, length + 1);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
dns[i] = g_strdup (nm_utils_inet4_ntop (array[i], NULL));
|
||||
dns[i] = nm_utils_inet4_ntop_dup (array[i]);
|
||||
dns[i] = NULL;
|
||||
|
||||
return dns;
|
||||
|
|
@ -1271,7 +1271,7 @@ nm_utils_ip4_addresses_from_variant (GVariant *value, char **out_gateway)
|
|||
g_ptr_array_add (addresses, addr);
|
||||
|
||||
if (addr_array[2] && out_gateway && !*out_gateway)
|
||||
*out_gateway = g_strdup (nm_utils_inet4_ntop (addr_array[2], NULL));
|
||||
*out_gateway = nm_utils_inet4_ntop_dup (addr_array[2]);
|
||||
} else {
|
||||
g_warning ("Ignoring invalid IP4 address: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
|
|
@ -1493,7 +1493,7 @@ nm_utils_ip6_dns_from_variant (GVariant *value)
|
|||
continue;
|
||||
}
|
||||
|
||||
dns[i++] = g_strdup (nm_utils_inet6_ntop (ip, NULL));
|
||||
dns[i++] = nm_utils_inet6_ntop_dup (ip);
|
||||
g_variant_unref (ip_var);
|
||||
}
|
||||
dns[i] = NULL;
|
||||
|
|
@ -1612,7 +1612,7 @@ nm_utils_ip6_addresses_from_variant (GVariant *value, char **out_gateway)
|
|||
goto next;
|
||||
}
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED (gateway_bytes))
|
||||
*out_gateway = g_strdup (nm_utils_inet6_ntop (gateway_bytes, NULL));
|
||||
*out_gateway = nm_utils_inet6_ntop_dup (gateway_bytes);
|
||||
}
|
||||
} else {
|
||||
g_warning ("Ignoring invalid IP6 address: %s", error->message);
|
||||
|
|
|
|||
|
|
@ -5084,7 +5084,7 @@ test_setting_ip4_gateway (void)
|
|||
GVariantBuilder addrs_builder;
|
||||
GError *error = NULL;
|
||||
|
||||
g_assert_cmpstr (nm_utils_inet4_ntop (addr_vals_0[0], NULL), ==, "192.168.1.10");
|
||||
nmtst_assert_ip4_address (addr_vals_0[0], "192.168.1.10");
|
||||
|
||||
/* When serializing on the daemon side, ipv4.gateway is copied to the first
|
||||
* entry of ipv4.addresses
|
||||
|
|
@ -5126,7 +5126,7 @@ test_setting_ip4_gateway (void)
|
|||
|
||||
addr_array = g_variant_get_fixed_array (addr_var, &length, sizeof (guint32));
|
||||
g_assert_cmpint (length, ==, 3);
|
||||
g_assert_cmpstr (nm_utils_inet4_ntop (addr_array[2], NULL), ==, "192.168.1.1");
|
||||
nmtst_assert_ip4_address (addr_array[2], "192.168.1.1");
|
||||
g_variant_unref (addr_var);
|
||||
}
|
||||
g_variant_unref (value);
|
||||
|
|
@ -5233,7 +5233,7 @@ test_setting_ip6_gateway (void)
|
|||
|
||||
gateway_bytes = g_variant_get_fixed_array (gateway_var, &length, 1);
|
||||
g_assert_cmpint (length, ==, 16);
|
||||
g_assert_cmpstr (nm_utils_inet6_ntop ((struct in6_addr *) gateway_bytes, NULL), ==, "abcd::1");
|
||||
nmtst_assert_ip6_address ((struct in6_addr *) gateway_bytes, "abcd::1");
|
||||
g_variant_unref (gateway_var);
|
||||
}
|
||||
g_variant_unref (value);
|
||||
|
|
|
|||
|
|
@ -230,11 +230,12 @@ acd_probe_add (NMAcdManager *self,
|
|||
{
|
||||
NAcdProbeConfig *probe_config;
|
||||
int r;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
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, NULL),
|
||||
nm_utils_inet4_ntop (info->address, sbuf),
|
||||
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
|
||||
acd_error_to_string (r));
|
||||
return FALSE;
|
||||
|
|
@ -246,7 +247,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, NULL),
|
||||
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);
|
||||
|
|
@ -381,6 +382,8 @@ nm_acd_manager_announce_addresses (NMAcdManager *self)
|
|||
acd_probe_add (self, info, 0);
|
||||
self->state = STATE_ANNOUNCING;
|
||||
} else if (self->state == STATE_ANNOUNCING) {
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
g_hash_table_iter_init (&iter, self->addresses);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info)) {
|
||||
if (info->duplicate)
|
||||
|
|
@ -388,11 +391,11 @@ 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, NULL),
|
||||
nm_utils_inet4_ntop (info->address, sbuf),
|
||||
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, NULL));
|
||||
_LOGD ("announcing address %s", nm_utils_inet4_ntop (info->address, sbuf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,28 +329,28 @@ clear:
|
|||
if (!address_equal_pn (AF_INET, priv->local, &local4)) {
|
||||
g_clear_pointer (&priv->local, g_free);
|
||||
if (local4)
|
||||
priv->local = g_strdup (nm_utils_inet4_ntop (local4, NULL));
|
||||
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 = g_strdup (nm_utils_inet4_ntop (remote4, NULL));
|
||||
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 = g_strdup (nm_utils_inet6_ntop (&local6, NULL));
|
||||
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 = g_strdup (nm_utils_inet6_ntop (&remote6, NULL));
|
||||
priv->remote = nm_utils_inet6_ntop_dup (&remote6);
|
||||
_notify (self, PROP_REMOTE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "settings/nm-settings.h"
|
||||
#include "nm-act-request.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceVxlan);
|
||||
|
|
@ -386,6 +387,7 @@ update_connection (NMDevice *device, NMConnection *connection)
|
|||
{
|
||||
NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE ((NMDeviceVxlan *) device);
|
||||
NMSettingVxlan *s_vxlan = nm_connection_get_setting_vxlan (connection);
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (!s_vxlan) {
|
||||
s_vxlan = (NMSettingVxlan *) nm_setting_vxlan_new ();
|
||||
|
|
@ -404,11 +406,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, NULL),
|
||||
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, NULL),
|
||||
nm_utils_inet6_ntop (&priv->props.group6, sbuf),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -416,11 +418,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, NULL),
|
||||
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, NULL),
|
||||
nm_utils_inet6_ntop (&priv->props.local6, sbuf),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -510,15 +512,15 @@ get_property (GObject *object, guint prop_id,
|
|||
break;
|
||||
case PROP_GROUP:
|
||||
if (priv->props.group)
|
||||
g_value_set_string (value, nm_utils_inet4_ntop (priv->props.group, NULL));
|
||||
g_value_take_string (value, nm_utils_inet4_ntop_dup (priv->props.group));
|
||||
else if (!IN6_IS_ADDR_UNSPECIFIED (&priv->props.group6))
|
||||
g_value_set_string (value, nm_utils_inet6_ntop (&priv->props.group6, NULL));
|
||||
g_value_take_string (value, nm_utils_inet6_ntop_dup (&priv->props.group6));
|
||||
break;
|
||||
case PROP_LOCAL:
|
||||
if (priv->props.local)
|
||||
g_value_set_string (value, nm_utils_inet4_ntop (priv->props.local, NULL));
|
||||
g_value_take_string (value, nm_utils_inet4_ntop_dup (priv->props.local));
|
||||
else if (!IN6_IS_ADDR_UNSPECIFIED (&priv->props.local6))
|
||||
g_value_set_string (value, nm_utils_inet6_ntop (&priv->props.local6, NULL));
|
||||
g_value_take_string (value, nm_utils_inet6_ntop_dup (&priv->props.local6));
|
||||
break;
|
||||
case PROP_TOS:
|
||||
g_value_set_uchar (value, priv->props.tos);
|
||||
|
|
|
|||
|
|
@ -5475,10 +5475,13 @@ nm_device_generate_connection (NMDevice *self,
|
|||
nm_connection_add_setting (connection, nm_setting_proxy_new ());
|
||||
|
||||
pllink = nm_platform_link_get (nm_device_get_platform (self), priv->ifindex);
|
||||
if (pllink && pllink->inet6_token.id) {
|
||||
if ( pllink
|
||||
&& pllink->inet6_token.id) {
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, NM_IN6_ADDR_GEN_MODE_EUI64,
|
||||
NM_SETTING_IP6_CONFIG_TOKEN, nm_utils_inet6_interface_identifier_to_token (pllink->inet6_token, NULL),
|
||||
NM_SETTING_IP6_CONFIG_TOKEN, nm_utils_inet6_interface_identifier_to_token (pllink->inet6_token, sbuf),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -6641,13 +6644,15 @@ acd_manager_probe_terminated (NMAcdManager *acd_manager, gpointer user_data)
|
|||
|
||||
for (i = 0; data->configs && data->configs[i]; i++) {
|
||||
nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, data->configs[i], &address) {
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
result = nm_acd_manager_check_address (acd_manager, address->address);
|
||||
success &= result;
|
||||
|
||||
_NMLOG (result ? LOGL_DEBUG : LOGL_WARN,
|
||||
LOGD_DEVICE,
|
||||
"IPv4 DAD result: address %s is %s",
|
||||
nm_utils_inet4_ntop (address->address, NULL),
|
||||
nm_utils_inet4_ntop (address->address, sbuf),
|
||||
result ? "unique" : "duplicate");
|
||||
}
|
||||
}
|
||||
|
|
@ -8678,6 +8683,7 @@ nm_device_use_ip6_subnet (NMDevice *self, const NMPlatformIP6Address *subnet)
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMPlatformIP6Address address = *subnet;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (!applied_config_get_current (&priv->ac_ip6_config))
|
||||
applied_config_init_new (&priv->ac_ip6_config, self, AF_INET6);
|
||||
|
|
@ -8687,7 +8693,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, NULL),
|
||||
nm_utils_inet6_ntop (&address.address, sbuf),
|
||||
subnet->preferred);
|
||||
|
||||
/* This also updates the ndisc if there are actual changes. */
|
||||
|
|
@ -8806,6 +8812,7 @@ check_and_add_ipv6ll_addr (NMDevice *self)
|
|||
NMSettingIP6Config *s_ip6 = NULL;
|
||||
GError *error = NULL;
|
||||
const char *addr_type;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (!priv->ipv6ll_handle)
|
||||
return;
|
||||
|
|
@ -8866,7 +8873,8 @@ check_and_add_ipv6ll_addr (NMDevice *self)
|
|||
addr_type = "EUI-64";
|
||||
}
|
||||
|
||||
_LOGD (LOGD_IP6, "linklocal6: generated %s IPv6LL address %s", addr_type, nm_utils_inet6_ntop (&lladdr, NULL));
|
||||
_LOGD (LOGD_IP6, "linklocal6: generated %s IPv6LL address %s",
|
||||
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);
|
||||
|
|
@ -14435,7 +14443,7 @@ find_dhcp4_address (NMDevice *self)
|
|||
|
||||
nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, priv->ip_config_4, &a) {
|
||||
if (a->addr_source == NM_IP_CONFIG_SOURCE_DHCP)
|
||||
return g_strdup (nm_utils_inet4_ntop (a->address, NULL));
|
||||
return nm_utils_inet4_ntop_dup (a->address);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ again:
|
|||
|
||||
for (i = 0; info->addresses[i]; i++) {
|
||||
gboolean val;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
val = nm_acd_manager_check_address (manager, info->addresses[i]);
|
||||
if (val == info->expected_result[i])
|
||||
|
|
@ -168,7 +169,7 @@ again:
|
|||
}
|
||||
|
||||
g_error ("expected check for address #%d (%s) to %s, but it didn't",
|
||||
i, nm_utils_inet4_ntop (info->addresses[i], NULL),
|
||||
i, nm_utils_inet4_ntop (info->addresses[i], sbuf),
|
||||
info->expected_result[i] ? "detect no duplicated" : "detect a duplicate");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
NMIP4Config *ip4_config = NULL;
|
||||
struct in_addr tmp_addr;
|
||||
const struct in_addr *addr_list;
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char addr_str2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
const char *s;
|
||||
guint32 lifetime = 0, i;
|
||||
NMPlatformIP4Address address;
|
||||
|
|
@ -258,9 +259,9 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
memset (&address, 0, sizeof (address));
|
||||
address.address = tmp_addr.s_addr;
|
||||
address.peer_address = tmp_addr.s_addr;
|
||||
s = nm_utils_inet4_ntop (tmp_addr.s_addr, NULL);
|
||||
LOG_LEASE (LOGD_DHCP4, "address %s", s);
|
||||
add_option (options, dhcp4_requests, DHCP_OPTION_IP_ADDRESS, s);
|
||||
nm_utils_inet4_ntop (tmp_addr.s_addr, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP4, "address %s", addr_str);
|
||||
add_option (options, dhcp4_requests, DHCP_OPTION_IP_ADDRESS, addr_str);
|
||||
|
||||
/* Prefix/netmask */
|
||||
sd_dhcp_lease_get_netmask (lease, &tmp_addr);
|
||||
|
|
@ -269,7 +270,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
add_option (options,
|
||||
dhcp4_requests,
|
||||
SD_DHCP_OPTION_SUBNET_MASK,
|
||||
nm_utils_inet4_ntop (tmp_addr.s_addr, NULL));
|
||||
nm_utils_inet4_ntop (tmp_addr.s_addr, addr_str));
|
||||
|
||||
/* Lease time */
|
||||
sd_dhcp_lease_get_lifetime (lease, &lifetime);
|
||||
|
|
@ -292,7 +293,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
for (i = 0; i < num; i++) {
|
||||
if (addr_list[i].s_addr) {
|
||||
nm_ip4_config_add_nameserver (ip4_config, addr_list[i].s_addr);
|
||||
s = nm_utils_inet4_ntop (addr_list[i].s_addr, NULL);
|
||||
s = nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP4, "nameserver '%s'", s);
|
||||
g_string_append_printf (str, "%s%s", str->len ? " " : "", s);
|
||||
}
|
||||
|
|
@ -366,8 +367,8 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
route.table_coerced = nm_platform_route_table_coerce (route_table);
|
||||
nm_ip4_config_add_route (ip4_config, &route, NULL);
|
||||
|
||||
s = nm_utils_inet4_ntop (route.network, buf);
|
||||
gw_str = nm_utils_inet4_ntop (route.gateway, NULL);
|
||||
s = nm_utils_inet4_ntop (route.network, addr_str);
|
||||
gw_str = nm_utils_inet4_ntop (route.gateway, addr_str2);
|
||||
LOG_LEASE (LOGD_DHCP4, "static route %s/%d gw %s", s, route.plen, gw_str);
|
||||
|
||||
g_string_append_printf (str, "%s%s/%d %s", str->len ? " " : "", s, route.plen, gw_str);
|
||||
|
|
@ -377,7 +378,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
gateway_has = TRUE;
|
||||
gateway = route.gateway;
|
||||
|
||||
s = nm_utils_inet4_ntop (route.gateway, NULL);
|
||||
s = nm_utils_inet4_ntop (route.gateway, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP4, "gateway %s", s);
|
||||
add_option (options, dhcp4_requests, SD_DHCP_OPTION_ROUTER, s);
|
||||
}
|
||||
|
|
@ -398,7 +399,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
if (r == 0) {
|
||||
gateway_has = TRUE;
|
||||
gateway = tmp_addr.s_addr;
|
||||
s = nm_utils_inet4_ntop (tmp_addr.s_addr, NULL);
|
||||
s = nm_utils_inet4_ntop (tmp_addr.s_addr, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP4, "gateway %s", s);
|
||||
add_option (options, dhcp4_requests, SD_DHCP_OPTION_ROUTER, s);
|
||||
}
|
||||
|
|
@ -428,7 +429,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
|||
if (num > 0) {
|
||||
nm_gstring_prepare (&str);
|
||||
for (i = 0; i < num; i++) {
|
||||
s = nm_utils_inet4_ntop (addr_list[i].s_addr, buf);
|
||||
s = nm_utils_inet4_ntop (addr_list[i].s_addr, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP4, "ntp server '%s'", s);
|
||||
g_string_append_printf (str, "%s%s", str->len ? " " : "", s);
|
||||
}
|
||||
|
|
@ -726,7 +727,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
|
|||
struct in6_addr tmp_addr, *dns;
|
||||
uint32_t lft_pref, lft_valid;
|
||||
NMIP6Config *ip6_config;
|
||||
const char *addr_str;
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char **domains;
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
int num, i;
|
||||
|
|
@ -751,8 +752,10 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
|
|||
|
||||
nm_ip6_config_add_address (ip6_config, &address);
|
||||
|
||||
addr_str = nm_utils_inet6_ntop (&tmp_addr, NULL);
|
||||
g_string_append_printf (str, "%s%s", str->len ? " " : "", addr_str);
|
||||
nm_utils_inet6_ntop (&tmp_addr, addr_str);
|
||||
if (str->len)
|
||||
g_string_append_c (str, ' ');
|
||||
g_string_append (str, addr_str);
|
||||
|
||||
LOG_LEASE (LOGD_DHCP6,
|
||||
"address %s",
|
||||
|
|
@ -777,8 +780,10 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
|
|||
nm_gstring_prepare (&str);
|
||||
for (i = 0; i < num; i++) {
|
||||
nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
|
||||
addr_str = nm_utils_inet6_ntop (&dns[i], NULL);
|
||||
g_string_append_printf (str, "%s%s", str->len ? " " : "", addr_str);
|
||||
nm_utils_inet6_ntop (&dns[i], addr_str);
|
||||
if (str->len)
|
||||
g_string_append_c (str, ' ');
|
||||
g_string_append (str, addr_str);
|
||||
LOG_LEASE (LOGD_DHCP6, "nameserver %s", addr_str);
|
||||
}
|
||||
add_option (options, dhcp6_requests, SD_DHCP6_OPTION_DNS_SERVERS, str->str);
|
||||
|
|
|
|||
|
|
@ -197,7 +197,8 @@ ip4_process_dhclient_rfc3442_routes (const char *iface,
|
|||
/* gateway passed as classless static route */
|
||||
*gwaddr = route.gateway;
|
||||
} else {
|
||||
char addr[INET_ADDRSTRLEN];
|
||||
char b1[INET_ADDRSTRLEN];
|
||||
char b2[INET_ADDRSTRLEN];
|
||||
|
||||
/* normal route */
|
||||
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
|
||||
|
|
@ -206,8 +207,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, addr), route.plen,
|
||||
nm_utils_inet4_ntop (route.gateway, NULL));
|
||||
nm_utils_inet4_ntop (route.network, b1),
|
||||
route.plen,
|
||||
nm_utils_inet4_ntop (route.gateway, b2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -408,6 +410,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx,
|
|||
gboolean gateway_has = FALSE;
|
||||
guint32 gateway = 0;
|
||||
guint8 plen = 0;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
g_return_val_if_fail (options != NULL, NULL);
|
||||
|
||||
|
|
@ -439,7 +442,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, NULL));
|
||||
_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
|
||||
|
|
|
|||
|
|
@ -965,7 +965,9 @@ nm_ndisc_dad_failed (NMNDisc *ndisc, const struct in6_addr *address, gboolean em
|
|||
NMNDiscAddress *item = &g_array_index (rdata->addresses, NMNDiscAddress, i);
|
||||
|
||||
if (IN6_ARE_ADDR_EQUAL (&item->address, address)) {
|
||||
_LOGD ("DAD failed for discovered address %s", nm_utils_inet6_ntop (address, NULL));
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
_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);
|
||||
|
|
@ -1056,10 +1058,11 @@ _config_changed_log (NMNDisc *ndisc, NMNDiscConfigMap changed)
|
|||
}
|
||||
for (i = 0; i < rdata->routes->len; i++) {
|
||||
NMNDiscRoute *route = &g_array_index (rdata->routes, NMNDiscRoute, i);
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
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, NULL),
|
||||
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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3045,14 +3045,12 @@ nm_utils_ipv6_interface_identifier_get_from_token (NMUtilsIPv6IfaceId *iid,
|
|||
/**
|
||||
* nm_utils_inet6_interface_identifier_to_token:
|
||||
* @iid: %NMUtilsIPv6IfaceId interface identifier
|
||||
* @buf: the destination buffer or %NULL
|
||||
* @buf: the destination buffer of at least %NM_UTILS_INET_ADDRSTRLEN
|
||||
* bytes.
|
||||
*
|
||||
* Converts the interface identifier to a string token.
|
||||
* If the destination buffer it set, set it is used to store the
|
||||
* resulting token, otherwise an internal static buffer is used.
|
||||
* The buffer needs to be %NM_UTILS_INET_ADDRSTRLEN characters long.
|
||||
*
|
||||
* Returns: a statically allocated array. Do not g_free().
|
||||
* Returns: the input buffer filled with the id as string.
|
||||
*/
|
||||
const char *
|
||||
nm_utils_inet6_interface_identifier_to_token (NMUtilsIPv6IfaceId iid, char *buf)
|
||||
|
|
|
|||
|
|
@ -1051,6 +1051,7 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
|
|||
NMDedupMultiIter ipconf_iter;
|
||||
const NMPlatformIP4Address *address;
|
||||
const NMPlatformIP4Route *route;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
|
||||
|
|
@ -1095,7 +1096,7 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
|
|||
g_object_set (s_ip4,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
|
||||
NULL),
|
||||
sbuf),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
@ -1130,7 +1131,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, NULL));
|
||||
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);
|
||||
|
|
@ -2039,9 +2040,11 @@ nm_ip_config_dump (const NMIPConfig *self,
|
|||
}
|
||||
|
||||
for (i = 0; i < nm_ip_config_get_num_nameservers (self); i++) {
|
||||
char buf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
ptr = nm_ip_config_get_nameserver (self, i);
|
||||
nm_log (level, domain, NULL, NULL, " dns : %s",
|
||||
nm_utils_inet_ntop (addr_family, ptr, NULL));
|
||||
nm_utils_inet_ntop (addr_family, ptr, buf));
|
||||
}
|
||||
|
||||
for (i = 0; i < nm_ip_config_get_num_domains (self); i++)
|
||||
|
|
@ -3024,6 +3027,7 @@ get_property (GObject *object, guint prop_id,
|
|||
const NMPlatformIP4Route *route;
|
||||
GVariantBuilder builder_data, builder_legacy;
|
||||
guint i;
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IFINDEX:
|
||||
|
|
@ -3061,14 +3065,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, NULL)));
|
||||
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, NULL)));
|
||||
g_variant_new_string (nm_utils_inet4_ntop (address->peer_address, addr_str)));
|
||||
}
|
||||
|
||||
if (*address->label) {
|
||||
|
|
@ -3123,14 +3127,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, NULL)));
|
||||
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, NULL)));
|
||||
g_variant_new_string (nm_utils_inet4_ntop (route->gateway, addr_str)));
|
||||
}
|
||||
g_variant_builder_add (&route_builder, "{sv}",
|
||||
"metric",
|
||||
|
|
@ -3172,9 +3176,8 @@ out_routes_cached:
|
|||
break;
|
||||
case PROP_GATEWAY:
|
||||
if (priv->best_default_route) {
|
||||
g_value_set_string (value,
|
||||
nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
|
||||
NULL));
|
||||
g_value_take_string (value,
|
||||
nm_utils_inet4_ntop_dup (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway));
|
||||
} else
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
|
|
@ -3183,7 +3186,6 @@ out_routes_cached:
|
|||
|
||||
for (i = 0; i < priv->nameservers->len; i++) {
|
||||
GVariantBuilder nested_builder;
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
nm_utils_inet4_ntop (g_array_index (priv->nameservers, in_addr_t, i),
|
||||
addr_str);
|
||||
|
|
@ -3220,8 +3222,6 @@ out_routes_cached:
|
|||
case PROP_WINS_SERVER_DATA:
|
||||
g_variant_builder_init (&builder_data, G_VARIANT_TYPE ("as"));
|
||||
for (i = 0; i < priv->wins->len; i++) {
|
||||
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
g_variant_builder_add (&builder_data,
|
||||
"s",
|
||||
nm_utils_inet4_ntop (g_array_index (priv->wins, in_addr_t, i),
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
|
|||
NMSettingIPConfig *s_ip6;
|
||||
guint nnameservers, nsearches, noptions;
|
||||
const char *method = NULL;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
int i;
|
||||
NMDedupMultiIter ipconf_iter;
|
||||
const NMPlatformIP6Address *address;
|
||||
|
|
@ -765,7 +766,7 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
|
|||
g_object_set (s_ip6,
|
||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||
nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
|
||||
NULL),
|
||||
sbuf),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
@ -804,7 +805,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, NULL));
|
||||
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);
|
||||
|
|
@ -2473,6 +2474,7 @@ get_property (GObject *object, guint prop_id,
|
|||
NMDedupMultiIter ipconf_iter;
|
||||
const NMPlatformIP6Route *route;
|
||||
GVariantBuilder builder_data, builder_legacy;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_IFINDEX:
|
||||
|
|
@ -2509,7 +2511,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, NULL)));
|
||||
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));
|
||||
|
|
@ -2517,7 +2519,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, NULL)));
|
||||
g_variant_new_string (nm_utils_inet6_ntop (&address->peer_address, sbuf)));
|
||||
}
|
||||
|
||||
g_variant_builder_add (&builder_data, "a{sv}", &addr_builder);
|
||||
|
|
@ -2562,14 +2564,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, NULL)));
|
||||
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, NULL)));
|
||||
g_variant_new_string (nm_utils_inet6_ntop (&route->gateway, sbuf)));
|
||||
}
|
||||
|
||||
g_variant_builder_add (&route_builder, "{sv}",
|
||||
|
|
@ -2607,9 +2609,8 @@ out_routes_cached:
|
|||
break;
|
||||
case PROP_GATEWAY:
|
||||
if (priv->best_default_route) {
|
||||
g_value_set_string (value,
|
||||
nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
|
||||
NULL));
|
||||
g_value_take_string (value,
|
||||
nm_utils_inet6_ntop_dup (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway));
|
||||
} else
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ get_ip4_domains (GPtrArray *domains, NMIP4Config *ip4)
|
|||
const NMPlatformIP4Address *address;
|
||||
const NMPlatformIP4Route *routes;
|
||||
guint i;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
/* Extract searches */
|
||||
for (i = 0; i < nm_ip4_config_get_num_searches (ip4); i++)
|
||||
|
|
@ -186,7 +187,7 @@ get_ip4_domains (GPtrArray *domains, NMIP4Config *ip4)
|
|||
|
||||
nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, ip4, &address) {
|
||||
cidr = g_strdup_printf ("%s/%u",
|
||||
nm_utils_inet4_ntop (address->address, NULL),
|
||||
nm_utils_inet4_ntop (address->address, sbuf),
|
||||
address->plen);
|
||||
g_ptr_array_add (domains, cidr);
|
||||
}
|
||||
|
|
@ -195,7 +196,7 @@ get_ip4_domains (GPtrArray *domains, NMIP4Config *ip4)
|
|||
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
|
||||
continue;
|
||||
cidr = g_strdup_printf ("%s/%u",
|
||||
nm_utils_inet4_ntop (routes->network, NULL),
|
||||
nm_utils_inet4_ntop (routes->network, sbuf),
|
||||
routes->plen);
|
||||
g_ptr_array_add (domains, cidr);
|
||||
}
|
||||
|
|
@ -209,6 +210,7 @@ get_ip6_domains (GPtrArray *domains, NMIP6Config *ip6)
|
|||
const NMPlatformIP6Address *address;
|
||||
const NMPlatformIP6Route *routes;
|
||||
guint i;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
/* Extract searches */
|
||||
for (i = 0; i < nm_ip6_config_get_num_searches (ip6); i++)
|
||||
|
|
@ -221,7 +223,7 @@ get_ip6_domains (GPtrArray *domains, NMIP6Config *ip6)
|
|||
/* Add addresses and routes in CIDR form */
|
||||
nm_ip_config_iter_ip6_address_for_each (&ipconf_iter, ip6, &address) {
|
||||
cidr = g_strdup_printf ("%s/%u",
|
||||
nm_utils_inet6_ntop (&address->address, NULL),
|
||||
nm_utils_inet6_ntop (&address->address, sbuf),
|
||||
address->plen);
|
||||
g_ptr_array_add (domains, cidr);
|
||||
}
|
||||
|
|
@ -230,7 +232,7 @@ get_ip6_domains (GPtrArray *domains, NMIP6Config *ip6)
|
|||
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
|
||||
continue;
|
||||
cidr = g_strdup_printf ("%s/%u",
|
||||
nm_utils_inet6_ntop (&routes->network, NULL),
|
||||
nm_utils_inet6_ntop (&routes->network, sbuf),
|
||||
routes->plen);
|
||||
g_ptr_array_add (domains, cidr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,9 +179,10 @@ static void
|
|||
clear_ip6_prefix_delegation (gpointer data)
|
||||
{
|
||||
IP6PrefixDelegation *delegation = data;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
_LOGD (LOGD_IP6, "ipv6-pd: undelegating prefix %s/%d",
|
||||
nm_utils_inet6_ntop (&delegation->prefix.address, NULL),
|
||||
nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
|
||||
delegation->prefix.plen);
|
||||
|
||||
g_hash_table_foreach (delegation->subnets, _clear_ip6_subnet, NULL);
|
||||
|
|
@ -215,13 +216,14 @@ ip6_subnet_from_delegation (IP6PrefixDelegation *delegation, NMDevice *device)
|
|||
{
|
||||
NMPlatformIP6Address *subnet;
|
||||
int ifindex = nm_device_get_ifindex (device);
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
subnet = g_hash_table_lookup (delegation->subnets, GINT_TO_POINTER (ifindex));
|
||||
if (!subnet) {
|
||||
/* 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, NULL),
|
||||
nm_utils_inet6_ntop (&delegation->prefix.address, sbuf),
|
||||
delegation->prefix.plen);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -249,7 +251,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, NULL),
|
||||
nm_utils_inet6_ntop (&subnet->address, sbuf),
|
||||
delegation->prefix.plen,
|
||||
nm_device_get_iface (device));
|
||||
|
||||
|
|
@ -320,9 +322,10 @@ device_ip6_prefix_delegated (NMDevice *device,
|
|||
guint i;
|
||||
const CList *tmp_list;
|
||||
NMActiveConnection *ac;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
_LOGI (LOGD_IP6, "ipv6-pd: received a prefix %s/%d from %s",
|
||||
nm_utils_inet6_ntop (&prefix->address, NULL),
|
||||
nm_utils_inet6_ntop (&prefix->address, sbuf),
|
||||
prefix->plen,
|
||||
nm_device_get_iface (device));
|
||||
|
||||
|
|
|
|||
|
|
@ -1267,12 +1267,14 @@ ip_route_add (NMPlatform *platform,
|
|||
}
|
||||
}
|
||||
if (!has_route_to_gw) {
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
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, NULL), 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, NULL), r->plen, r->metric);
|
||||
r->ifindex, nm_utils_inet6_ntop (&r6->network, sbuf), r->plen, r->metric);
|
||||
}
|
||||
return NM_PLATFORM_ERROR_UNSPECIFIED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5580,9 +5580,10 @@ static gboolean
|
|||
link_set_token (NMPlatform *platform, int ifindex, NMUtilsIPv6IfaceId iid)
|
||||
{
|
||||
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
_LOGD ("link: change %d: token: set IPv6 address generation token to %s",
|
||||
ifindex, nm_utils_inet6_interface_identifier_to_token (iid, NULL));
|
||||
ifindex, nm_utils_inet6_interface_identifier_to_token (iid, sbuf));
|
||||
|
||||
nlmsg = _nl_msg_new_link (RTM_NEWLINK, 0, ifindex, NULL, 0, 0);
|
||||
if (!nlmsg || !_nl_msg_new_link_set_afspec (nlmsg, -1, &iid))
|
||||
|
|
|
|||
|
|
@ -3466,8 +3466,9 @@ gboolean
|
|||
nm_platform_ip4_address_delete (NMPlatform *self, int ifindex, in_addr_t address, guint8 plen, in_addr_t peer_address)
|
||||
{
|
||||
char str_dev[TO_STRING_DEV_BUF_SIZE];
|
||||
char str_peer2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char str_peer[100];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char str_peer[INET_ADDRSTRLEN + 50];
|
||||
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
|
|
@ -3475,9 +3476,13 @@ 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, NULL), plen,
|
||||
nm_utils_inet4_ntop (address, b1),
|
||||
plen,
|
||||
peer_address != address
|
||||
? nm_sprintf_buf (str_peer, "peer %s, ", nm_utils_inet4_ntop (peer_address, str_peer2)) : "",
|
||||
? nm_sprintf_buf (str_peer,
|
||||
"peer %s, ",
|
||||
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);
|
||||
}
|
||||
|
|
@ -3486,6 +3491,7 @@ gboolean
|
|||
nm_platform_ip6_address_delete (NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen)
|
||||
{
|
||||
char str_dev[TO_STRING_DEV_BUF_SIZE];
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
|
|
@ -3493,7 +3499,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, NULL), 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);
|
||||
}
|
||||
|
|
@ -5517,6 +5523,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
|
|||
char str_dst_port[25];
|
||||
char str_tos[25];
|
||||
char str_ttl[25];
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (!nm_utils_to_string_buffer_init_null (lnk, &buf, &len))
|
||||
return buf;
|
||||
|
|
@ -5527,7 +5534,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, NULL));
|
||||
nm_utils_inet4_ntop (lnk->group, sbuf));
|
||||
}
|
||||
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->group6))
|
||||
str_group6[0] = '\0';
|
||||
|
|
@ -5536,7 +5543,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, NULL));
|
||||
nm_utils_inet6_ntop (&lnk->group6, sbuf));
|
||||
}
|
||||
|
||||
if (lnk->local == 0)
|
||||
|
|
@ -5544,7 +5551,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, NULL));
|
||||
nm_utils_inet4_ntop (lnk->local, sbuf));
|
||||
}
|
||||
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->local6))
|
||||
str_local6[0] = '\0';
|
||||
|
|
@ -5552,7 +5559,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, NULL));
|
||||
nm_utils_inet6_ntop (&lnk->local6, sbuf));
|
||||
}
|
||||
|
||||
g_snprintf (buf, len,
|
||||
|
|
@ -5966,13 +5973,21 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route, char *buf, gsi
|
|||
const char *
|
||||
nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route, char *buf, gsize len)
|
||||
{
|
||||
char s_network[INET6_ADDRSTRLEN], s_gateway[INET6_ADDRSTRLEN], s_pref_src[INET6_ADDRSTRLEN];
|
||||
char s_src_all[INET6_ADDRSTRLEN + 40], s_src[INET6_ADDRSTRLEN];
|
||||
char s_network[INET6_ADDRSTRLEN];
|
||||
char s_gateway[INET6_ADDRSTRLEN];
|
||||
char s_pref_src[INET6_ADDRSTRLEN];
|
||||
char s_src_all[INET6_ADDRSTRLEN + 40];
|
||||
char s_src[INET6_ADDRSTRLEN];
|
||||
char str_table[30];
|
||||
char str_pref[40];
|
||||
char str_pref2[30];
|
||||
char str_dev[TO_STRING_DEV_BUF_SIZE], s_source[50];
|
||||
char str_window[32], str_cwnd[32], str_initcwnd[32], str_initrwnd[32], str_mtu[32];
|
||||
char str_dev[TO_STRING_DEV_BUF_SIZE];
|
||||
char s_source[50];
|
||||
char str_window[32];
|
||||
char str_cwnd[32];
|
||||
char str_initcwnd[32];
|
||||
char str_initrwnd[32];
|
||||
char str_mtu[32];
|
||||
char str_rtm_flags[_RTM_FLAGS_TO_STRING_MAXLEN];
|
||||
|
||||
if (!nm_utils_to_string_buffer_init_null (route, &buf, &len))
|
||||
|
|
|
|||
|
|
@ -903,11 +903,9 @@ static const char * \
|
|||
_vt_cmd_plobj_to_string_id_##type (const NMPlatformObject *_obj, char *buf, gsize buf_len) \
|
||||
{ \
|
||||
plat_type *const obj = (plat_type *) _obj; \
|
||||
char buf1[NM_UTILS_INET_ADDRSTRLEN]; \
|
||||
char buf2[NM_UTILS_INET_ADDRSTRLEN]; \
|
||||
_nm_unused char buf1[NM_UTILS_INET_ADDRSTRLEN]; \
|
||||
_nm_unused char buf2[NM_UTILS_INET_ADDRSTRLEN]; \
|
||||
\
|
||||
(void) buf1; \
|
||||
(void) buf2; \
|
||||
g_snprintf (buf, buf_len, \
|
||||
__VA_ARGS__); \
|
||||
return buf; \
|
||||
|
|
|
|||
|
|
@ -366,9 +366,12 @@ _nmtstp_assert_ip4_route_exists (const char *file,
|
|||
&c);
|
||||
|
||||
if (c != c_exists && c_exists != -1) {
|
||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
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, NULL), plen,
|
||||
nm_utils_inet4_ntop (network, sbuf),
|
||||
plen,
|
||||
metric,
|
||||
tos,
|
||||
c_exists,
|
||||
|
|
@ -821,7 +824,8 @@ _ip_address_add (NMPlatform *platform,
|
|||
gs_free char *s_valid = NULL;
|
||||
gs_free char *s_preferred = NULL;
|
||||
gs_free char *s_label = NULL;
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN], b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
ifname = nm_platform_link_get_name (platform, ifindex);
|
||||
g_assert (ifname);
|
||||
|
|
@ -834,14 +838,14 @@ _ip_address_add (NMPlatform *platform,
|
|||
s_label = g_strdup_printf ("%s:%s", ifname, label);
|
||||
|
||||
if (is_v4) {
|
||||
char s_peer[100];
|
||||
char s_peer[NM_UTILS_INET_ADDRSTRLEN + 50];
|
||||
|
||||
g_assert (flags == 0);
|
||||
|
||||
if ( peer_address->addr4 != address->addr4
|
||||
|| nmtst_get_rand_int () % 2) {
|
||||
/* If the peer is the same as the local address, we can omit it. The result should be identical */
|
||||
g_snprintf (s_peer, sizeof (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';
|
||||
|
||||
|
|
@ -1052,7 +1056,8 @@ _ip_address_del (NMPlatform *platform,
|
|||
|
||||
if (external_command) {
|
||||
const char *ifname;
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN], b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
int success;
|
||||
gboolean had_address;
|
||||
|
||||
|
|
@ -1240,7 +1245,8 @@ nmtstp_link_gre_add (NMPlatform *platform,
|
|||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
gboolean success;
|
||||
char buffer[INET_ADDRSTRLEN];
|
||||
char b1[INET_ADDRSTRLEN];
|
||||
char b2[INET_ADDRSTRLEN];
|
||||
NMLinkType link_type;
|
||||
|
||||
g_assert (nm_utils_is_valid_iface_name (name, NULL));
|
||||
|
|
@ -1265,8 +1271,8 @@ nmtstp_link_gre_add (NMPlatform *platform,
|
|||
name,
|
||||
type,
|
||||
dev ?: "",
|
||||
nm_utils_inet4_ntop (lnk->local, NULL),
|
||||
nm_utils_inet4_ntop (lnk->remote, buffer),
|
||||
nm_utils_inet4_ntop (lnk->local, b1),
|
||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
||||
lnk->ttl,
|
||||
lnk->tos,
|
||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
||||
|
|
@ -1288,7 +1294,8 @@ nmtstp_link_ip6tnl_add (NMPlatform *platform,
|
|||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
gboolean success;
|
||||
char buffer[INET6_ADDRSTRLEN];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char encap[20];
|
||||
char tclass[20];
|
||||
gboolean encap_ignore;
|
||||
|
|
@ -1326,8 +1333,8 @@ nmtstp_link_ip6tnl_add (NMPlatform *platform,
|
|||
name,
|
||||
mode,
|
||||
dev,
|
||||
nm_utils_inet6_ntop (&lnk->local, NULL),
|
||||
nm_utils_inet6_ntop (&lnk->remote, buffer),
|
||||
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),
|
||||
|
|
@ -1350,7 +1357,8 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
|
|||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
gboolean success;
|
||||
char buffer[INET6_ADDRSTRLEN];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char tclass[20];
|
||||
gboolean tclass_inherit;
|
||||
|
||||
|
|
@ -1373,8 +1381,8 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
|
|||
name,
|
||||
lnk->is_tap ? "ip6gretap" : "ip6gre",
|
||||
dev,
|
||||
nm_utils_inet6_ntop (&lnk->local, NULL),
|
||||
nm_utils_inet6_ntop (&lnk->remote, buffer),
|
||||
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);
|
||||
|
|
@ -1400,7 +1408,8 @@ nmtstp_link_ipip_add (NMPlatform *platform,
|
|||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
gboolean success;
|
||||
char buffer[INET_ADDRSTRLEN];
|
||||
char b1[INET_ADDRSTRLEN];
|
||||
char b2[INET_ADDRSTRLEN];
|
||||
|
||||
g_assert (nm_utils_is_valid_iface_name (name, NULL));
|
||||
|
||||
|
|
@ -1417,8 +1426,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, NULL),
|
||||
nm_utils_inet4_ntop (lnk->remote, buffer),
|
||||
nm_utils_inet4_ntop (lnk->local, b1),
|
||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
||||
lnk->ttl,
|
||||
lnk->tos,
|
||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
||||
|
|
@ -1488,7 +1497,8 @@ nmtstp_link_sit_add (NMPlatform *platform,
|
|||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
gboolean success;
|
||||
char buffer[INET_ADDRSTRLEN];
|
||||
char b1[INET_ADDRSTRLEN];
|
||||
char b2[INET_ADDRSTRLEN];
|
||||
|
||||
g_assert (nm_utils_is_valid_iface_name (name, NULL));
|
||||
|
||||
|
|
@ -1510,8 +1520,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, NULL),
|
||||
nm_utils_inet4_ntop (lnk->remote, buffer),
|
||||
nm_utils_inet4_ntop (lnk->local, b1),
|
||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
||||
lnk->ttl,
|
||||
lnk->tos,
|
||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
||||
|
|
@ -1607,27 +1617,32 @@ nmtstp_link_vxlan_add (NMPlatform *platform,
|
|||
|
||||
if (external_command) {
|
||||
gs_free char *dev = NULL;
|
||||
gs_free char *local = NULL, *remote = NULL;
|
||||
char local[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char group[NM_UTILS_INET_ADDRSTRLEN];
|
||||
|
||||
if (lnk->parent_ifindex)
|
||||
dev = g_strdup_printf ("dev %s", nm_platform_link_get_name (platform, lnk->parent_ifindex));
|
||||
|
||||
if (lnk->local)
|
||||
local = g_strdup_printf ("%s", nm_utils_inet4_ntop (lnk->local, NULL));
|
||||
nm_utils_inet4_ntop (lnk->local, local);
|
||||
else if (memcmp (&lnk->local6, &in6addr_any, sizeof (in6addr_any)))
|
||||
local = g_strdup_printf ("%s", nm_utils_inet6_ntop (&lnk->local6, NULL));
|
||||
nm_utils_inet6_ntop (&lnk->local6, local);
|
||||
else
|
||||
local[0] = '\0';
|
||||
|
||||
if (lnk->group)
|
||||
remote = g_strdup_printf ("%s", nm_utils_inet4_ntop (lnk->group, NULL));
|
||||
nm_utils_inet4_ntop (lnk->group, group);
|
||||
else if (memcmp (&lnk->group6, &in6addr_any, sizeof (in6addr_any)))
|
||||
remote = g_strdup_printf ("%s", nm_utils_inet6_ntop (&lnk->group6, NULL));
|
||||
nm_utils_inet6_ntop (&lnk->group6, group);
|
||||
else
|
||||
group[0] = '\0';
|
||||
|
||||
err = nmtstp_run_command ("ip link add %s type vxlan id %u %s local %s group %s ttl %u tos %02x dstport %u srcport %u %u ageing %u",
|
||||
name,
|
||||
lnk->id,
|
||||
dev ?: "",
|
||||
local,
|
||||
remote,
|
||||
group,
|
||||
lnk->ttl,
|
||||
lnk->tos,
|
||||
lnk->dst_port,
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ read_full_ip4_address (shvarFile *ifcfg,
|
|||
&has_key, &a, error))
|
||||
return FALSE;
|
||||
if (has_key)
|
||||
*out_gateway = g_strdup (nm_utils_inet4_ntop (a, inet_buf));
|
||||
*out_gateway = nm_utils_inet4_ntop_dup (a);
|
||||
}
|
||||
|
||||
/* Prefix */
|
||||
|
|
@ -1529,7 +1529,6 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
gboolean never_default;
|
||||
gint64 timeout;
|
||||
int priority;
|
||||
char inet_buf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
const char *const *item;
|
||||
guint32 route_table;
|
||||
|
||||
|
|
@ -1681,7 +1680,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
PARSE_WARNING ("ignoring GATEWAY (/etc/sysconfig/network) for %s "
|
||||
"because the connection has no static addresses", f);
|
||||
} else
|
||||
gateway = g_strdup (nm_utils_inet4_ntop (a, inet_buf));
|
||||
gateway = nm_utils_inet4_ntop_dup (a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -981,15 +981,16 @@ print_vpn_config (NMVpnConnection *self)
|
|||
const NMPlatformIP6Address *address6;
|
||||
char *dns_domain = NULL;
|
||||
guint32 num, i;
|
||||
char buf[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b1[NM_UTILS_INET_ADDRSTRLEN];
|
||||
char b2[NM_UTILS_INET_ADDRSTRLEN];
|
||||
NMDedupMultiIter ipconf_iter;
|
||||
|
||||
if (priv->ip4_external_gw) {
|
||||
_LOGI ("Data: VPN Gateway: %s",
|
||||
nm_utils_inet4_ntop (priv->ip4_external_gw, NULL));
|
||||
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, NULL));
|
||||
nm_utils_inet6_ntop (priv->ip6_external_gw, b1));
|
||||
}
|
||||
|
||||
_LOGI ("Data: Tunnel Device: %s%s%s", NM_PRINT_FMT_QUOTE_STRING (priv->ip_iface));
|
||||
|
|
@ -1003,22 +1004,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, NULL));
|
||||
_LOGI ("Data: Internal Address: %s", address4 ? nm_utils_inet4_ntop (address4->address, NULL) : "??");
|
||||
_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, NULL));
|
||||
_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, NULL),
|
||||
nm_utils_inet4_ntop (route->network, b1),
|
||||
route->plen,
|
||||
nm_utils_inet4_ntop (route->gateway, buf));
|
||||
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), NULL));
|
||||
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)
|
||||
|
|
@ -1037,22 +1038,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, NULL));
|
||||
_LOGI ("Data: Internal Address: %s", nm_utils_inet6_ntop (&address6->address, NULL));
|
||||
_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, NULL));
|
||||
_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, NULL),
|
||||
nm_utils_inet6_ntop (&route->network, b1),
|
||||
route->plen,
|
||||
nm_utils_inet6_ntop (&route->gateway, buf));
|
||||
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), NULL));
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue