chiark / gitweb /
dhcp: Properly handle unsuccessful cases for DHCP Ack
[elogind.git] / src / network / networkd-link.c
index 8c7b0fc1eeb8564008ddb782323fb0110c3e7e56..4cf34a6d94848680ec58c7a8d49d5bf95c6431f5 100644 (file)
@@ -248,7 +248,7 @@ static int link_get_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
 
         r = sd_rtnl_message_get_errno(m);
         if (r < 0) {
-                log_warning("Could not bring up interface '%s': %s",
+                log_warning("Could not get state of interface '%s': %s",
                             link->ifname, strerror(-r));
                 link_enter_failed(link);
         }
@@ -264,7 +264,7 @@ static int link_get(Link *link) {
         assert(link->manager);
         assert(link->manager->rtnl);
 
-        r = sd_rtnl_message_link_new(RTM_GETLINK, link->ifindex, 0, 0, &req);
+        r = sd_rtnl_message_link_new(RTM_GETLINK, link->ifindex, &req);
         if (r < 0) {
                 log_error("Could not allocate RTM_GETLINK message");
                 return r;
@@ -301,9 +301,15 @@ static int link_up(Link *link) {
         assert(link->manager);
         assert(link->manager->rtnl);
 
-        r = sd_rtnl_message_link_new(RTM_NEWLINK, link->ifindex, 0, IFF_UP, &req);
+        r = sd_rtnl_message_link_new(RTM_SETLINK, link->ifindex, &req);
+        if (r < 0) {
+                log_error("Could not allocate RTM_SETLINK message");
+                return r;
+        }
+
+        r = sd_rtnl_message_link_set_flags(req, IFF_UP);
         if (r < 0) {
-                log_error("Could not allocate RTM_NEWLINK message");
+                log_error("Could not set link flags");
                 return r;
         }