chiark / gitweb /
rtnl: introduce default timeout
[elogind.git] / src / udev / net / link-config.c
index cc8ff6fda781625ce05ec5b19c973dac25739355..9d6c96b5a5cf1f1ff8f8cd779215875a690f7c37 100644 (file)
@@ -293,7 +293,7 @@ static int rtnl_set_properties(sd_rtnl *rtnl, int ifindex, const char *name, con
         }
 
         if  (need_update) {
-                r = sd_rtnl_send_with_reply_and_block(rtnl, message, 5 * USEC_PER_SEC, NULL);
+                r = sd_rtnl_send_with_reply_and_block(rtnl, message, 0, NULL);
                 if (r < 0)
                         return r;
         }
@@ -322,12 +322,15 @@ static bool enable_name_policy(void) {
 
 static bool mac_is_random(struct udev_device *device) {
         const char *s;
-        int type;
+        unsigned type;
+        int r;
 
         s = udev_device_get_sysattr_value(device, "addr_assign_type");
         if (!s)
-                return -EINVAL;
-        type = strtoul(s, NULL, 0);
+                return false; /* if we don't know, assume it is not random */
+        r = safe_atou(s, &type);
+        if (r < 0)
+                return false;
 
         /* check for NET_ADDR_RANDOM */
         return type == 1;
@@ -335,12 +338,15 @@ static bool mac_is_random(struct udev_device *device) {
 
 static bool mac_is_permanent(struct udev_device *device) {
         const char *s;
-        int type;
+        unsigned type;
+        int r;
 
         s = udev_device_get_sysattr_value(device, "addr_assign_type");
         if (!s)
-                return -EINVAL;
-        type = strtoul(s, NULL, 0);
+                return true; /* if we don't know, assume it is permanent */
+        r = safe_atou(s, &type);
+        if (r < 0)
+                return true;
 
         /* check for NET_ADDR_PERM */
         return type == 0;
@@ -365,13 +371,13 @@ static int get_mac(struct udev_device *device, bool want_random, struct ether_ad
                         if (!name) {
                                 name = udev_device_get_property_value(device, "ID_NET_NAME_PATH");
                                 if (!name)
-                                        return -1;
+                                        return -ENOENT;
                         }
                 }
                 /* fetch some persistent data unique to this machine */
                 r = sd_id128_get_machine(&machine);
                 if (r < 0)
-                        return -1;
+                        return r;
 
                 /* combine the data */
                 seed_str = strappenda(name, sd_id128_to_string(machine, machineid_buf));