chiark / gitweb /
networkd: rename link_update_flags to link_update
[elogind.git] / src / network / networkd-manager.c
index c8ec23970b6d1a276dbdbcce3cf0b1c698f347e3..724e5e5a47f654c27103115d710ffd400907b7d3 100644 (file)
@@ -22,6 +22,7 @@
 #include "path-util.h"
 #include "networkd.h"
 #include "libudev-private.h"
+#include "udev-util.h"
 
 int manager_new(Manager **ret) {
         _cleanup_manager_free_ Manager *m = NULL;
@@ -35,6 +36,8 @@ int manager_new(Manager **ret) {
         if (r < 0)
                 return r;
 
+        sd_event_set_watchdog(m->event, true);
+
         r = sd_rtnl_open(RTMGRP_LINK | RTMGRP_IPV4_IFADDR, &m->rtnl);
         if (r < 0)
                 return r;
@@ -202,19 +205,13 @@ finish:
 static int manager_dispatch_link_udev(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
         Manager *m = userdata;
         struct udev_monitor *monitor = m->udev_monitor;
-        struct udev_device *device;
-        int r;
+        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
 
         device = udev_monitor_receive_device(monitor);
         if (!device)
                 return -ENOMEM;
 
-        r = manager_process_link(m, device);
-        if (r < 0)
-                return r;
-
-        udev_device_unref(device);
-
+        manager_process_link(m, device);
         return 0;
 }
 
@@ -246,7 +243,6 @@ int manager_udev_listen(Manager *m) {
 static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
         Manager *m = userdata;
         Link *link;
-        unsigned flags;
         int r, ifindex;
 
         r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
@@ -257,11 +253,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
         if (!link)
                 return 0;
 
-        r = sd_rtnl_message_link_get_flags(message, &flags);
-        if (r < 0)
-                return 0;
-
-        r = link_update_flags(link, flags);
+        r = link_update(link, message);
         if (r < 0)
                 return 0;