diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index 927dc8c46..c5b4936b5 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -57,7 +57,10 @@ gboolean nm_device_bring_up (NMDevice *self, gboolean wait, gboolean *no_firmwar void nm_device_take_down (NMDevice *self, gboolean block); -gboolean nm_device_hw_addr_set (NMDevice *device, const char *addr, const char *detail); +gboolean nm_device_hw_addr_set (NMDevice *device, + const char *addr, + const char *detail, + gboolean set_permanent); gboolean nm_device_hw_addr_set_cloned (NMDevice *device, NMConnection *connection, gboolean is_wifi); gboolean nm_device_hw_addr_reset (NMDevice *device, const char *detail); diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index 87a36130b..f80f8efff 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -117,7 +117,7 @@ parent_hwaddr_maybe_changed (NMDevice *parent, _LOGD (LOGD_VLAN, "parent hardware address changed to %s%s%s", NM_PRINT_FMT_QUOTE_STRING (new_mac)); if (new_mac) { - nm_device_hw_addr_set ((NMDevice *) self, new_mac, "vlan-parent"); + nm_device_hw_addr_set ((NMDevice *) self, new_mac, "vlan-parent", TRUE); /* When changing the hw address the interface is taken down, * removing the IPv6 configuration; reapply it. */ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 27c111964..7b41ee911 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -12049,7 +12049,10 @@ handle_fail: } gboolean -nm_device_hw_addr_set (NMDevice *self, const char *addr, const char *detail) +nm_device_hw_addr_set (NMDevice *self, + const char *addr, + const char *detail, + gboolean set_permanent) { NMDevicePrivate *priv; @@ -12060,10 +12063,13 @@ nm_device_hw_addr_set (NMDevice *self, const char *addr, const char *detail) if (!addr) g_return_val_if_reached (FALSE); - /* this is called by NMDeviceVlan to take the MAC address from the parent - * and by NMDeviceWifi to set a random MAC address during scanning. - * In this case, it's like setting it to PERMANENT. */ - priv->hw_addr_type = HW_ADDR_TYPE_PERMANENT; + if (set_permanent) { + /* The type is set to PERMANENT by NMDeviceVlan when taking the MAC + * address from the parent and by NMDeviceWifi when setting a random MAC + * address during scanning. + */ + priv->hw_addr_type = HW_ADDR_TYPE_PERMANENT; + } return _hw_addr_set (self, addr, "set", detail); } diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 8381aaccb..89fa49e4f 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -1107,7 +1107,7 @@ _hw_addr_set_scanning (NMDeviceWifi *self, gboolean do_reset) generate_mac_address_mask); } - nm_device_hw_addr_set (device, priv->hw_addr_scan, "scanning"); + nm_device_hw_addr_set (device, priv->hw_addr_scan, "scanning", TRUE); } static void