summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Cardace <acardace@redhat.com>2020-02-12 18:01:13 +0100
committerAntonio Cardace <acardace@redhat.com>2020-02-17 15:27:35 +0100
commit6e9a36ab9f68aef87ba6f806269d591b0a4e4467 (patch)
tree73d481fe61b4ea2bab907ffdbd3e4ba7c6bdf30a /src
parent550f53856409bbee534cb770a0c400dbf282bdf8 (diff)
downloadNetworkManager-6e9a36ab9f68aef87ba6f806269d591b0a4e4467.tar.gz
all: use nm_utils_ifname_valid_kernel() instead of nm_utils_is_valid_iface_name()
nm_utils_is_valid_iface_name() is a public API of libnm-core, let's use our internal API. $ sed -i 's/\<nm_utils_is_valid_iface_name\>/nm_utils_ifname_valid_kernel/g' $(git grep -l nm_utils_is_valid_iface_name)
Diffstat (limited to 'src')
-rw-r--r--src/dhcp/nm-dhcp-client.c2
-rw-r--r--src/nm-config.c2
-rw-r--r--src/nm-core-utils.c8
-rw-r--r--src/platform/nm-platform-utils.c4
-rw-r--r--src/platform/tests/test-common.c24
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c2
6 files changed, 21 insertions, 21 deletions
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index 7f3c41bf6f..9277388e28 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -1011,7 +1011,7 @@ set_property (GObject *object, guint prop_id,
/* construct-only */
priv->iface = g_value_dup_string (value);
g_return_if_fail (priv->iface);
- nm_assert (nm_utils_is_valid_iface_name (priv->iface, NULL));
+ nm_assert (nm_utils_ifname_valid_kernel (priv->iface, NULL));
break;
case PROP_IFINDEX:
/* construct-only */
diff --git a/src/nm-config.c b/src/nm-config.c
index f317e94880..198f803fab 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -430,7 +430,7 @@ nm_config_set_no_auto_default_for_device (NMConfig *self, NMDevice *device)
*
* Instead, try the interface-name... */
ifname = nm_device_get_ip_iface (device);
- if (!nm_utils_is_valid_iface_name (ifname, NULL))
+ if (!nm_utils_ifname_valid_kernel (ifname, NULL))
return;
spec_to_free = g_strdup_printf (NM_MATCH_SPEC_INTERFACE_NAME_TAG"=%s", ifname);
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 9529c3e01a..1ff0764777 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -2145,7 +2145,7 @@ nm_utils_sysctl_ip_conf_path (int addr_family, char *buf, const char *ifname, co
nm_assert (buf);
nm_assert_addr_family (addr_family);
- g_assert (nm_utils_is_valid_iface_name (ifname, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (ifname, NULL));
property = NM_ASSERT_VALID_PATH_COMPONENT (property);
len = g_snprintf (buf,
@@ -2163,7 +2163,7 @@ nm_utils_sysctl_ip_conf_is_path (int addr_family, const char *path, const char *
{
g_return_val_if_fail (path, FALSE);
NM_ASSERT_VALID_PATH_COMPONENT (property);
- g_assert (!ifname || nm_utils_is_valid_iface_name (ifname, NULL));
+ g_assert (!ifname || nm_utils_ifname_valid_kernel (ifname, NULL));
if (addr_family == AF_INET) {
if (!g_str_has_prefix (path, IPV4_PROPERTY_DIR))
@@ -2196,7 +2196,7 @@ nm_utils_sysctl_ip_conf_is_path (int addr_family, const char *path, const char *
return FALSE;
memcpy (buf, path, l);
buf[l] = '\0';
- if (!nm_utils_is_valid_iface_name (buf, NULL))
+ if (!nm_utils_ifname_valid_kernel (buf, NULL))
return FALSE;
path = slash + 1;
}
@@ -3637,7 +3637,7 @@ nm_utils_ifname_cpy (char *dst, const char *name)
g_return_if_fail (dst);
g_return_if_fail (name && name[0]);
- nm_assert (nm_utils_is_valid_iface_name (name, NULL));
+ nm_assert (nm_utils_ifname_valid_kernel (name, NULL));
/* ensures NUL padding of the entire IFNAMSIZ buffer. */
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c
index af95d4d3a3..98884cd717 100644
--- a/src/platform/nm-platform-utils.c
+++ b/src/platform/nm-platform-utils.c
@@ -155,7 +155,7 @@ again:
const char *ifname = known_ifnames[try_count % 2];
nm_assert (ifindex > 0);
- nm_assert (ifname && nm_utils_is_valid_iface_name (ifname, NULL));
+ nm_assert (ifname && nm_utils_ifname_valid_kernel (ifname, NULL));
nm_assert (fd >= 0);
memset (&ifr, 0, sizeof (ifr));
@@ -1417,7 +1417,7 @@ nmp_utils_sysctl_open_netdir (int ifindex,
return -1;
}
- nm_assert (nm_utils_is_valid_iface_name (ifname, NULL));
+ nm_assert (nm_utils_ifname_valid_kernel (ifname, NULL));
if (g_strlcpy (&sysdir[NM_STRLEN (SYS_CLASS_NET)], ifname, IFNAMSIZ) >= IFNAMSIZ)
g_return_val_if_reached (-1);
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 373a10ddd4..723b6fcf5b 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -1176,7 +1176,7 @@ nmtstp_link_veth_add (NMPlatform *platform,
const NMPlatformLink *pllink = NULL;
gboolean success;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1205,7 +1205,7 @@ nmtstp_link_dummy_add (NMPlatform *platform,
const NMPlatformLink *pllink = NULL;
gboolean success;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1236,7 +1236,7 @@ nmtstp_link_gre_add (NMPlatform *platform,
char b2[INET_ADDRSTRLEN];
NMLinkType link_type;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
link_type = lnk->is_tap ? NM_LINK_TYPE_GRETAP : NM_LINK_TYPE_GRE;
@@ -1288,7 +1288,7 @@ nmtstp_link_ip6tnl_add (NMPlatform *platform,
gboolean encap_ignore;
gboolean tclass_inherit;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
g_assert (!lnk->is_gre);
external_command = nmtstp_run_command_check_external (external_command);
@@ -1349,7 +1349,7 @@ nmtstp_link_ip6gre_add (NMPlatform *platform,
char tclass[20];
gboolean tclass_inherit;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
g_assert (lnk->is_gre);
external_command = nmtstp_run_command_check_external (external_command);
@@ -1398,7 +1398,7 @@ nmtstp_link_ipip_add (NMPlatform *platform,
char b1[INET_ADDRSTRLEN];
char b2[INET_ADDRSTRLEN];
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1439,7 +1439,7 @@ nmtstp_link_macvlan_add (NMPlatform *platform,
gboolean success;
NMLinkType link_type;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1487,7 +1487,7 @@ nmtstp_link_sit_add (NMPlatform *platform,
char b1[INET_ADDRSTRLEN];
char b2[INET_ADDRSTRLEN];
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1533,7 +1533,7 @@ nmtstp_link_tun_add (NMPlatform *platform,
int err;
int r;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
g_assert (lnk);
g_assert (NM_IN_SET (lnk->type, IFF_TUN, IFF_TAP));
g_assert (!out_fd || *out_fd == -1);
@@ -1596,7 +1596,7 @@ nmtstp_link_vrf_add (NMPlatform *platform,
const NMPlatformLink *pllink = NULL;
int r = 0;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
NM_SET_OUT (out_not_supported, FALSE);
external_command = nmtstp_run_command_check_external (external_command);
@@ -1635,7 +1635,7 @@ nmtstp_link_vxlan_add (NMPlatform *platform,
int err;
int r;
- g_assert (nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (nm_utils_ifname_valid_kernel (name, NULL));
external_command = nmtstp_run_command_check_external (external_command);
@@ -1724,7 +1724,7 @@ nmtstp_link_get_typed (NMPlatform *platform,
g_assert_cmpstr (name, ==, pllink->name);
}
- g_assert (!name || nm_utils_is_valid_iface_name (name, NULL));
+ g_assert (!name || nm_utils_ifname_valid_kernel (name, NULL));
if (pllink && link_type != NM_LINK_TYPE_NONE)
g_assert_cmpint (pllink->type, ==, link_type);
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index bf1685c24c..06ba11a22e 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -399,7 +399,7 @@ make_connection_setting (const char *file,
if (v) {
GError *error = NULL;
- if (nm_utils_is_valid_iface_name (v, &error)) {
+ if (nm_utils_ifname_valid_kernel (v, &error)) {
g_object_set (s_con,
NM_SETTING_CONNECTION_INTERFACE_NAME, v,
NULL);