Skip to contentSkip to conversation

[2.6.3] Sysfs breakage - tun.ko

PATCH Nigel Kukard 4 participants 9 messages Mar 1, 2004 – Mar 4, 2004

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

Hi,

Loading tun.ko module breaks on sysfs...

Quoted 7 lines

[root@localhost misc]# pwd
/sys/class/misc
[root@localhost misc]# ls
dac960_gam device-mapper net/tun psaux
[root@localhost misc]# cd net\/tun
bash: cd: net/tun: No such file or directory
[root@localhost misc]#

Why not just make it in misc? why net/tun seeing as everything else is just dumped there. Patch below.

net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
@@ -605,7 +605,7 @@
 
 static struct miscdevice tun_miscdev = {
        .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
        .fops = &tun_fops
 };
 
#1 lore raw

net/tun.c 2004-02-27 18:19:02.000000000 +0200 line 610

Quoted 10 lines · Nigel Kukard
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
@@ -605,7 +605,7 @@
 
 static struct miscdevice tun_miscdev = {
        .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
        .fops = &tun_fops
 };

This changed back and forth since the tun driver was added to the kernel; making this change will cause the devfs path to the tun node to change, and userspace applications expect it to be at /dev/misc/net/tun, whether that's right or wrong.

#2 lore raw

Nevermind if its right or wrong, it does not work in sysfs

-Nigel

Quoted 17 lines · Kevin P. Fleming

net/tun.c 2004-02-27 18:19:02.000000000 +0200 line 610

Quoted 10 lines · Nigel Kukard
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
@@ -605,7 +605,7 @@
 
 static struct miscdevice tun_miscdev = {
       .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
       .fops = &tun_fops
 };

This changed back and forth since the tun driver was added to the kernel; making this change will cause the devfs path to the tun node to change, and userspace applications expect it to be at /dev/misc/net/tun, whether that's right or wrong.

#3 lore raw
In reply to Kevin P. Fleming
Quoted 6 lines · * Kevin P. Fleming ([email protected]) wrote:
Quoted 4 lines · Nigel Kukard
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +0 -0
@@ -605,7 +605,7 @@
 
Quoted 11 lines

net/tun.c 2004-02-27 18:19:02.000000000 +0200 line 610

Quoted 6 lines
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
 static struct miscdevice tun_miscdev = {
        .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
        .fops = &tun_fops
 };

This changed back and forth since the tun driver was added to the kernel; making this change will cause the devfs path to the tun node to change, and userspace applications expect it to be at /dev/misc/net/tun, whether that's right or wrong.

Why don't you use:

	.devfs_name = "net/tun",

Or fix userspace apps? Or switch to udev with devfs rules emulated and a rule for the tun/tap driver?

thanks,
-chris

Signature · 1 line
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net
#4 lore raw
Quoted 2 lines · Chris Wright

Why don't you use:

	.devfs_name = "net/tun",

That seems fine, if it will do the job.

Quoted 2 lines

Or fix userspace apps? Or switch to udev with devfs rules emulated and a rule for the tun/tap driver?

This is a stable kernel series; these kinds of userspace-breakage changes are not supposed to happen. Personally I have already started migrating my systems to udev, but it will take some time to complete that. Regardless, this would be a userspace-incompatible change if using .devfs_name won't do the job.

#5 lore raw
In reply to Kevin P. Fleming
Followup to:  <[email protected]>
By author:    "Kevin P. Fleming" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 7 lines
Quoted 4 lines · Nigel Kukard
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +0 -0
@@ -605,7 +605,7 @@
 
Quoted 12 lines

net/tun.c 2004-02-27 18:19:02.000000000 +0200 line 610

Quoted 6 lines
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
 static struct miscdevice tun_miscdev = {
        .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
        .fops = &tun_fops
 };

This changed back and forth since the tun driver was added to the kernel; making this change will cause the devfs path to the tun node to change, and userspace applications expect it to be at /dev/misc/net/tun, whether that's right or wrong.

Bullsh*t.

User-space apps expect it to be /dev/net/tun, which is the documented path for this device node. Anything else is a devfs bug (/dev/misc is a devfs bug from beginning to end.)

-hpa

#6 lore raw
In reply to Kevin P. Fleming

Nothing said solves the problem, the problem has got nothing to do with devfs (only for compat reasons), the problem is that "net/tun" breaks sysfs.

-Nigel

Quoted 17 lines · Kevin P. Fleming

net/tun.c 2004-02-27 18:19:02.000000000 +0200 line 610

Quoted 10 lines · Nigel Kukard
net/tun.c 2004-02-27 18:19:02.000000000 +0200 renamed from net/tun.c.old 2004-02-27 18:18:55.000000000 +0200 +1 -1
@@ -605,7 +605,7 @@
 
 static struct miscdevice tun_miscdev = {
       .minor = TUN_MINOR,
-       .name = "net/tun",
+       .name = "tun",
       .fops = &tun_fops
 };

This changed back and forth since the tun driver was added to the kernel; making this change will cause the devfs path to the tun node to change, and userspace applications expect it to be at /dev/misc/net/tun, whether that's right or wrong.

#7 lore raw
Quoted 4 lines · * Nigel Kukard ([email protected]) wrote:

Nothing said solves the problem, the problem has got nothing to do with devfs (only for compat reasons), the problem is that "net/tun" breaks sysfs.

Yes, why does this not work? Keeps devfs legacy name, works fine with udev, and makes proper dir in sysfs.

thanks,
-chris

===== drivers/net/tun.c 1.29 vs edited =====

drivers/net/tun.c +2 -1
@@ -602,7 +602,8 @@
 
 static struct miscdevice tun_miscdev = {
 	.minor = TUN_MINOR,
-	.name = "net/tun",
+	.name = "tun",
+	.devfs_name = "net/tun",
 	.fops = &tun_fops
 };
 
#8 lore raw

Thanks bud!

Hopefully it'll get included in 2.6.4 ;)

Quoted 25 lines · Chris Wright
Quoted 4 lines · * Nigel Kukard ([email protected]) wrote:

Nothing said solves the problem, the problem has got nothing to do with devfs (only for compat reasons), the problem is that "net/tun" breaks sysfs.

Yes, why does this not work? Keeps devfs legacy name, works fine with udev, and makes proper dir in sysfs.

thanks,
-chris

===== drivers/net/tun.c 1.29 vs edited =====

drivers/net/tun.c +2 -1
@@ -602,7 +602,8 @@
 
 static struct miscdevice tun_miscdev = {
 	.minor = TUN_MINOR,
-	.name = "net/tun",
+	.name = "tun",
+	.devfs_name = "net/tun",
 	.fops = &tun_fops
 };