mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 00:30:36 +01:00
device: add mechanism to call stage1 for external or assumed devices
Usually stage1 is skipped for external or assumed devices. Add a
mechanism to call stage1 for all devices, similarly to what was
already done for stage2.
(cherry picked from commit eff0e0d123)
This commit is contained in:
parent
09fc15551c
commit
5fa12f0c14
2 changed files with 16 additions and 11 deletions
|
|
@ -6664,6 +6664,7 @@ activate_stage1_device_prepare (NMDevice *self)
|
|||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
NMActiveConnection *active;
|
||||
NMActiveConnection *master;
|
||||
NMDeviceClass *klass;
|
||||
|
||||
priv->v4_route_table_initialized = FALSE;
|
||||
priv->v6_route_table_initialized = FALSE;
|
||||
|
|
@ -6737,18 +6738,21 @@ activate_stage1_device_prepare (NMDevice *self)
|
|||
}
|
||||
|
||||
/* Assumed connections were already set up outside NetworkManager */
|
||||
if (!nm_device_sys_iface_state_is_external_or_assume (self)) {
|
||||
NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self);
|
||||
klass = NM_DEVICE_GET_CLASS (self);
|
||||
|
||||
if (klass->act_stage1_prepare_set_hwaddr_ethernet) {
|
||||
if (!nm_device_hw_addr_set_cloned (self,
|
||||
nm_device_get_applied_connection (self),
|
||||
FALSE)) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
return;
|
||||
}
|
||||
if ( klass->act_stage1_prepare_set_hwaddr_ethernet
|
||||
&& !nm_device_sys_iface_state_is_external_or_assume (self)) {
|
||||
if (!nm_device_hw_addr_set_cloned (self,
|
||||
nm_device_get_applied_connection (self),
|
||||
FALSE)) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( klass->act_stage1_prepare_also_for_external_or_assume
|
||||
|| !nm_device_sys_iface_state_is_external_or_assume (self)) {
|
||||
nm_assert (!klass->act_stage1_prepare_also_for_external_or_assume || klass->act_stage1_prepare);
|
||||
if (klass->act_stage1_prepare) {
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
|
|
|
|||
|
|
@ -445,9 +445,10 @@ typedef struct _NMDeviceClass {
|
|||
|
||||
gboolean (* set_platform_mtu) (NMDevice *self, guint32 mtu);
|
||||
|
||||
/* Controls, whether to call act_stage2_config() callback also for assuming
|
||||
* a device or for external activations. In this case, act_stage2_config() must
|
||||
/* Control whether to call stage1 and stage2 callbacks also for assuming
|
||||
* a device or for external activations. In this case, the callback must
|
||||
* take care not to touch the device's configuration. */
|
||||
bool act_stage1_prepare_also_for_external_or_assume:1;
|
||||
bool act_stage2_config_also_for_external_or_assume:1;
|
||||
|
||||
bool act_stage1_prepare_set_hwaddr_ethernet:1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue