Skip to contentSkip to conversation

colons are invalid characters in netdev names

PATCH In review Matthew Thode 3 participants 6 messages Feb 17, 2015 – Feb 18, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 colons are invalid characters in netdev names

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
index d030575..e9b6d5a 100644
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {
Signature · 1 line
2.0.5
#1 lore raw
Quoted 15 lines · Matthew Thode

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +0 -0
index d030575..e9b6d5a 100644

net/core/dev.c bool dev_valid_name(const char *name) · line 948

Quoted 8 lines
net/core/dev.c +1 -1
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {

Hi,

that check should be done in the loop below, shouldn't it?

Regards,
Lino

#2 lore raw
Quoted 27 lines · Lino Sanfilippo
Quoted 15 lines · Matthew Thode

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +0 -0
index d030575..e9b6d5a 100644

net/core/dev.c bool dev_valid_name(const char *name) · line 948

Quoted 8 lines
net/core/dev.c +1 -1
@@ -942,7 +942,7 @@ bool dev_valid_name(const char *name)
 		return false;
 	if (strlen(name) >= IFNAMSIZ)
 		return false;
-	if (!strcmp(name, ".") || !strcmp(name, ".."))
+	if (!strcmp(name, ".") || !strcmp(name, "..") || !strcmp(name, ":"))
 		return false;
 
 	while (*name) {

Hi,

Quoted 5 lines

that check should be done in the loop below, shouldn't it?

Regards,
Lino

You are correct, should I resend a patch. Not really sure the procedure of updating a patchset sent to the ML.

Signature · 1 line
Matthew Thode
#3 lore raw
Quoted 4 lines · Matthew Thode
Quoted 1 line

You are correct, should I resend a patch. Not really sure the procedure of updating a patchset sent to the ML.

You could resend as [PATCH v2] to indicate that it is an updated version. But you should also try to improve the patch subject line and description, e.g. by writing it in the imperative. See "SubmittingPatches" in the Documents folder of the kernel (or take a look at other patches).

Regards,
Lino

#5 lore raw
Quoted 13 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 17 Feb 2015 17:15:42 -0600 Matthew Thode <[email protected]> wrote:

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

What is the exact sequence that causes the problem? SIOCSIFNAME already strips of colon.

It strips the name one access, not creation. You can create a dummy device and not access it, escaping doesn't seem to help.

ip link add name foo:asdasd type dummy
ip link del dev foo:asdasd # will not be deleted

Signature · 1 line
Matthew Thode