From: Guus Sliepen Date: Sat, 9 Apr 2016 16:39:40 +0000 (+0200) Subject: Use devname() if available to support devfs cloning on BSD. X-Git-Tag: release-1.0.27~4 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=ac685f112deb7eafc047c718da094a8b160182ad;hp=ac685f112deb7eafc047c718da094a8b160182ad Use devname() if available to support devfs cloning on BSD. Some BSD flavors allow opening /dev/tun and/or /dev/tap, which automatically create a new tun or tap interface with an unused number. To find out which number the interface got, you have to call devname() on the device file that was opened. The semantics are different from the way Linux's /dev/tun works though. In particular, after closing the device, the interface will continue to exist. Restarting tincd would cause the old interface to stay around, and a new one to be created. One could add a tinc-down script with the following line: ifconfig $INTERFACE destroy But that is still no guarantee that restarting tinc will give you the same interface. So the default tun and tap device will stay /dev/tun0 and /dev/tap0 for all BSD flavors to avoid surprises for existing users. ---