Ignore the Interface option if device rename is impossible.
There are platforms on which it is impossible to rename the TUN/TAP device. An example is Mac OS X (tuntapx). On these platforms, specifying the Interface option will not rename the interface, but the specified name will still be passed to tinc-up scripts and the like, resulting in potential confusion for the user.
This commit is contained in:
parent
053925efeb
commit
a649aa51bf
1 changed files with 9 additions and 0 deletions
|
@ -73,6 +73,15 @@ static bool setup_device(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
||||||
|
iface = NULL;
|
||||||
|
#ifndef TAPGIFNAME
|
||||||
|
if (iface) {
|
||||||
|
logger(DEBUG_ALWAYS, LOG_WARNING, "Ignoring specified interface name '%s' as device rename is not supported on this platform", iface);
|
||||||
|
free(iface);
|
||||||
|
iface = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!iface)
|
||||||
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
|
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
|
||||||
|
|
||||||
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
|
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
|
||||||
|
|
Loading…
Reference in a new issue