2004-03-13 20:49:58

by rutger

[permalink] [raw]
Subject: [muPATCH] TUN/TAP sysfs fix

Hi,

Using Gentoo2004.0 with udev (with /dev on ramfs) gives most devices
from sysfs. However, TUN/TAP is not listed. Digging into it further
revealed the error:

# ls /sys/class/misc
agpgart hw_random net/tun psaux rtc
# ls -l /sys/class/misc
ls: /sys/class/misc/net/tun: No such file or directory
total 0
drwxr-xr-x 2 root root 0 Mar 13 18:43 agpgart
...

A file with a '/' embedded.

Suggestion: change name from 'net/tun' to 'net_tun', to be as
unobtrusive as possible, which lets met use /dev/net_tun (using the
Unix ASCII to filename conversion convention ;)

The correct solution might be to change sysfs into auto-creating
directories for .names with embedded slashes, but that's outside the
scope of this quick make-it-work-again hack...

*** linux-2.6/drivers/net/tun.c~ Sat Mar 13 20:20:17 2004
--- linux-2.6/drivers/net/tun.c Sat Mar 13 20:20:57 2004
***************
*** 602,608 ****

static struct miscdevice tun_miscdev = {
.minor = TUN_MINOR,
! .name = "net/tun",
.fops = &tun_fops
};

--- 602,608 ----

static struct miscdevice tun_miscdev = {
.minor = TUN_MINOR,
! .name = "net_tun",
.fops = &tun_fops
};


--
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------