projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add warnings for bad combinations of Device and Interface.
[tinc]
/
src
/
bsd
/
device.c
diff --git
a/src/bsd/device.c
b/src/bsd/device.c
index
efb80a8
..
377d4a7
100644
(file)
--- a/
src/bsd/device.c
+++ b/
src/bsd/device.c
@@
-1,7
+1,7
@@
/*
device.c -- Interaction BSD tun/tap device
Copyright (C) 2001-2005 Ivo Timmermans,
/*
device.c -- Interaction BSD tun/tap device
Copyright (C) 2001-2005 Ivo Timmermans,
- 2001-201
2
Guus Sliepen <guus@tinc-vpn.org>
+ 2001-201
4
Guus Sliepen <guus@tinc-vpn.org>
2009 Grzegorz Dymarek <gregd72002@googlemail.com>
This program is free software; you can redistribute it and/or modify
2009 Grzegorz Dymarek <gregd72002@googlemail.com>
This program is free software; you can redistribute it and/or modify
@@
-19,22
+19,22
@@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "system.h"
+#include "
../
system.h"
-#include "conf.h"
-#include "device.h"
-#include "logger.h"
-#include "net.h"
-#include "route.h"
-#include "utils.h"
-#include "xalloc.h"
+#include "
../
conf.h"
+#include "
../
device.h"
+#include "
../
logger.h"
+#include "
../
net.h"
+#include "
../
route.h"
+#include "
../
utils.h"
+#include "
../
xalloc.h"
#ifdef ENABLE_TUNEMU
#ifdef ENABLE_TUNEMU
-#include "
bsd/
tunemu.h"
+#include "tunemu.h"
#endif
#define DEFAULT_TUN_DEVICE "/dev/tun0"
#endif
#define DEFAULT_TUN_DEVICE "/dev/tun0"
-#if defined(HAVE_FREEBSD) || defined(HAVE_NETBSD)
+#if defined(HAVE_FREEBSD) || defined(HAVE_NETBSD)
|| defined(HAVE_DARWIN)
#define DEFAULT_TAP_DEVICE "/dev/tap0"
#else
#define DEFAULT_TAP_DEVICE "/dev/tun0"
#define DEFAULT_TAP_DEVICE "/dev/tap0"
#else
#define DEFAULT_TAP_DEVICE "/dev/tun0"
@@
-75,6
+75,8
@@
static bool setup_device(void) {
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);
+ else if(strcmp(iface, strrchr(device, '/') ? strrchr(device, '/') + 1 : device))
+ logger(LOG_WARNING, "Warning: Interface does not match Device. $INTERFACE might be set incorrectly.");
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
if(!strcasecmp(type, "tun"))
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
if(!strcasecmp(type, "tun"))