|
Programming with the kernel tunnel driver
As I'm sure many people have tried, I'm attempting to use the tun driver. I've followed the example in tuntap.txt but a couple of things about it concern me.
Firstly, the 'tun' device is used to create/allocate a device using an ioctl but the file descriptor returned is that which was used to open the 'tun' device in the first place - is this correct or is the user supposed to open the device name that is returned by the alloc function.
Secondly, the name allocation defines a format string of the form 'xxx%d', which is 5 characters long, and examples indicate that the allocated device will be 'xxx0' etc but what happens when you already have 100 tunnels opened (however /that/ is accomplished but see my 1st question!) - will it return 'xxx100', 'xxx101' and overwrite the end of the character buffer?
Finally (for now), has anyone ever found a definition for the function tun_alloc_old() that is referenced in the example?
As far as I can see this file has been in the kernel tree for at least 8 years but it sure looks broken to me!!
Cheers
|