From: Tom Gundersen Date: Sun, 20 Apr 2014 05:53:16 +0000 (+0200) Subject: udev: link-config - treat any non-random mac address as persistent X-Git-Tag: v213~364 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=92d927f850d4b668b44f3e5f41e266d934d03726 udev: link-config - treat any non-random mac address as persistent The address may be already changed by other processes, or set when creating the netdev from userspace. --- diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 345a380d8..7be4d24de 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -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;