David Woodhouse f85ba78068 tun: add IFF_TUN_EXCL flag to avoid opening a persistent device.
When creating a certain types of VPN, NetworkManager will first attempt
to find an available tun device by iterating through 'vpn%d' until it
finds one that isn't already busy. Then it'll set that to be persistent
and owned by the otherwise unprivileged user that the VPN dæmon itself
runs as.

There's a race condition here -- during the period where the vpn%d
device is created and we're waiting for the VPN dæmon to actually
connect and use it, if we try to create _another_ device we could end up
re-using the same one -- because trying to open it again doesn't get
-EBUSY as it would while it's _actually_ busy.

So solve this, we add an IFF_TUN_EXCL flag which causes tun_set_iff() to
fail if it would be opening an existing persistent tundevice -- so that
we can make sure we're getting an entirely _new_ device.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-27 03:23:54 -07:00
..
2009-04-13 04:22:04 -04:00
2009-04-07 08:31:03 -07:00
2009-04-05 02:14:15 -04:00
2009-04-08 14:13:04 +02:00
2009-04-08 00:00:33 -07:00
2009-03-30 21:55:25 +10:30
2009-04-09 00:27:17 +01:00
2009-04-05 00:32:25 +02:00
2009-04-02 00:40:41 +00:00
2009-04-22 16:54:27 -04:00
2009-04-02 11:19:57 +09:00
2009-03-27 20:13:20 -04:00
2009-04-27 03:22:15 -07:00
2009-04-05 00:32:22 +02:00