Hi,

On Fri, Mar 05, 2010 at 11:44:28AM +0100, Heiko Hund wrote:
> On Friday 05 March 2010 10:11:51 Gert Doering wrote:
> > What happened exactly?  Could you ask your colleague for a log file?
> 
> Well, he couldn't ping any remote host. Nothing special in the log, really. 
> If 
> it isn't misleading it's quite obvious that the ordering is wrong:
> 
>   TUN/TAP device /dev/tun1 opened
>   /sbin/ifconfig tun1 destroy
>   /sbin/ifconfig tun1 create
>   NOTE: Tried to delete pre-existing tun/tap instance --No Problem if failure
>   /sbin/ifconfig tun1 10.1.1.18 10.1.1.17 mtu 1500 netmask 255.255.255.255 up

Well, this is exactly what the current code for NetBSD does... (and how
this thread got started).  On NetBSD, it works.

The problem is that if you do it the other way round, you have a big fat
race condition here - between "I assume that my tun device will be tun1,
so I do 'ifconfig tun1 destroy' now" and actually opening /dev/tun1, 
some other process might grab this tun device.

open() first will exclusively lock it for you...

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Reply via email to