chiark / gitweb /
networkd: link - handle links coming back to life
authorTom Gundersen <teg@jklm.no>
Fri, 9 May 2014 10:11:15 +0000 (12:11 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 9 May 2014 12:41:27 +0000 (14:41 +0200)
When enslaving devices, we may receieve DELLINK/NEWLINK for the same ifindex,
let's not be confused by this.

src/network/networkd-link.c

index 7cb9ee675418101ac966b5926f0e2bba365434d9..d23be9ccbf23e7c0f37af020dbfb8d44424933af 100644 (file)
@@ -160,7 +160,7 @@ void link_drop(Link *link) {
 
         link->state = LINK_STATE_LINGER;
 
-        log_debug_link(link, "dropped");
+        log_debug_link(link, "link removed");
 
         link_unref(link);
 
@@ -1733,6 +1733,12 @@ int link_update(Link *link, sd_rtnl_message *m) {
         assert(link->ifname);
         assert(m);
 
+        if (link->state == LINK_STATE_LINGER) {
+                link_ref(link);
+                log_info_link(link, "link readded");
+                link->state = LINK_STATE_ENSLAVING;
+        }
+
         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);