mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 11:40:08 +01:00
device: when activating without cloned-mac-address, set the permanent one
Don't rely on what's already on the device. It could be that the MAC address set on the device is not meaningful -- the NM crashed while two devices were teamed together and now they have the same hardware address and now it's impossible to bond them with mode=5.
This commit is contained in:
parent
ec35542cd5
commit
f541a17270
7 changed files with 11 additions and 13 deletions
|
|
@ -819,8 +819,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
if (s_wired) {
|
||||
/* Set device MAC address if the connection wants to change it */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_ETHER);
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_ETHER);
|
||||
}
|
||||
|
||||
/* If we're re-activating a PPPoE connection a short while after
|
||||
|
|
|
|||
|
|
@ -508,8 +508,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
if (s_wired) {
|
||||
/* Set device MAC address if the connection wants to change it */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_HW);
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_HW);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -302,8 +302,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
if (s_wired) {
|
||||
/* Set device MAC address if the connection wants to change it */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
|
||||
}
|
||||
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -551,8 +551,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
if (s_wired) {
|
||||
/* Set device MAC address if the connection wants to change it */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_VLAN);
|
||||
nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_VLAN);
|
||||
}
|
||||
|
||||
s_vlan = (NMSettingVlan *) nm_device_get_applied_setting (dev, NM_TYPE_SETTING_VLAN);
|
||||
|
|
|
|||
|
|
@ -517,8 +517,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
if (s_wired) {
|
||||
/* Set device MAC address if the connection wants to change it */
|
||||
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
|
||||
}
|
||||
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -10858,7 +10858,11 @@ nm_device_set_hw_addr (NMDevice *self, const char *addr,
|
|||
const char *cur_addr = nm_device_get_hw_address (self);
|
||||
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
|
||||
|
||||
g_return_val_if_fail (addr != NULL, FALSE);
|
||||
/* Fall back to the permanent address */
|
||||
if (!addr)
|
||||
addr = priv->perm_hw_addr;
|
||||
if (!addr)
|
||||
return FALSE;
|
||||
|
||||
/* Do nothing if current MAC is same */
|
||||
if (cur_addr && nm_utils_hwaddr_matches (cur_addr, -1, addr, -1)) {
|
||||
|
|
|
|||
|
|
@ -2316,8 +2316,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
|
||||
/* Set spoof MAC to the interface */
|
||||
cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless);
|
||||
if (cloned_mac)
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_WIFI);
|
||||
nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_WIFI);
|
||||
|
||||
/* AP mode never uses a specific object or existing scanned AP */
|
||||
if (priv->mode != NM_802_11_MODE_AP) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue