summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 319f2904c0..aad72debeb 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1487,14 +1487,26 @@ int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
int link_update(Link *link, sd_rtnl_message *m) {
unsigned flags;
struct ether_addr mac;
+ char *ifname;
int r;
assert(link);
+ assert(link->ifname);
assert(m);
if (link->state == LINK_STATE_FAILED)
return 0;
+ r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
+ if (r >= 0 && !streq(ifname, link->ifname)) {
+ log_info_link(link, "renamed to %s", ifname);
+
+ free(link->ifname);
+ link->ifname = strdup(ifname);
+ if (!link->ifname)
+ return -ENOMEM;
+ }
+
if (!link->original_mtu) {
r = sd_rtnl_message_read_u16(m, IFLA_MTU, &link->original_mtu);
if (r >= 0)