device: add @set_permanent argument to nm_device_hw_addr_set()
In a later commit the function will be used to restore a MAC address without changing its type.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user