mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 04:24:32 +00:00
all: use _nm_utils_inet4_ntop() instead of nm_utils_inet4_ntop()
and _nm_utils_inet6_ntop() instead of nm_utils_inet6_ntop(). nm_utils_inet4_ntop()/nm_utils_inet6_ntop() are public API of libnm. For one, that means they are only available in code that links with libnm/libnm-core. But such basic helpers should be available everywhere. Also, they accept NULL as destination buffers. We keep that behavior for potential libnm users, but internally we never want to use the static buffers. This patch needs to take care that there are no callers of _nm_utils_inet[46]_ntop() that pass NULL buffers. Also, _nm_utils_inet[46]_ntop() are inline functions and the compiler can get rid of them. We should consistently use the same variant of the helper. The only downside is that the "good" name is already taken. The leading underscore is rather ugly and inconsistent. Also, with our internal variants we can use "static array indices in function parameter declarations" next. Thereby the compiler helps to ensure that the provided buffers are of the right size.
This commit is contained in:
parent
c0bd6752b9
commit
cd0863a339
|
@ -335,7 +335,7 @@ _nmc_mangle_connection (NMDevice *device,
|
||||||
entry = nm_ip_routing_rule_new (AF_INET);
|
entry = nm_ip_routing_rule_new (AF_INET);
|
||||||
nm_ip_routing_rule_set_priority (entry, rt_table);
|
nm_ip_routing_rule_set_priority (entry, rt_table);
|
||||||
nm_ip_routing_rule_set_from (entry,
|
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);
|
32);
|
||||||
nm_ip_routing_rule_set_table (entry, rt_table);
|
nm_ip_routing_rule_set_table (entry, rt_table);
|
||||||
|
|
||||||
|
|
|
@ -999,7 +999,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
|
||||||
|
|
||||||
if ( inet_pton (AF_INET6, token, &i6_token) == 1
|
if ( inet_pton (AF_INET6, token, &i6_token) == 1
|
||||||
&& _nm_utils_inet6_is_token (&i6_token)) {
|
&& _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)) {
|
if (g_strcmp0 (token, normalized)) {
|
||||||
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, normalized, NULL);
|
g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, normalized, NULL);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
|
|
|
@ -235,7 +235,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||||
return FALSE;
|
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;
|
token_needs_normalization = TRUE;
|
||||||
} else {
|
} else {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
|
|
|
@ -8341,8 +8341,8 @@ test_nm_ip_addr_zero (void)
|
||||||
g_assert (memcmp (&nm_ip_addr_zero, &a4, sizeof (a4)) == 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 (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_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_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_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_assert_cmpstr (nm_utils_inet_ntop (AF_INET6, &nm_ip_addr_zero, buf), ==, "::");
|
||||||
|
|
|
@ -184,12 +184,12 @@ acd_event (int fd,
|
||||||
r = n_acd_probe_announce (info->probe, N_ACD_DEFEND_ONCE);
|
r = n_acd_probe_announce (info->probe, N_ACD_DEFEND_ONCE);
|
||||||
if (r) {
|
if (r) {
|
||||||
_LOGW ("couldn't announce address %s on interface '%s': %s",
|
_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),
|
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
|
||||||
acd_error_to_string (r));
|
acd_error_to_string (r));
|
||||||
} else {
|
} else {
|
||||||
_LOGD ("announcing address %s",
|
_LOGD ("announcing address %s",
|
||||||
nm_utils_inet4_ntop (info->address, address_str));
|
_nm_utils_inet4_ntop (info->address, address_str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_probing_done = TRUE;
|
check_probing_done = TRUE;
|
||||||
|
@ -202,14 +202,14 @@ acd_event (int fd,
|
||||||
case N_ACD_EVENT_DEFENDED:
|
case N_ACD_EVENT_DEFENDED:
|
||||||
n_acd_probe_get_userdata (event->defended.probe, (void **) &info);
|
n_acd_probe_get_userdata (event->defended.probe, (void **) &info);
|
||||||
_LOGD ("defended address %s from host %s",
|
_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,
|
(hwaddr_str = nm_utils_hwaddr_ntoa (event->defended.sender,
|
||||||
event->defended.n_sender)));
|
event->defended.n_sender)));
|
||||||
break;
|
break;
|
||||||
case N_ACD_EVENT_CONFLICT:
|
case N_ACD_EVENT_CONFLICT:
|
||||||
n_acd_probe_get_userdata (event->conflict.probe, (void **) &info);
|
n_acd_probe_get_userdata (event->conflict.probe, (void **) &info);
|
||||||
_LOGW ("conflict for address %s detected with host %s on interface '%s'",
|
_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,
|
(hwaddr_str = nm_utils_hwaddr_ntoa (event->defended.sender,
|
||||||
event->defended.n_sender)),
|
event->defended.n_sender)),
|
||||||
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex));
|
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);
|
r = n_acd_probe_config_new (&probe_config);
|
||||||
if (r) {
|
if (r) {
|
||||||
_LOGW ("could not create probe config for %s on interface '%s': %s",
|
_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),
|
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
|
||||||
acd_error_to_string (r));
|
acd_error_to_string (r));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -261,7 +261,7 @@ acd_probe_add (NMAcdManager *self,
|
||||||
r = n_acd_probe (self->acd, &info->probe, probe_config);
|
r = n_acd_probe (self->acd, &info->probe, probe_config);
|
||||||
if (r) {
|
if (r) {
|
||||||
_LOGW ("could not start probe for %s on interface '%s': %s",
|
_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),
|
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
|
||||||
acd_error_to_string (r));
|
acd_error_to_string (r));
|
||||||
n_acd_probe_config_free (probe_config);
|
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);
|
r = n_acd_probe_announce (info->probe, N_ACD_DEFEND_ONCE);
|
||||||
if (r) {
|
if (r) {
|
||||||
_LOGW ("couldn't announce address %s on interface '%s': %s",
|
_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),
|
nm_platform_link_get_name (NM_PLATFORM_GET, self->ifindex),
|
||||||
acd_error_to_string (r));
|
acd_error_to_string (r));
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
} else
|
} else
|
||||||
_LOGD ("announcing address %s", nm_utils_inet4_ntop (info->address, sbuf));
|
_LOGD ("announcing address %s", _nm_utils_inet4_ntop (info->address, sbuf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 (!address_matches (nm_setting_vxlan_get_remote (s_vxlan), priv->props.group, &priv->props.group6)) {
|
||||||
if (priv->props.group) {
|
if (priv->props.group) {
|
||||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_REMOTE,
|
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);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_REMOTE,
|
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);
|
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 (!address_matches (nm_setting_vxlan_get_local (s_vxlan), priv->props.local, &priv->props.local6)) {
|
||||||
if (priv->props.local) {
|
if (priv->props.local) {
|
||||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_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);
|
NULL);
|
||||||
} else if (memcmp (&priv->props.local6, &in6addr_any, sizeof (in6addr_any))) {
|
} else if (memcmp (&priv->props.local6, &in6addr_any, sizeof (in6addr_any))) {
|
||||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_LOCAL,
|
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);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7172,7 +7172,7 @@ acd_manager_probe_terminated (NMAcdManager *acd_manager, gpointer user_data)
|
||||||
_NMLOG (result ? LOGL_DEBUG : LOGL_WARN,
|
_NMLOG (result ? LOGL_DEBUG : LOGL_WARN,
|
||||||
LOGD_DEVICE,
|
LOGD_DEVICE,
|
||||||
"IPv4 DAD result: address %s is %s",
|
"IPv4 DAD result: address %s is %s",
|
||||||
nm_utils_inet4_ntop (address->address, sbuf),
|
_nm_utils_inet4_ntop (address->address, sbuf),
|
||||||
result ? "unique" : "duplicate");
|
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));
|
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)",
|
_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);
|
subnet->preferred);
|
||||||
|
|
||||||
/* This also updates the ndisc if there are actual changes. */
|
/* 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",
|
_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_has = TRUE;
|
||||||
priv->ipv6ll_addr = lladdr;
|
priv->ipv6ll_addr = lladdr;
|
||||||
ip_config_merge_and_apply (self, AF_INET6, TRUE);
|
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);
|
g_return_val_if_fail (req, FALSE);
|
||||||
|
|
||||||
netmask = _nm_utils_ip4_prefix_to_netmask (ip4_addr->plen);
|
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;
|
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, "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);
|
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) {
|
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);
|
gw = nm_ip4_config_best_default_route_get (priv->ip_config_4);
|
||||||
if (gw) {
|
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);
|
ping_binary = nm_utils_find_helper ("ping", "/usr/bin/ping", NULL);
|
||||||
log_domain = LOGD_IP4;
|
log_domain = LOGD_IP4;
|
||||||
}
|
}
|
||||||
} else if (priv->ip_config_6 && priv->ip_state_6 == NM_DEVICE_IP_STATE_DONE) {
|
} 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);
|
gw = nm_ip6_config_best_default_route_get (priv->ip_config_6);
|
||||||
if (gw) {
|
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);
|
ping_binary = nm_utils_find_helper ("ping6", "/usr/bin/ping6", NULL);
|
||||||
log_domain = LOGD_IP6;
|
log_domain = LOGD_IP6;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
g_error ("expected check for address #%d (%s) to %s, but it didn't",
|
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");
|
info->expected_result[i] ? "detect no duplicated" : "detect a duplicate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
|
||||||
return FALSE;
|
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);
|
a_plen = nm_utils_ip4_netmask_to_prefix (a_netmask.s_addr);
|
||||||
|
|
||||||
nm_dhcp_option_add_option (options,
|
nm_dhcp_option_add_option (options,
|
||||||
|
@ -416,7 +416,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
|
||||||
nm_dhcp_option_add_option (options,
|
nm_dhcp_option_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
|
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_add_option_u64 (options,
|
||||||
_nm_dhcp_option_dhcp4_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);
|
n_dhcp4_client_lease_get_siaddr (lease, &a_next_server);
|
||||||
if (a_next_server.s_addr != INADDR_ANY) {
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
|
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)) {
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||||
|
|
||||||
if ( addr.s_addr == 0
|
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)) {
|
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 (dest.s_addr, dest_str);
|
||||||
nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
|
_nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
|
||||||
|
|
||||||
g_string_append_printf (nm_gstring_add_space_delimiter (str),
|
g_string_append_printf (nm_gstring_add_space_delimiter (str),
|
||||||
"%s/%d %s",
|
"%s/%d %s",
|
||||||
|
@ -564,8 +564,8 @@ lease_parse_routes (NDhcp4ClientLease *lease,
|
||||||
|
|
||||||
while (lease_option_next_route (&dest, &plen, &gateway, FALSE, &data, &n_data)) {
|
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 (dest.s_addr, dest_str);
|
||||||
nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
|
_nm_utils_inet4_ntop (gateway.s_addr, gateway_str);
|
||||||
|
|
||||||
g_string_append_printf (nm_gstring_add_space_delimiter (str),
|
g_string_append_printf (nm_gstring_add_space_delimiter (str),
|
||||||
"%s/%d %s",
|
"%s/%d %s",
|
||||||
|
@ -610,7 +610,7 @@ lease_parse_routes (NDhcp4ClientLease *lease,
|
||||||
nm_gstring_prepare (&str);
|
nm_gstring_prepare (&str);
|
||||||
|
|
||||||
while (lease_option_next_in_addr (&gateway, &data, &n_data)) {
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), s);
|
||||||
|
|
||||||
if (gateway.s_addr == 0) {
|
if (gateway.s_addr == 0) {
|
||||||
|
@ -709,7 +709,7 @@ lease_parse_ntps (NDhcp4ClientLease *lease,
|
||||||
nm_gstring_prepare (&str);
|
nm_gstring_prepare (&str);
|
||||||
|
|
||||||
while (lease_option_next_in_addr (&addr, &data, &n_data)) {
|
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);
|
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;
|
return;
|
||||||
|
|
||||||
g_string_append_printf (new_contents,
|
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,
|
if (!g_file_set_contents (lease_file,
|
||||||
new_contents->str,
|
new_contents->str,
|
||||||
|
|
|
@ -128,7 +128,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
||||||
|
|
||||||
options = out_options ? nm_dhcp_option_create_options_dict () : NULL;
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS,
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_SUBNET_MASK,
|
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_add_option_u64 (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
|
@ -150,7 +150,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
||||||
(guint64) (ts_time + a_lifetime));
|
(guint64) (ts_time + a_lifetime));
|
||||||
|
|
||||||
if (sd_dhcp_lease_get_next_server (lease, &a_next_server) == 0) {
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
|
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) {
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_SERVER_ID,
|
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) {
|
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_add_option (options,
|
||||||
_nm_dhcp_option_dhcp4_options,
|
_nm_dhcp_option_dhcp4_options,
|
||||||
NM_DHCP_OPTION_DHCP4_BROADCAST,
|
NM_DHCP_OPTION_DHCP4_BROADCAST,
|
||||||
|
@ -188,7 +188,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
nm_gstring_prepare (&str);
|
nm_gstring_prepare (&str);
|
||||||
for (i = 0; i < num; i++) {
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||||
|
|
||||||
if ( addr_list[i].s_addr == 0
|
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,
|
network_net = nm_utils_ip4_address_clear_host_address (r_network.s_addr,
|
||||||
r_plen);
|
r_plen);
|
||||||
nm_utils_inet4_ntop (network_net, network_net_str);
|
_nm_utils_inet4_ntop (network_net, network_net_str);
|
||||||
nm_utils_inet4_ntop (r_gateway.s_addr, gateway_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
|
g_string_append_printf (nm_gstring_add_space_delimiter ( option == NM_DHCP_OPTION_DHCP4_CLASSLESS_STATIC_ROUTE
|
||||||
? str_classless
|
? str_classless
|
||||||
|
@ -359,7 +359,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
guint32 m;
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), s);
|
||||||
|
|
||||||
if (a_router[i].s_addr == 0) {
|
if (a_router[i].s_addr == 0) {
|
||||||
|
@ -411,7 +411,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
nm_gstring_prepare (&str);
|
nm_gstring_prepare (&str);
|
||||||
for (i = 0; i < num; i++) {
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||||
}
|
}
|
||||||
nm_dhcp_option_add_option (options,
|
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_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);
|
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||||
};
|
};
|
||||||
if (str->len)
|
if (str->len)
|
||||||
|
@ -772,7 +772,7 @@ lease_to_ip6_config (NMDedupMultiIndex *multi_idx,
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
nm_gstring_prepare (&str);
|
nm_gstring_prepare (&str);
|
||||||
for (i = 0; i < num; i++) {
|
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);
|
g_string_append (nm_gstring_add_space_delimiter (str), addr_str);
|
||||||
nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
|
nm_ip6_config_add_nameserver (ip6_config, &dns[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,9 +181,9 @@ ip4_process_dhclient_rfc3442_routes (const char *iface,
|
||||||
nm_ip4_config_add_route (ip4_config, &route, NULL);
|
nm_ip4_config_add_route (ip4_config, &route, NULL);
|
||||||
|
|
||||||
_LOG2I (LOGD_DHCP4, iface, " classless static route %s/%d gw %s",
|
_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,
|
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);
|
process_classful_routes (iface, options, route_table, route_metric, ip4_config);
|
||||||
|
|
||||||
if (gateway) {
|
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;
|
gateway_has = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* If the gateway wasn't provided as a classless static route with a
|
/* If the gateway wasn't provided as a classless static route with a
|
||||||
|
|
|
@ -726,9 +726,9 @@ ip_addr_to_string (int addr_family, gconstpointer addr, const char *iface, char
|
||||||
separator = "@";
|
separator = "@";
|
||||||
} else {
|
} else {
|
||||||
if (IN6_IS_ADDR_V4MAPPED (addr))
|
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
|
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,
|
/* Need to scope link-local addresses with %<zone-id>. Before dnsmasq 2.58,
|
||||||
* only '@' was supported as delimiter. Since 2.58, '@' and '%' are
|
* only '@' was supported as delimiter. Since 2.58, '@' and '%' are
|
||||||
* supported. Due to a bug, since 2.73 only '%' works properly as "server"
|
* supported. Due to a bug, since 2.73 only '%' works properly as "server"
|
||||||
|
|
|
@ -425,9 +425,9 @@ merge_one_ip_config (NMResolvConfData *rc,
|
||||||
if (addr_family == AF_INET)
|
if (addr_family == AF_INET)
|
||||||
nm_utils_inet_ntop (addr_family, addr, buf);
|
nm_utils_inet_ntop (addr_family, addr, buf);
|
||||||
else if (IN6_IS_ADDR_V4MAPPED (addr))
|
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 {
|
else {
|
||||||
nm_utils_inet6_ntop (&addr->addr6, buf);
|
_nm_utils_inet6_ntop (&addr->addr6, buf);
|
||||||
if (IN6_IS_ADDR_LINKLOCAL (addr)) {
|
if (IN6_IS_ADDR_LINKLOCAL (addr)) {
|
||||||
const char *ifname;
|
const char *ifname;
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ merge_one_ip_config (NMResolvConfData *rc,
|
||||||
num = nm_ip4_config_get_num_nis_servers (ip4_config);
|
num = nm_ip4_config_get_num_nis_servers (ip4_config);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
add_string_item (rc->nis_servers,
|
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);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ create_dm_cmd_line (const char *iface,
|
||||||
*/
|
*/
|
||||||
nm_strv_ptrarray_add_string_dup (cmd, "--strict-order");
|
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);
|
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");
|
g_string_append (s, "--dhcp-option=option:dns-server");
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
g_string_append_c (s, ',');
|
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);
|
nm_strv_ptrarray_take_gstring (cmd, &s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,9 +95,8 @@ nm_dnsmasq_utils_get_range (const NMPlatformIP4Address *addr,
|
||||||
first = htonl (first);
|
first = htonl (first);
|
||||||
last = htonl (last);
|
last = htonl (last);
|
||||||
|
|
||||||
nm_utils_inet4_ntop (first, out_first);
|
_nm_utils_inet4_ntop (first, out_first);
|
||||||
nm_utils_inet4_ntop (last, out_last);
|
_nm_utils_inet4_ntop (last, out_last);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)) {
|
if (IN6_ARE_ADDR_EQUAL (&item->address, address)) {
|
||||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
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;
|
changed = TRUE;
|
||||||
if (!complete_address (ndisc, item)) {
|
if (!complete_address (ndisc, item)) {
|
||||||
g_array_remove_index (rdata->addresses, i);
|
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));
|
inet_ntop (AF_INET6, &route->network, addrstr, sizeof (addrstr));
|
||||||
_LOGD (" route %s/%u via %s pref %s exp %s", addrstr, (guint) route->plen,
|
_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)),
|
nm_icmpv6_router_pref_to_string (route->preference, str_pref, sizeof (str_pref)),
|
||||||
get_exp (str_exp, now_ns, route));
|
get_exp (str_exp, now_ns, route));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3003,8 +3003,9 @@ nm_utils_inet6_interface_identifier_to_token (NMUtilsIPv6IfaceId iid, char *buf)
|
||||||
{
|
{
|
||||||
struct in6_addr i6_token = { .s6_addr = { 0, } };
|
struct in6_addr i6_token = { .s6_addr = { 0, } };
|
||||||
|
|
||||||
|
nm_assert (buf);
|
||||||
nm_utils_ipv6_addr_set_interface_identifier (&i6_token, iid);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1097,8 +1097,8 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
|
||||||
&& nm_setting_ip_config_get_num_addresses (s_ip4) > 0) {
|
&& nm_setting_ip_config_get_num_addresses (s_ip4) > 0) {
|
||||||
g_object_set (s_ip4,
|
g_object_set (s_ip4,
|
||||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||||
nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
|
_nm_utils_inet4_ntop (NMP_OBJECT_CAST_IP4_ROUTE (priv->best_default_route)->gateway,
|
||||||
sbuf),
|
sbuf),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1133,7 +1133,7 @@ nm_ip4_config_create_setting (const NMIP4Config *self)
|
||||||
for (i = 0; i < nnameservers; i++) {
|
for (i = 0; i < nnameservers; i++) {
|
||||||
guint32 nameserver = nm_ip4_config_get_nameserver (self, 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++) {
|
for (i = 0; i < nsearches; i++) {
|
||||||
const char *search = nm_ip4_config_get_search (self, 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_init (&addr_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_add (&addr_builder, "{sv}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"address",
|
"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}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"prefix",
|
"prefix",
|
||||||
g_variant_new_uint32 (address->plen));
|
g_variant_new_uint32 (address->plen));
|
||||||
if (address->peer_address != address->address) {
|
if (address->peer_address != address->address) {
|
||||||
g_variant_builder_add (&addr_builder, "{sv}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"peer",
|
"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) {
|
if (*address->label) {
|
||||||
|
@ -3158,14 +3158,14 @@ out_addresses_cached:
|
||||||
g_variant_builder_init (&route_builder, G_VARIANT_TYPE ("a{sv}"));
|
g_variant_builder_init (&route_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_add (&route_builder, "{sv}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"dest",
|
"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}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"prefix",
|
"prefix",
|
||||||
g_variant_new_uint32 (route->plen));
|
g_variant_new_uint32 (route->plen));
|
||||||
if (route->gateway) {
|
if (route->gateway) {
|
||||||
g_variant_builder_add (&route_builder, "{sv}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"next-hop",
|
"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}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"metric",
|
"metric",
|
||||||
|
@ -3218,8 +3218,8 @@ out_routes_cached:
|
||||||
for (i = 0; i < priv->nameservers->len; i++) {
|
for (i = 0; i < priv->nameservers->len; i++) {
|
||||||
GVariantBuilder nested_builder;
|
GVariantBuilder nested_builder;
|
||||||
|
|
||||||
nm_utils_inet4_ntop (g_array_index (priv->nameservers, in_addr_t, i),
|
_nm_utils_inet4_ntop (g_array_index (priv->nameservers, in_addr_t, i),
|
||||||
addr_str);
|
addr_str);
|
||||||
|
|
||||||
g_variant_builder_init (&nested_builder, G_VARIANT_TYPE ("a{sv}"));
|
g_variant_builder_init (&nested_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_add (&nested_builder, "{sv}",
|
g_variant_builder_add (&nested_builder, "{sv}",
|
||||||
|
@ -3255,8 +3255,8 @@ out_routes_cached:
|
||||||
for (i = 0; i < priv->wins->len; i++) {
|
for (i = 0; i < priv->wins->len; i++) {
|
||||||
g_variant_builder_add (&builder_data,
|
g_variant_builder_add (&builder_data,
|
||||||
"s",
|
"s",
|
||||||
nm_utils_inet4_ntop (g_array_index (priv->wins, in_addr_t, i),
|
_nm_utils_inet4_ntop (g_array_index (priv->wins, in_addr_t, i),
|
||||||
addr_str));
|
addr_str));
|
||||||
}
|
}
|
||||||
g_value_take_variant (value,
|
g_value_take_variant (value,
|
||||||
g_variant_builder_end (&builder_data));
|
g_variant_builder_end (&builder_data));
|
||||||
|
|
|
@ -764,8 +764,8 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
|
||||||
&& nm_setting_ip_config_get_num_addresses (s_ip6) > 0) {
|
&& nm_setting_ip_config_get_num_addresses (s_ip6) > 0) {
|
||||||
g_object_set (s_ip6,
|
g_object_set (s_ip6,
|
||||||
NM_SETTING_IP_CONFIG_GATEWAY,
|
NM_SETTING_IP_CONFIG_GATEWAY,
|
||||||
nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
|
_nm_utils_inet6_ntop (&NMP_OBJECT_CAST_IP6_ROUTE (priv->best_default_route)->gateway,
|
||||||
sbuf),
|
sbuf),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,7 +807,7 @@ nm_ip6_config_create_setting (const NMIP6Config *self)
|
||||||
for (i = 0; i < nnameservers; i++) {
|
for (i = 0; i < nnameservers; i++) {
|
||||||
const struct in6_addr *nameserver = nm_ip6_config_get_nameserver (self, 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++) {
|
for (i = 0; i < nsearches; i++) {
|
||||||
const char *search = nm_ip6_config_get_search (self, 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_init (&addr_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_add (&addr_builder, "{sv}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"address",
|
"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}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"prefix",
|
"prefix",
|
||||||
g_variant_new_uint32 (address->plen));
|
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)) {
|
&& !IN6_ARE_ADDR_EQUAL (&address->peer_address, &address->address)) {
|
||||||
g_variant_builder_add (&addr_builder, "{sv}",
|
g_variant_builder_add (&addr_builder, "{sv}",
|
||||||
"peer",
|
"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);
|
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_init (&route_builder, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_add (&route_builder, "{sv}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"dest",
|
"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}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"prefix",
|
"prefix",
|
||||||
g_variant_new_uint32 (route->plen));
|
g_variant_new_uint32 (route->plen));
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED (&route->gateway)) {
|
if (!IN6_IS_ADDR_UNSPECIFIED (&route->gateway)) {
|
||||||
g_variant_builder_add (&route_builder, "{sv}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
"next-hop",
|
"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}",
|
g_variant_builder_add (&route_builder, "{sv}",
|
||||||
|
|
|
@ -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) {
|
nm_ip_config_iter_ip4_address_for_each (&ipconf_iter, (NMIP4Config *) ip_config, &address) {
|
||||||
cidr = g_strdup_printf ("%s/%u",
|
cidr = g_strdup_printf ("%s/%u",
|
||||||
nm_utils_inet4_ntop (address->address, sbuf),
|
_nm_utils_inet4_ntop (address->address, sbuf),
|
||||||
address->plen);
|
address->plen);
|
||||||
g_ptr_array_add (domains, cidr);
|
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) {
|
nm_ip_config_iter_ip6_address_for_each (&ipconf_iter, (NMIP6Config *) ip_config, &address) {
|
||||||
cidr = g_strdup_printf ("%s/%u",
|
cidr = g_strdup_printf ("%s/%u",
|
||||||
nm_utils_inet6_ntop (&address->address, sbuf),
|
_nm_utils_inet6_ntop (&address->address, sbuf),
|
||||||
address->plen);
|
address->plen);
|
||||||
g_ptr_array_add (domains, cidr);
|
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))
|
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
|
||||||
continue;
|
continue;
|
||||||
cidr = g_strdup_printf ("%s/%u",
|
cidr = g_strdup_printf ("%s/%u",
|
||||||
nm_utils_inet4_ntop (routes->network, sbuf),
|
_nm_utils_inet4_ntop (routes->network, sbuf),
|
||||||
routes->plen);
|
routes->plen);
|
||||||
g_ptr_array_add (domains, cidr);
|
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))
|
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT (routes))
|
||||||
continue;
|
continue;
|
||||||
cidr = g_strdup_printf ("%s/%u",
|
cidr = g_strdup_printf ("%s/%u",
|
||||||
nm_utils_inet6_ntop (&routes->network, sbuf),
|
_nm_utils_inet6_ntop (&routes->network, sbuf),
|
||||||
routes->plen);
|
routes->plen);
|
||||||
g_ptr_array_add (domains, cidr);
|
g_ptr_array_add (domains, cidr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ clear_ip6_prefix_delegation (gpointer data)
|
||||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||||
|
|
||||||
_LOGD (LOGD_IP6, "ipv6-pd: undelegating prefix %s/%d",
|
_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);
|
delegation->prefix.plen);
|
||||||
|
|
||||||
g_hash_table_foreach (delegation->subnets, _clear_ip6_subnet, NULL);
|
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. */
|
/* Check for out-of-prefixes condition. */
|
||||||
if (delegation->next_subnet >= (1 << (64 - delegation->prefix.plen))) {
|
if (delegation->next_subnet >= (1 << (64 - delegation->prefix.plen))) {
|
||||||
_LOGD (LOGD_IP6, "ipv6-pd: no more prefixes in %s/%d",
|
_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);
|
delegation->prefix.plen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ ip6_subnet_from_delegation (IP6PrefixDelegation *delegation, NMDevice *device)
|
||||||
subnet->preferred = delegation->prefix.preferred;
|
subnet->preferred = delegation->prefix.preferred;
|
||||||
|
|
||||||
_LOGD (LOGD_IP6, "ipv6-pd: %s allocated from a /%d prefix on %s",
|
_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,
|
delegation->prefix.plen,
|
||||||
nm_device_get_iface (device));
|
nm_device_get_iface (device));
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ device_ip6_prefix_delegated (NMDevice *device,
|
||||||
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
char sbuf[NM_UTILS_INET_ADDRSTRLEN];
|
||||||
|
|
||||||
_LOGI (LOGD_IP6, "ipv6-pd: received a prefix %s/%d from %s",
|
_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,
|
prefix->plen,
|
||||||
nm_device_get_iface (device));
|
nm_device_get_iface (device));
|
||||||
|
|
||||||
|
|
|
@ -1237,10 +1237,10 @@ ip_route_add (NMPlatform *platform,
|
||||||
|
|
||||||
if (addr_family == AF_INET) {
|
if (addr_family == AF_INET) {
|
||||||
nm_log_warn (LOGD_PLATFORM, "Fake platform: failure adding ip4-route '%d: %s/%d %d': Network Unreachable",
|
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 {
|
} else {
|
||||||
nm_log_warn (LOGD_PLATFORM, "Fake platform: failure adding ip6-route '%d: %s/%d %d': Network Unreachable",
|
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;
|
return -NME_UNSPEC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
g_return_val_if_fail (plen <= 32, FALSE);
|
||||||
|
|
||||||
_LOG3D ("address: deleting IPv4 address %s/%d, %s%s",
|
_LOG3D ("address: deleting IPv4 address %s/%d, %s%s",
|
||||||
nm_utils_inet4_ntop (address, b1),
|
_nm_utils_inet4_ntop (address, b1),
|
||||||
plen,
|
plen,
|
||||||
peer_address != address
|
peer_address != address
|
||||||
? nm_sprintf_buf (str_peer,
|
? nm_sprintf_buf (str_peer,
|
||||||
"peer %s, ",
|
"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)));
|
_to_string_dev (self, ifindex, str_dev, sizeof (str_dev)));
|
||||||
return klass->ip4_address_delete (self, ifindex, address, plen, peer_address);
|
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);
|
g_return_val_if_fail (plen <= 128, FALSE);
|
||||||
|
|
||||||
_LOG3D ("address: deleting IPv6 address %s/%d, %s",
|
_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)));
|
_to_string_dev (self, ifindex, str_dev, sizeof (str_dev)));
|
||||||
return klass->ip6_address_delete (self, ifindex, address, plen);
|
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 */
|
"%s" /* okey */
|
||||||
"",
|
"",
|
||||||
lnk->is_tap ? "tap" : "",
|
lnk->is_tap ? "tap" : "",
|
||||||
lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
|
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->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->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->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->tos ? (lnk->tos == 1 ? " tos inherit" : nm_sprintf_buf (str_tos, " tos 0x%x", lnk->tos)) : "",
|
||||||
lnk->path_mtu_discovery ? "" : " nopmtudisc",
|
lnk->path_mtu_discovery ? "" : " nopmtudisc",
|
||||||
lnk->input_flags ? nm_sprintf_buf (str_input_flags, " iflags 0x%x", lnk->input_flags) : "",
|
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) : "",
|
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->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->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;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5323,8 +5323,8 @@ nm_platform_lnk_ip6tnl_to_string (const NMPlatformLnkIp6Tnl *lnk, char *buf, gsi
|
||||||
" flags 0x%x"
|
" flags 0x%x"
|
||||||
"",
|
"",
|
||||||
str_type,
|
str_type,
|
||||||
nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet6_ntop (&lnk->remote, str_remote1)),
|
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_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->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->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),
|
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" /* tos */
|
||||||
"%s" /* path_mtu_discovery */
|
"%s" /* path_mtu_discovery */
|
||||||
"",
|
"",
|
||||||
lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
|
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->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->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->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->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" /* flags */
|
||||||
"%s" /* proto */
|
"%s" /* proto */
|
||||||
"",
|
"",
|
||||||
lnk->remote ? nm_sprintf_buf (str_remote, " remote %s", nm_utils_inet4_ntop (lnk->remote, str_remote1)) : "",
|
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->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->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->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->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),
|
g_snprintf (str_group, sizeof (str_group),
|
||||||
" %s %s",
|
" %s %s",
|
||||||
IN_MULTICAST (ntohl (lnk->group)) ? "group" : "remote",
|
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))
|
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->group6))
|
||||||
str_group6[0] = '\0';
|
str_group6[0] = '\0';
|
||||||
|
@ -5552,7 +5552,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
|
||||||
" %s%s %s",
|
" %s%s %s",
|
||||||
IN6_IS_ADDR_MULTICAST (&lnk->group6) ? "group" : "remote",
|
IN6_IS_ADDR_MULTICAST (&lnk->group6) ? "group" : "remote",
|
||||||
str_group[0] ? "6" : "", /* usually, a vxlan has either v4 or v6 only. */
|
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)
|
if (lnk->local == 0)
|
||||||
|
@ -5560,7 +5560,7 @@ nm_platform_lnk_vxlan_to_string (const NMPlatformLnkVxlan *lnk, char *buf, gsize
|
||||||
else {
|
else {
|
||||||
g_snprintf (str_local, sizeof (str_local),
|
g_snprintf (str_local, sizeof (str_local),
|
||||||
" local %s",
|
" local %s",
|
||||||
nm_utils_inet4_ntop (lnk->local, sbuf));
|
_nm_utils_inet4_ntop (lnk->local, sbuf));
|
||||||
}
|
}
|
||||||
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->local6))
|
if (IN6_IS_ADDR_UNSPECIFIED (&lnk->local6))
|
||||||
str_local6[0] = '\0';
|
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),
|
g_snprintf (str_local6, sizeof (str_local6),
|
||||||
" local%s %s",
|
" local%s %s",
|
||||||
str_local[0] ? "6" : "", /* usually, a vxlan has either v4 or v6 only. */
|
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,
|
g_snprintf (buf, len,
|
||||||
|
@ -6064,7 +6064,7 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route, char *buf, gsi
|
||||||
route->mss,
|
route->mss,
|
||||||
nmp_utils_ip_config_source_to_string (route->rt_source, s_source, sizeof (s_source)),
|
nmp_utils_ip_config_source_to_string (route->rt_source, s_source, sizeof (s_source)),
|
||||||
route->src_plen || !IN6_IS_ADDR_UNSPECIFIED (&route->src)
|
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),
|
_rtm_flags_to_string_full (str_rtm_flags, sizeof (str_rtm_flags), route->r_rtm_flags),
|
||||||
s_pref_src[0] ? " pref-src " : "",
|
s_pref_src[0] ? " pref-src " : "",
|
||||||
|
|
|
@ -233,13 +233,13 @@ nm_sock_addr_union_to_string (const NMSockAddrUnion *sa,
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
g_snprintf (buf, len,
|
g_snprintf (buf, len,
|
||||||
"%s:%u",
|
"%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));
|
(guint) htons (sa->in.sin_port));
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
g_snprintf (buf, len,
|
g_snprintf (buf, len,
|
||||||
"[%s%s]:%u",
|
"[%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
|
( sa->in6.sin6_scope_id != 0
|
||||||
? nm_sprintf_buf (s_scope_id, "%u", sa->in6.sin6_scope_id)
|
? 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; \
|
return buf; \
|
||||||
}
|
}
|
||||||
_vt_cmd_plobj_to_string_id (link, NMPlatformLink, "%d", obj->ifindex);
|
_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 ? "," : "",
|
||||||
obj->peer_address != obj->address ? nm_utils_inet4_ntop (nm_utils_ip4_address_clear_host_address (obj->peer_address, obj->plen), buf2) : "");
|
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 (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 (qdisc, NMPlatformQdisc, "%d: %d", obj->ifindex, obj->parent);
|
||||||
_vt_cmd_plobj_to_string_id (tfilter, NMPlatformTfilter, "%d: %d", obj->ifindex, obj->parent);
|
_vt_cmd_plobj_to_string_id (tfilter, NMPlatformTfilter, "%d: %d", obj->ifindex, obj->parent);
|
||||||
|
|
||||||
|
|
|
@ -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",
|
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,
|
file, line, func,
|
||||||
nm_utils_inet4_ntop (network, sbuf),
|
_nm_utils_inet4_ntop (network, sbuf),
|
||||||
plen,
|
plen,
|
||||||
metric,
|
metric,
|
||||||
tos,
|
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",
|
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,
|
file, line, func,
|
||||||
nm_utils_inet6_ntop (network, s_network),
|
_nm_utils_inet6_ntop (network, s_network),
|
||||||
plen,
|
plen,
|
||||||
metric,
|
metric,
|
||||||
nm_utils_inet6_ntop (src, s_src),
|
_nm_utils_inet6_ntop (src, s_src),
|
||||||
src_plen,
|
src_plen,
|
||||||
c_exists,
|
c_exists,
|
||||||
c);
|
c);
|
||||||
|
@ -831,12 +831,12 @@ _ip_address_add (NMPlatform *platform,
|
||||||
if ( peer_address->addr4 != address->addr4
|
if ( peer_address->addr4 != address->addr4
|
||||||
|| nmtst_get_rand_uint32 () % 2) {
|
|| nmtst_get_rand_uint32 () % 2) {
|
||||||
/* If the peer is the same as the local address, we can omit it. The result should be identical */
|
/* 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
|
} else
|
||||||
s_peer[0] = '\0';
|
s_peer[0] = '\0';
|
||||||
|
|
||||||
nmtstp_run_command_check ("ip address change %s%s/%d dev %s%s%s%s",
|
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,
|
s_peer,
|
||||||
plen,
|
plen,
|
||||||
ifname,
|
ifname,
|
||||||
|
@ -849,9 +849,9 @@ _ip_address_add (NMPlatform *platform,
|
||||||
/* flags not implemented (yet) */
|
/* flags not implemented (yet) */
|
||||||
g_assert (flags == 0);
|
g_assert (flags == 0);
|
||||||
nmtstp_run_command_check ("ip address change %s%s%s/%d dev %s%s%s%s",
|
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) ? " 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,
|
plen,
|
||||||
ifname,
|
ifname,
|
||||||
s_valid ?: "",
|
s_valid ?: "",
|
||||||
|
@ -1059,15 +1059,15 @@ _ip_address_del (NMPlatform *platform,
|
||||||
|
|
||||||
if (is_v4) {
|
if (is_v4) {
|
||||||
success = nmtstp_run_command ("ip address delete %s%s%s/%d dev %s",
|
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 ? " 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,
|
plen,
|
||||||
ifname);
|
ifname);
|
||||||
} else {
|
} else {
|
||||||
g_assert (!peer_address);
|
g_assert (!peer_address);
|
||||||
success = nmtstp_run_command ("ip address delete %s/%d dev %s",
|
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,
|
plen,
|
||||||
ifname);
|
ifname);
|
||||||
}
|
}
|
||||||
|
@ -1258,8 +1258,8 @@ nmtstp_link_gre_add (NMPlatform *platform,
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
dev ?: "",
|
dev ?: "",
|
||||||
nm_utils_inet4_ntop (lnk->local, b1),
|
_nm_utils_inet4_ntop (lnk->local, b1),
|
||||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
_nm_utils_inet4_ntop (lnk->remote, b2),
|
||||||
lnk->ttl,
|
lnk->ttl,
|
||||||
lnk->tos,
|
lnk->tos,
|
||||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
||||||
|
@ -1320,8 +1320,8 @@ nmtstp_link_ip6tnl_add (NMPlatform *platform,
|
||||||
name,
|
name,
|
||||||
mode,
|
mode,
|
||||||
dev,
|
dev,
|
||||||
nm_utils_inet6_ntop (&lnk->local, b1),
|
_nm_utils_inet6_ntop (&lnk->local, b1),
|
||||||
nm_utils_inet6_ntop (&lnk->remote, b2),
|
_nm_utils_inet6_ntop (&lnk->remote, b2),
|
||||||
lnk->ttl,
|
lnk->ttl,
|
||||||
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
|
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
|
||||||
encap_ignore ? "none" : nm_sprintf_buf (encap, "%u", lnk->encap_limit),
|
encap_ignore ? "none" : nm_sprintf_buf (encap, "%u", lnk->encap_limit),
|
||||||
|
@ -1368,8 +1368,8 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
|
||||||
name,
|
name,
|
||||||
lnk->is_tap ? "ip6gretap" : "ip6gre",
|
lnk->is_tap ? "ip6gretap" : "ip6gre",
|
||||||
dev,
|
dev,
|
||||||
nm_utils_inet6_ntop (&lnk->local, b1),
|
_nm_utils_inet6_ntop (&lnk->local, b1),
|
||||||
nm_utils_inet6_ntop (&lnk->remote, b2),
|
_nm_utils_inet6_ntop (&lnk->remote, b2),
|
||||||
lnk->ttl,
|
lnk->ttl,
|
||||||
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
|
tclass_inherit ? "inherit" : nm_sprintf_buf (tclass, "%02x", lnk->tclass),
|
||||||
lnk->flow_label);
|
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",
|
success = !nmtstp_run_command ("ip tunnel add %s mode ipip %s local %s remote %s ttl %u tos %02x %s",
|
||||||
name,
|
name,
|
||||||
dev,
|
dev,
|
||||||
nm_utils_inet4_ntop (lnk->local, b1),
|
_nm_utils_inet4_ntop (lnk->local, b1),
|
||||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
_nm_utils_inet4_ntop (lnk->remote, b2),
|
||||||
lnk->ttl,
|
lnk->ttl,
|
||||||
lnk->tos,
|
lnk->tos,
|
||||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
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",
|
success = !nmtstp_run_command ("ip tunnel add %s mode sit%s local %s remote %s ttl %u tos %02x %s",
|
||||||
name,
|
name,
|
||||||
dev,
|
dev,
|
||||||
nm_utils_inet4_ntop (lnk->local, b1),
|
_nm_utils_inet4_ntop (lnk->local, b1),
|
||||||
nm_utils_inet4_ntop (lnk->remote, b2),
|
_nm_utils_inet4_ntop (lnk->remote, b2),
|
||||||
lnk->ttl,
|
lnk->ttl,
|
||||||
lnk->tos,
|
lnk->tos,
|
||||||
lnk->path_mtu_discovery ? "pmtudisc" : "nopmtudisc");
|
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));
|
dev = g_strdup_printf ("dev %s", nm_platform_link_get_name (platform, lnk->parent_ifindex));
|
||||||
|
|
||||||
if (lnk->local)
|
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)))
|
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
|
else
|
||||||
local[0] = '\0';
|
local[0] = '\0';
|
||||||
|
|
||||||
if (lnk->group)
|
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)))
|
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
|
else
|
||||||
group[0] = '\0';
|
group[0] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -727,7 +727,7 @@ read_full_ip4_address (shvarFile *ifcfg,
|
||||||
else {
|
else {
|
||||||
/* Try to autodetermine the prefix for the address' class */
|
/* Try to autodetermine the prefix for the address' class */
|
||||||
prefix = _nm_utils_ip4_get_default_prefix (ipaddr);
|
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);
|
prefix = nm_utils_ip4_netmask_to_prefix (netmask);
|
||||||
if (netmask != _nm_utils_ip4_prefix_to_netmask (prefix)) {
|
if (netmask != _nm_utils_ip4_prefix_to_netmask (prefix)) {
|
||||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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));
|
netmask = _nm_utils_ip4_prefix_to_netmask (nm_ip_route_get_prefix (route));
|
||||||
svSetValueStr (routefile, netmask_key,
|
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));
|
svSetValueStr (routefile, gw_key, nm_ip_route_get_next_hop (route));
|
||||||
|
|
||||||
|
@ -2430,7 +2430,7 @@ write_ip4_setting (NMConnection *connection,
|
||||||
char buf[INET_ADDRSTRLEN];
|
char buf[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
svSetValueStr (ifcfg, tag,
|
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++;
|
n++;
|
||||||
|
|
|
@ -984,10 +984,10 @@ print_vpn_config (NMVpnConnection *self)
|
||||||
|
|
||||||
if (priv->ip4_external_gw) {
|
if (priv->ip4_external_gw) {
|
||||||
_LOGI ("Data: VPN Gateway: %s",
|
_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) {
|
} else if (priv->ip6_external_gw) {
|
||||||
_LOGI ("Data: VPN Gateway: %s",
|
_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));
|
_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);
|
nm_assert (address4);
|
||||||
|
|
||||||
if (priv->ip4_internal_gw)
|
if (priv->ip4_internal_gw)
|
||||||
_LOGI ("Data: Internal Gateway: %s", nm_utils_inet4_ntop (priv->ip4_internal_gw, 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 Address: %s", address4 ? _nm_utils_inet4_ntop (address4->address, b1) : "??");
|
||||||
_LOGI ("Data: Internal Prefix: %d", address4 ? (int) address4->plen : -1);
|
_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) {
|
nm_ip_config_iter_ip4_route_for_each (&ipconf_iter, priv->ip4_config, &route) {
|
||||||
_LOGI ("Data: Static Route: %s/%d Next Hop: %s",
|
_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,
|
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);
|
num = nm_ip4_config_get_num_nameservers (priv->ip4_config);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
_LOGI ("Data: Internal DNS: %s",
|
_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)
|
if (nm_ip4_config_get_num_domains (priv->ip4_config) > 0)
|
||||||
|
@ -1035,22 +1035,22 @@ print_vpn_config (NMVpnConnection *self)
|
||||||
nm_assert (address6);
|
nm_assert (address6);
|
||||||
|
|
||||||
if (priv->ip6_internal_gw)
|
if (priv->ip6_internal_gw)
|
||||||
_LOGI ("Data: Internal Gateway: %s", nm_utils_inet6_ntop (priv->ip6_internal_gw, 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 Address: %s", _nm_utils_inet6_ntop (&address6->address, b1));
|
||||||
_LOGI ("Data: Internal Prefix: %d", address6->plen);
|
_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) {
|
nm_ip_config_iter_ip6_route_for_each (&ipconf_iter, priv->ip6_config, &route) {
|
||||||
_LOGI ("Data: Static Route: %s/%d Next Hop: %s",
|
_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,
|
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);
|
num = nm_ip6_config_get_num_nameservers (priv->ip6_config);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
_LOGI ("Data: Internal DNS: %s",
|
_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)
|
if (nm_ip6_config_get_num_domains (priv->ip6_config) > 0)
|
||||||
|
|
Loading…
Reference in a new issue