chiark / gitweb /
udev: link-config - treat any non-random mac address as persistent
authorTom Gundersen <teg@jklm.no>
Sun, 20 Apr 2014 05:53:16 +0000 (07:53 +0200)
committerTom Gundersen <teg@jklm.no>
Sun, 20 Apr 2014 08:28:28 +0000 (10:28 +0200)
The address may be already changed by other processes, or set
when creating the netdev from userspace.

src/udev/net/link-config.c

index 345a380..7be4d24 100644 (file)
@@ -278,22 +278,6 @@ static bool mac_is_random(struct udev_device *device) {
         return type == 1;
 }
 
-static bool mac_is_permanent(struct udev_device *device) {
-        const char *s;
-        unsigned type;
-        int r;
-
-        s = udev_device_get_sysattr_value(device, "addr_assign_type");
-        if (!s)
-                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;
-}
-
 static int get_mac(struct udev_device *device, bool want_random, struct ether_addr *mac) {
         int r;
 
@@ -389,7 +373,7 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
 
         switch (config->mac_policy) {
                 case MACPOLICY_PERSISTENT:
-                        if (!mac_is_permanent(device)) {
+                        if (mac_is_random(device)) {
                                 r = get_mac(device, false, &generated_mac);
                                 if (r < 0)
                                         return r;