From ba896a6de0335fca9a5b2ee4ad087c8b640b66c1 Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Wed, 2 Nov 2022 11:05:01 -0400 Subject: [PATCH] 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) --- src/udev/net/link-config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 28c0e633a3..cdad078f02 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -844,8 +844,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, ¤t_altnames);