Timothy Redaelli
2010-Feb-10 13:33 UTC
[PATCH] Use /dev/tap0 by default on BSD if mode != router
---
src/bsd/device.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/bsd/device.c b/src/bsd/device.c
index c2cd34c..b835b59 100644
--- a/src/bsd/device.c
+++ b/src/bsd/device.c
@@ -33,6 +33,7 @@
#endif
#define DEFAULT_DEVICE "/dev/tun0"
+#define DEFAULT_DEVICE_TAP "/dev/tap0"
typedef enum device_type {
DEVICE_TYPE_TUN,
@@ -60,8 +61,12 @@ static device_type_t device_type = DEVICE_TYPE_TUN;
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_DEVICE_TAP);
+ else
+ device = xstrdup(DEFAULT_DEVICE);
+ }
if(!get_config_string(lookup_config(config_tree, "Interface"),
&iface))
iface = xstrdup(rindex(device, '/') ? rindex(device, '/') + 1
: device);
--
1.6.6.1
Apparently Analagous Threads
- Router mode and MAC addresses
- [PATCH 1/4] Experimental IFF_ONE_QUEUE support for Linux
- patch to add device-option to ogg123 rc file
- [PATCH 1/2] nouveau: make nouveau importing global buffers completely thread-safe, with tests
- [PATCH] src/linux/device.c: Fix segfault when running without `--net'.
