diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c index 5569f55848..5476e357f4 100644 --- a/libnm-core/nm-setting-wired.c +++ b/libnm-core/nm-setting-wired.c @@ -1150,7 +1150,8 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) * Beside explicitly specifing a MAC address, the special values "preserve", "permanent", * "random" and "stable" are supported. * "preserve" means not to touch the MAC address on activation. - * "permanent" means to use the permanent hardware address of the device. + * "permanent" means to use the permanent hardware address if the device + * has one (otherwise this is treated as "preserve"). * "random" creates a random MAC address on each connect. * "stable" creates a hashed MAC address based on connection.stable-id and a * machine dependent key. diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index fbf315ed3b..45a71032bd 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -13475,8 +13475,17 @@ _hw_addr_get_cloned (NMDevice *self, NMConnection *connection, gboolean is_wifi, } if (nm_streq (addr, NM_CLONED_MAC_PERMANENT)) { - addr = nm_device_get_permanent_hw_address (self); - if (!addr) { + gboolean is_fake; + + addr = nm_device_get_permanent_hw_address_full (self, TRUE, &is_fake); + if (is_fake) { + /* Preserve the current address if the permanent address if fake */ + NM_SET_OUT (preserve, TRUE); + NM_SET_OUT (hwaddr, NULL); + NM_SET_OUT (hwaddr_type, HW_ADDR_TYPE_UNSET); + NM_SET_OUT (hwaddr_detail, g_steal_pointer (&addr_setting_free) ?: g_strdup (addr_setting)); + return TRUE; + } else if (!addr) { g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,