mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 02:20:22 +01:00
device: fail activation on failure to set cloned MAC address
When a user want to explicitly spoof the MAC address, a failure to do so should fail activation. For one, failing to do so may be a security problem. In any case, if user asks to configure the interface in a certain way and we fail to do so that shall result in a failure to activate.
This commit is contained in:
parent
8eed67122c
commit
143471815d
6 changed files with 15 additions and 7 deletions
|
|
@ -810,8 +810,11 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
|
||||
ret = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage1_prepare (dev, reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||
nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE);
|
||||
if (!nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE))
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||
/* If we're re-activating a PPPoE connection a short while after
|
||||
* a previous PPPoE connection was torn down, wait a bit to allow the
|
||||
* remote side to handle the disconnection. Otherwise the peer may
|
||||
|
|
|
|||
|
|
@ -510,8 +510,9 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE);
|
||||
return TRUE;
|
||||
if (!nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE))
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -303,7 +303,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
if (g_strcmp0 (priv->mode, "tap"))
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
||||
nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE);
|
||||
if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -558,7 +558,8 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE);
|
||||
if (!nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE))
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
/* Change MAC address to parent's one if needed */
|
||||
if (priv->parent)
|
||||
|
|
|
|||
|
|
@ -519,7 +519,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE);
|
||||
if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2315,7 +2315,8 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
}
|
||||
|
||||
/* Set spoof MAC to the interface */
|
||||
nm_device_hw_addr_set_cloned (device, connection, TRUE);
|
||||
if (!nm_device_hw_addr_set_cloned (device, connection, TRUE))
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
/* 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