bug in tun

harry eaton mol-devel@lists.maconlinux.org
Thu, 29 May 2003 16:14:07 -0400


Hello,

I don't see how this works for anybody, but my experience is this:

When starting up mol with

netdev: tun0 -tun

The function "tun_open" in src/drivers/net/iface.c is called with
intf_name set to "tun0", but the line

ifr.ifr_flags = IFF_TAP | IFF_NO_PI;

suggests that the TAP interface is desired. No matter, when the
TUNSETIFF ioctl is made, there is a real problem:

first in the function "tun_set_iff", in src/netdriver/tun.c, at line 396
name is set to "tap%d", which doesn't matter much because then
it is immediately overwritten with ifr->ifr_name which is "tun0"
because that name exists. It is this name that is passed to the kernel's
dev_alloc_name routine, however a quick glance at that code reveals
that the name string must contain a single "%d" which "tun0" obviously
does not; the result produces an error and the device is henceforth gone.

My cheap work-around was to change the ifr.ifr_flags in iface.c to use
IFF_TUN | IFF_NO_PI, and then comment out the code in tun.c where
it takes the name from ifr->ifr_name. This at least brings up the interface
for me.

Cheers,
harry