From 1ceea259c3ba5efb9b8b12161e75256270ba4804 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 27 Feb 2016 14:46:01 +0100 Subject: [PATCH] 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. # Conflicts: # src/bsd/device.c --- src/cygwin/device.c | 3 +++ src/mingw/device.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/cygwin/device.c b/src/cygwin/device.c index 4c3a60d..b04a747 100644 --- a/src/cygwin/device.c +++ b/src/cygwin/device.c @@ -59,6 +59,9 @@ static bool setup_device(void) { get_config_string(lookup_config(config_tree, "Device"), &device); get_config_string(lookup_config(config_tree, "Interface"), &iface); + if(device && interface) + logger(LOG_WARNING, "Warning: both Device and Interface specified, results may not be as expected"); + /* Open registry and look for network adapters */ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key)) { diff --git a/src/mingw/device.c b/src/mingw/device.c index 231a264..7a462ba 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -101,6 +101,9 @@ static bool setup_device(void) { get_config_string(lookup_config(config_tree, "Device"), &device); get_config_string(lookup_config(config_tree, "Interface"), &iface); + if(device && interface) + logger(LOG_WARNING, "Warning: both Device and Interface specified, results may not be as expected"); + /* Open registry and look for network adapters */ if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key)) { -- 2.25.1