From: Guus Sliepen Date: Sat, 14 Jul 2012 13:13:21 +0000 (+0200) Subject: Merge branch 'master' into 1.1 X-Git-Tag: import-tinc-1.1~367 X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=268c8545aaf83b7433f43402f5c77e39e20006ef;hp=bce177767d521b47efd458c5cd570959a98d940d Merge branch 'master' into 1.1 --- diff --git a/THANKS b/THANKS index 6fa8f9c8..0e7e6928 100644 --- a/THANKS +++ b/THANKS @@ -36,6 +36,7 @@ We would like to thank the following people for their contributions to tinc: * Nick Hibma * Nick Patavalis * Paul Littlefield +* Philipp Babel * Robert van der Meulen * Rumko * Scott Lamb diff --git a/doc/tinc.texi b/doc/tinc.texi index b595aec1..90d3c281 100644 --- a/doc/tinc.texi +++ b/doc/tinc.texi @@ -262,7 +262,7 @@ alias char-major-10-200 tun @subsection Configuration of FreeBSD kernels For FreeBSD version 4.1 and higher, tun and tap drivers are included in the default kernel configuration. -Using tap devices is recommended. +The tap driver can be loaded with @code{kldload if_tap}, or by adding @code{if_tap_load="YES"} to @file{/boot/loader.conf}. @c ================================================================== @@ -276,6 +276,7 @@ which adds a tap device to OpenBSD which should work with tinc, but with recent versions of OpenBSD, a tun device can act as a tap device by setting the link0 option with ifconfig. + @c ================================================================== @node Configuration of NetBSD kernels @subsection Configuration of NetBSD kernels diff --git a/src/bsd/device.c b/src/bsd/device.c index f8a55968..c50005b2 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -33,7 +33,12 @@ #include "bsd/tunemu.h" #endif -#define DEFAULT_DEVICE "/dev/tun0" +#define DEFAULT_TUN_DEVICE "/dev/tun0" +#if defined(HAVE_FREEBSD) || defined(HAVE_NETBSD) +#define DEFAULT_TAP_DEVICE "/dev/tap0" +#else +#define DEFAULT_TAP_DEVICE "/dev/tun0" +#endif typedef enum device_type { DEVICE_TYPE_TUN, @@ -61,8 +66,12 @@ static device_type_t device_type = DEVICE_TYPE_TUN; static bool setup_device(void) { char *type; - if(!get_config_string(lookup_config(config_tree, "Device"), &device)) - device = xstrdup(DEFAULT_DEVICE); + if(!get_config_string(lookup_config(config_tree, "Device"), &device)) { + if(routing_mode == RMODE_ROUTER) + device = xstrdup(DEFAULT_TUN_DEVICE); + else + device = xstrdup(DEFAULT_TAP_DEVICE); + } if(!get_config_string(lookup_config(config_tree, "Interface"), &iface)) iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);