From: Guus Sliepen Date: Sat, 27 Feb 2016 13:46:01 +0000 (+0100) Subject: Add warnings for bad combinations of Device and Interface. X-Git-Tag: release-1.1pre12~60 X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=1ceea259c3ba5efb9b8b12161e75256270ba4804 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 --- diff --git a/src/cygwin/device.c b/src/cygwin/device.c index 4c3a60d9..b04a7478 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 231a264d..7a462ba5 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)) {