socket-utils: revert f1811313f42dc7ddaed3c47edc834c2bfd1309b2
authorSusant Sahani <susant@redhat.com>
Tue, 24 Jan 2017 18:24:34 +0000 (23:54 +0530)
committerSusant Sahani <susant@redhat.com>
Tue, 24 Jan 2017 18:24:34 +0000 (23:54 +0530)
':' in not a a valid interface name.

src/basic/socket-util.c
src/test/test-socket-util.c

index c882b8a..77f81a6 100644 (file)
@@ -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');
index e1f5fd5..d80613d 100644 (file)
@@ -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"));