Always rename an interface to its name specified in config if no NamePolicy= is specified

This is for issue #9006
This commit is contained in:
Mathieu Trudel-Lapierre 2018-05-25 10:34:38 -04:00 committed by Lennart Poettering
parent 60d540fabd
commit 55b6530baa
1 changed files with 2 additions and 11 deletions

View File

@ -312,16 +312,11 @@ static bool should_rename(sd_device *device, bool respect_predictable) {
return true; return true;
switch (type) { switch (type) {
case NET_NAME_USER:
case NET_NAME_RENAMED:
/* these were already named by userspace, do not touch again */
return false;
case NET_NAME_PREDICTABLE: case NET_NAME_PREDICTABLE:
/* the kernel claims to have given a predictable name */ /* the kernel claims to have given a predictable name */
if (respect_predictable) if (respect_predictable)
return false; return false;
_fallthrough_; _fallthrough_;
case NET_NAME_ENUM:
default: default:
/* the name is known to be bad, or of an unknown type */ /* the name is known to be bad, or of an unknown type */
return true; return true;
@ -443,12 +438,8 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
} }
} }
if (should_rename(device, respect_predictable)) { if (!new_name && should_rename(device, respect_predictable))
/* if not set by policy, fall back manually set name */ new_name = config->name;
if (!new_name)
new_name = config->name;
} else
new_name = NULL;
switch (config->mac_policy) { switch (config->mac_policy) {
case MACPOLICY_PERSISTENT: case MACPOLICY_PERSISTENT: