Skip to content

Commit 080afbb

Browse files
committed
sd-netlink: do not swap old name and alternative name
Commit 434a348 ("netlink: do not fail when new interface name is already used as an alternative name") added logic to set the old interface name as an alternative name, but only when the new name is currently an alternative name. This is not the desired outcome in most cases, and the important part of this commit was to delete the new name from the list of alternative names if necessary.
1 parent d0b31ef commit 080afbb

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/libsystemd/sd-netlink/netlink-util.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "sd-netlink.h"
44

55
#include "fd-util.h"
6-
#include "format-util.h"
76
#include "io-util.h"
87
#include "memory-util.h"
98
#include "netlink-internal.h"
@@ -15,7 +14,6 @@
1514
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
1615
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
1716
_cleanup_strv_free_ char **alternative_names = NULL;
18-
char old_name[IF_NAMESIZE] = {};
1917
int r;
2018

2119
assert(rtnl);
@@ -35,10 +33,6 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
3533
if (r < 0)
3634
return log_debug_errno(r, "Failed to remove '%s' from alternative names on network interface %i: %m",
3735
name, ifindex);
38-
39-
r = format_ifname(ifindex, old_name);
40-
if (r < 0)
41-
return log_debug_errno(r, "Failed to get current name of network interface %i: %m", ifindex);
4236
}
4337

4438
r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex);
@@ -53,13 +47,6 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
5347
if (r < 0)
5448
return r;
5549

56-
if (!isempty(old_name)) {
57-
r = rtnl_set_link_alternative_names(rtnl, ifindex, STRV_MAKE(old_name));
58-
if (r < 0)
59-
log_debug_errno(r, "Failed to set '%s' as an alternative name on network interface %i, ignoring: %m",
60-
old_name, ifindex);
61-
}
62-
6350
return 0;
6451
}
6552

0 commit comments

Comments
 (0)