mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-22 15:50:26 +01:00
device: don't reset the MAC without ifindex
nm_device_cleanup() can be called when the device no longer has an ifindex. In such case, don't try to reset the MAC address as that would lead to an assertion failure. (cherry picked from commit77b6ce7d04) (cherry picked from commit791a888cad) (cherry picked from commite1f76e7044)
This commit is contained in:
parent
69c5c5e767
commit
5f22c06c53
1 changed files with 13 additions and 11 deletions
|
|
@ -15307,17 +15307,19 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
|
|||
|
||||
nm_device_update_metered (self);
|
||||
|
||||
/* during device cleanup, we want to reset the MAC address of the device
|
||||
* to the initial state.
|
||||
*
|
||||
* We certainly want to do that when reaching the UNMANAGED state... */
|
||||
if (nm_device_get_state (self) <= NM_DEVICE_STATE_UNMANAGED)
|
||||
nm_device_hw_addr_reset (self, "unmanage");
|
||||
else {
|
||||
/* for other device states (UNAVAILABLE, DISCONNECTED), allow the
|
||||
* device to overwrite the reset behavior, so that Wi-Fi can set
|
||||
* a randomized MAC address used during scanning. */
|
||||
NM_DEVICE_GET_CLASS (self)->deactivate_reset_hw_addr (self);
|
||||
if (ifindex > 0) {
|
||||
/* during device cleanup, we want to reset the MAC address of the device
|
||||
* to the initial state.
|
||||
*
|
||||
* We certainly want to do that when reaching the UNMANAGED state... */
|
||||
if (nm_device_get_state (self) <= NM_DEVICE_STATE_UNMANAGED)
|
||||
nm_device_hw_addr_reset (self, "unmanage");
|
||||
else {
|
||||
/* for other device states (UNAVAILABLE, DISCONNECTED), allow the
|
||||
* device to overwrite the reset behavior, so that Wi-Fi can set
|
||||
* a randomized MAC address used during scanning. */
|
||||
NM_DEVICE_GET_CLASS (self)->deactivate_reset_hw_addr (self);
|
||||
}
|
||||
}
|
||||
|
||||
priv->mtu_source = NM_DEVICE_MTU_SOURCE_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue