summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-02-28 13:50:55 +0100
committerThomas Haller <thaller@redhat.com>2020-03-17 08:13:22 +0100
commitea3912b70b9a19ab753b1ab7748695d4227e6397 (patch)
tree0b065e032748272ec21a2d272bfe2c7b7f15afc0
parent99cb791813e416c62010a629939b36a4fc31548d (diff)
downloadNetworkManager-ea3912b70b9a19ab753b1ab7748695d4227e6397.tar.gz
device: make device stage2 reentrant for NMDeviceAdsl
Configuration stages like act_stage2_config() can postpone progressing to the next stage. Currently, when the condition that we wait for gets satisfied, the code schedules the next stage from there. I think that is wrong, because when we postpone from act_stage2_config(), follow up steps of stage2 get skipped. Thus, when we are ready to progress, the class should enter stage 2 again. This requires that stage2 becomes reentrant and that the code reenters the same stage.
-rw-r--r--src/devices/adsl/nm-device-adsl.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c
index fe4055eb66..8f7cba221a 100644
--- a/src/devices/adsl/nm-device-adsl.c
+++ b/src/devices/adsl/nm-device-adsl.c
@@ -303,7 +303,7 @@ nas_update_cb (gpointer user_data)
return G_SOURCE_REMOVE;
}
- nm_device_activate_schedule_stage3_ip_config_start (device);
+ nm_device_activate_schedule_stage2_device_config (device, TRUE);
return G_SOURCE_REMOVE;
}
@@ -362,6 +362,7 @@ static NMActStageReturn
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
NMDeviceAdsl *self = NM_DEVICE_ADSL (device);
+ NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self);
NMSettingAdsl *s_adsl;
const char *protocol;
@@ -379,11 +380,16 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
if (nm_streq0 (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)) {
/* PPPoE needs RFC2684 bridging before we can do PPP over it */
- if (!br2684_create_iface (self)) {
- NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_BR2684_FAILED);
- return NM_ACT_STAGE_RETURN_FAILURE;
+ if (priv->nas_ifindex <= 0) {
+ if (priv->nas_update_id == 0) {
+ if (!br2684_create_iface (self)) {
+ NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_BR2684_FAILED);
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
+ }
+ return NM_ACT_STAGE_RETURN_POSTPONE;
}
- return NM_ACT_STAGE_RETURN_POSTPONE;
+ return NM_ACT_STAGE_RETURN_SUCCESS;
}
_LOGW (LOGD_ADSL, "unhandled ADSL protocol '%s'", protocol);