summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2017-01-24 23:54:34 +0530
committerSusant Sahani <susant@redhat.com>2017-01-24 23:54:34 +0530
commit7ed95830dcbb9c762399b66d926c9547aed291aa (patch)
treee93c155092e4eca0ab85941d9206c69eea214d1e
parenta341dfe563bf3be791107a0c98d47f74366c637d (diff)
socket-utils: revert f1811313f42dc7ddaed3c47edc834c2bfd1309b2
':' in not a a valid interface name.
-rw-r--r--src/basic/socket-util.c2
-rw-r--r--src/test/test-socket-util.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index c882b8a12a..77f81a60ba 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -887,7 +887,7 @@ bool ifname_valid(const char *p) {
if ((unsigned char) *p <= 32U)
return false;
- if (*p == '/')
+ if (*p == ':' || *p == '/')
return false;
numeric = numeric && (*p >= '0' && *p <= '9');
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c
index e1f5fd5084..d80613dc84 100644
--- a/src/test/test-socket-util.c
+++ b/src/test/test-socket-util.c
@@ -30,7 +30,6 @@
static void test_ifname_valid(void) {
assert(ifname_valid("foo"));
assert(ifname_valid("eth0"));
- assert(ifname_valid("eth0:0"));
assert(!ifname_valid("0"));
assert(!ifname_valid("99"));
@@ -45,7 +44,7 @@ static void test_ifname_valid(void) {
assert(!ifname_valid("."));
assert(!ifname_valid(".."));
assert(ifname_valid("foo.bar"));
- assert(ifname_valid("x:y"));
+ assert(!ifname_valid("x:y"));
assert(ifname_valid("xxxxxxxxxxxxxxx"));
assert(!ifname_valid("xxxxxxxxxxxxxxxx"));