projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
00e71ec
)
Use /dev/tap0 by default on FreeBSD and NetBSD when using Mode = switch.
author
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 12 Jul 2012 09:25:11 +0000
(11:25 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 12 Jul 2012 09:25:11 +0000
(11:25 +0200)
src/bsd/device.c
patch
|
blob
|
history
diff --git
a/src/bsd/device.c
b/src/bsd/device.c
index
45c2d5f
..
d6dd055
100644
(file)
--- a/
src/bsd/device.c
+++ b/
src/bsd/device.c
@@
-33,7
+33,12
@@
#include "bsd/tunemu.h"
#endif
#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,
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;
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);
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);