A very very brief (not very thorough) audit, seems to indicate this won't cause any problems...
For cloners that will allocate unit numbers at dev_clone, attempting to do silly things like mode changes to the base device name can and will cause excess device creation. For example:
# ls -l /dev | grep -i tun1 crwxrwxrwx 1 uucp dialer 0x2c1 Oct 7 11:18 tun1 # chmod 0777 /dev/tun # ls -l /dev | grep -i tun crw------- 1 uucp dialer 0x2b9 Oct 7 11:19 tun0 crwxrwxrwx 1 uucp dialer 0x2c1 Oct 7 11:18 tun1 crw------- 1 uucp dialer 0x2c2 Oct 7 11:19 tun2 crw------- 1 uucp dialer 0x2c3 Oct 7 11:19 tun3 crwxrwxrwx 1 uucp dialer 0x2c4 Oct 7 11:19 tun4
Clearly this chmod cannot work anyways due to the nature of /dev/tun. I consider two solutions to this:
- Only invoke dev_clone for !ISOPEN inquiries, or
- Pass along nameiop flags to dev_clone handlers so that they can individually determine when they want to create new devices.
The latter is more flexible, but requires more widespread change to drivers. It's also not clear to me if it's more correct than the former.