summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-20 07:53:16 +0200
committerTom Gundersen <teg@jklm.no>2014-04-20 10:28:28 +0200
commit92d927f850d4b668b44f3e5f41e266d934d03726 (patch)
tree741374af33d058fae68510e76017579a9d3f00a0
parent6190b9f9d2574428d560458a99f2838041cfdaac (diff)
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.
-rw-r--r--src/udev/net/link-config.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 345a380d85..7be4d24de7 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;