From b8941f74c87b56c341d0f4f14aae8aab268eadc0 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 19 Apr 2014 20:39:17 +0200 Subject: networkd: link - track interface renames --- src/network/networkd-link.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/network') 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) -- cgit v1.2.3-54-g00ecf