summaryrefslogtreecommitdiff
path: root/lib/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.c')
-rw-r--r--lib/utils.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/utils.c b/lib/utils.c
index 95d46ff2..bbb3bdcf 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -824,14 +824,10 @@ int nodev(const char *dev)
return -1;
}
-int check_ifname(const char *name)
+static int __check_ifname(const char *name)
{
- /* These checks mimic kernel checks in dev_valid_name */
if (*name == '\0')
return -1;
- if (strlen(name) >= IFNAMSIZ)
- return -1;
-
while (*name) {
if (*name == '/' || isspace(*name))
return -1;
@@ -840,6 +836,19 @@ int check_ifname(const char *name)
return 0;
}
+int check_ifname(const char *name)
+{
+ /* These checks mimic kernel checks in dev_valid_name */
+ if (strlen(name) >= IFNAMSIZ)
+ return -1;
+ return __check_ifname(name);
+}
+
+int check_altifname(const char *name)
+{
+ return __check_ifname(name);
+}
+
/* buf is assumed to be IFNAMSIZ */
int get_ifname(char *buf, const char *name)
{