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);
|
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_set_cloned (NMDevice *device, NMConnection *connection, gboolean is_wifi);
|
||||||
gboolean nm_device_hw_addr_reset (NMDevice *device, const char *detail);
|
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",
|
_LOGD (LOGD_VLAN, "parent hardware address changed to %s%s%s",
|
||||||
NM_PRINT_FMT_QUOTE_STRING (new_mac));
|
NM_PRINT_FMT_QUOTE_STRING (new_mac));
|
||||||
if (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,
|
/* When changing the hw address the interface is taken down,
|
||||||
* removing the IPv6 configuration; reapply it.
|
* removing the IPv6 configuration; reapply it.
|
||||||
*/
|
*/
|
||||||
|
@@ -12049,7 +12049,10 @@ handle_fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
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;
|
NMDevicePrivate *priv;
|
||||||
|
|
||||||
@@ -12060,10 +12063,13 @@ nm_device_hw_addr_set (NMDevice *self, const char *addr, const char *detail)
|
|||||||
if (!addr)
|
if (!addr)
|
||||||
g_return_val_if_reached (FALSE);
|
g_return_val_if_reached (FALSE);
|
||||||
|
|
||||||
/* this is called by NMDeviceVlan to take the MAC address from the parent
|
if (set_permanent) {
|
||||||
* and by NMDeviceWifi to set a random MAC address during scanning.
|
/* The type is set to PERMANENT by NMDeviceVlan when taking the MAC
|
||||||
* In this case, it's like setting it to PERMANENT. */
|
* address from the parent and by NMDeviceWifi when setting a random MAC
|
||||||
priv->hw_addr_type = HW_ADDR_TYPE_PERMANENT;
|
* address during scanning.
|
||||||
|
*/
|
||||||
|
priv->hw_addr_type = HW_ADDR_TYPE_PERMANENT;
|
||||||
|
}
|
||||||
|
|
||||||
return _hw_addr_set (self, addr, "set", detail);
|
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);
|
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
|
static void
|
||||||
|
Reference in New Issue
Block a user