chiark / gitweb /
networkd: link - don't fail if master netdev already exists
[elogind.git] / src / network / networkd-link.c
index 8674eee9487a8949ed05d1deb25e63fcddd9d1ad..a523a3e9b2d7f47f16785e9ef8b3a46d7d671fd0 100644 (file)
@@ -78,7 +78,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
 
         r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
         if (r < 0)
-                return r;
+                log_debug_link(link, "MAC address not found for new device, continuing without");
 
         r = asprintf(&link->state_file, "/run/systemd/netif/links/%"PRIu64,
                      link->ifindex);
@@ -1723,6 +1723,8 @@ static int link_enslaved(Link *link) {
         assert(link->state == LINK_STATE_ENSLAVING);
         assert(link->network);
 
+        log_debug_link(link, "enslaved");
+
         if (!(link->flags & IFF_UP)) {
                 r = link_up(link);
                 if (r < 0) {
@@ -1749,7 +1751,7 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
                 return 1;
 
         r = sd_rtnl_message_get_errno(m);
-        if (r < 0) {
+        if (r < 0 && r != -EEXIST) {
                 log_struct_link(LOG_ERR, link,
                                 "MESSAGE=%-*s: could not enslave: %s",
                                 IFNAMSIZ,
@@ -1760,9 +1762,7 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
                 return 1;
         }
 
-        log_debug_link(link, "enslaved");
-
-        if (link->enslaving == 0)
+        if (link->enslaving <= 0)
                 link_enslaved(link);
 
         return 1;