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.
Add warnings for bad combinations of Device and Interface. On Linux, the name of the tun/tap interface can be set freely. However, on most other operating systems, tinc cannot change the name of the interface. In those situations, it is possible to specify a Device and an Interface that conflict with each other. On BSD, this can cause $INTERFACE to be set incorrectly, on Windows, this results in a potentially unreliable way in which a TAP-Win32 interface is selected.
Modernize the build system. Recent versions of autoconf and automake were giving a lot of warnings. This is sort of a backport of similar build system changes from the 1.1 banch: - Fix all autoconf/automake warnings. - Merge lib/ into src/. - Don't use symlinks for device.c any more, but use automake conditionals. - Use explicit paths to local header files. - Get rid of alloca.c/malloc.c/memcmp.c/realloc.c.
Set FD_CLOEXEC flag on all sockets. Scripts called by tinc would inherit its open filedescriptors. This could be a problem if other long-running daemons are started from those scripts, if those daemons would not close all filedescriptors before going into the background. Problem found and solution suggested by Nick Hibma.