summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-10 14:01:23 +0100
committerThomas Haller <thaller@redhat.com>2019-02-14 08:00:29 +0100
commitc3751a25a15f1b260624730aeec48d41fe7eb3af (patch)
tree84fbe51d041450b4444300bea66c6e0a7e8a5245
parentb45b087bbe52ac3a585a41a89f64d329eda423c9 (diff)
downloadNetworkManager-c3751a25a15f1b260624730aeec48d41fe7eb3af.tar.gz
device: add mechanism to invoke act_stage2_config() function also for external/assume case
Usually, for external/assume we skip calling act_stage2_config(). Add a flag that allows the device to indicate that it always wants to be called. This is useful, if the device wants to do some initialization also for external/assume cases.
-rw-r--r--src/devices/nm-device.c7
-rw-r--r--src/devices/nm-device.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 7ef6689107..2d4ae32cd9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6486,6 +6486,7 @@ static void
activate_stage2_device_config (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ NMDeviceClass *klass;
NMActStageReturn ret;
gboolean no_firmware = FALSE;
CList *iter;
@@ -6513,10 +6514,12 @@ activate_stage2_device_config (NMDevice *self)
}
}
- if (!nm_device_sys_iface_state_is_external_or_assume (self)) {
+ klass = NM_DEVICE_GET_CLASS (self);
+ if ( klass->act_stage2_config_also_for_external_or_assume
+ || !nm_device_sys_iface_state_is_external_or_assume (self)) {
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
- ret = NM_DEVICE_GET_CLASS (self)->act_stage2_config (self, &failure_reason);
+ ret = klass->act_stage2_config (self, &failure_reason);
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
return;
if (ret != NM_ACT_STAGE_RETURN_SUCCESS) {
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index b684e2f943..303b92325b 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -456,6 +456,11 @@ typedef struct _NMDeviceClass {
guint32 (* get_dhcp_timeout) (NMDevice *self,
int addr_family);
+
+ /* Controls, whether to call act_stage2_config() callback also for assuming
+ * a device or for external activations. In this case, act_stage2_config() must
+ * take care not to touch the device's configuration. */
+ bool act_stage2_config_also_for_external_or_assume:1;
} NMDeviceClass;
typedef void (*NMDeviceAuthRequestFunc) (NMDevice *device,