1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-11 04:58:19 +03:00

udev/net: allow new link name as an altname before renaming happens

When configuring a link's alternative names, the link's new name to-be
is not allowed to be included because interface renaming will fail if
the new name is already present as an alternative name. However,
rtnl_set_link_name will delete the conflicting alternative name before
renaming the device, if necessary.

Allow the new link name to be set as an alternative name before the
device is renamed. This means that if the rename is later skipped (i.e.
because the link is already up), then the name can at least still be
present as an alternative name.

(cherry picked from commit d0b31efc1ab7f6826ad834cf6b9e371bf73776aa)
(cherry picked from commit 7918496dcf2d6c06a8cd8626c23d2a463343a9df)
(cherry picked from commit ba896a6de0335fca9a5b2ee4ad087c8b640b66c1)
This commit is contained in:
Nick Rosbrook 2022-11-02 11:05:01 -04:00 committed by Luca Boccassi
parent 71f9e1fab8
commit d57acef8ce

View File

@ -808,8 +808,6 @@ static int link_apply_alternative_names(Link *link, sd_netlink **rtnl) {
}
}
if (link->new_name)
strv_remove(altnames, link->new_name);
strv_remove(altnames, link->ifname);
r = rtnl_get_link_alternative_names(rtnl, link->ifindex, &current_altnames);