Skip to content

Commit

Permalink
Always rename an interface to its name specified in config if no Name…
Browse files Browse the repository at this point in the history
…Policy= is specified

This is for issue systemd#9006
  • Loading branch information
Mathieu Trudel-Lapierre authored and poettering committed Nov 12, 2018
1 parent 60d540f commit 55b6530
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/udev/net/link-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,11 @@ static bool should_rename(sd_device *device, bool respect_predictable) {
return true;

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:
/* the kernel claims to have given a predictable name */
if (respect_predictable)
return false;
_fallthrough_;
case NET_NAME_ENUM:
default:
/* the name is known to be bad, or of an unknown type */
return true;
Expand Down Expand Up @@ -443,12 +438,8 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
}
}

if (should_rename(device, respect_predictable)) {
/* if not set by policy, fall back manually set name */
if (!new_name)
new_name = config->name;
} else
new_name = NULL;
if (!new_name && should_rename(device, respect_predictable))
new_name = config->name;

switch (config->mac_policy) {
case MACPOLICY_PERSISTENT:
Expand Down

0 comments on commit 55b6530

Please sign in to comment.