summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-08-31 20:01:12 +0200
committerThomas Haller <thaller@redhat.com>2016-09-06 18:35:34 +0200
commitc557fcefb1508c98acad296cbf2d914351c3a6a3 (patch)
tree9219e1aa64ab036e1d1257d770438a666c8c4382
parent42698024b2e1755e8b3e6ead61187fd51c1e200d (diff)
downloadNetworkManager-c557fcefb1508c98acad296cbf2d914351c3a6a3.tar.gz
device: add new result NM_ACT_STAGE_RETURN_IP_DONE for ip config activation
This is like NM_ACT_STAGE_RETURN_SUCCESS, except it should only set the IP state without commiting an NMIP[46]Config instance.
-rw-r--r--src/devices/nm-device-private.h4
-rw-r--r--src/devices/nm-device.c53
2 files changed, 30 insertions, 27 deletions
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
index 0274431bb9..927dc8c46c 100644
--- a/src/devices/nm-device-private.h
+++ b/src/devices/nm-device-private.h
@@ -31,6 +31,10 @@ enum NMActStageReturn {
NM_ACT_STAGE_RETURN_SUCCESS, /* Activation stage done */
NM_ACT_STAGE_RETURN_POSTPONE, /* Long-running operation in progress */
NM_ACT_STAGE_RETURN_IP_WAIT, /* IP config stage is waiting (state IP_WAIT) */
+ NM_ACT_STAGE_RETURN_IP_DONE, /* IP config stage is done (state IP_DONE),
+ For the ip-config stage, this is similar to
+ NM_ACT_STAGE_RETURN_SUCCESS, except that no
+ IP config should be commited. */
NM_ACT_STAGE_RETURN_IP_FAIL, /* IP config stage failed (state IP_FAIL), activation may proceed */
};
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 101d86e44c..3938c1a0dc 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5438,12 +5438,15 @@ act_stage3_ip4_config_start (NMDevice *self,
ipv4_dad_start (self, configs, ipv4_manual_method_apply);
ret = NM_ACT_STAGE_RETURN_POSTPONE;
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) {
- *out_config = shared4_new_config (self, connection, reason);
- if (*out_config) {
- priv->dnsmasq_manager = nm_dnsmasq_manager_new (nm_device_get_ip_iface (self));
- ret = NM_ACT_STAGE_RETURN_SUCCESS;
+ if (out_config) {
+ *out_config = shared4_new_config (self, connection, reason);
+ if (*out_config) {
+ priv->dnsmasq_manager = nm_dnsmasq_manager_new (nm_device_get_ip_iface (self));
+ ret = NM_ACT_STAGE_RETURN_SUCCESS;
+ } else
+ ret = NM_ACT_STAGE_RETURN_FAILURE;
} else
- ret = NM_ACT_STAGE_RETURN_FAILURE;
+ g_return_val_if_reached (NM_ACT_STAGE_RETURN_FAILURE);
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) {
apply_mtu_from_config (self);
/* Nothing else to do... */
@@ -6806,8 +6809,6 @@ act_stage3_ip6_config_start (NMDevice *self,
} else
ret = NM_ACT_STAGE_RETURN_POSTPONE;
} else if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0) {
- /* New blank config */
- *out_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self));
ret = NM_ACT_STAGE_RETURN_SUCCESS;
} else
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method);
@@ -6853,14 +6854,13 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
_set_ip_state (self, AF_INET, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
- if (!ip4_config) {
- /* Early finish, nothing more to do */
- _set_ip_state (self, AF_INET, IP_DONE);
- check_ip_done (self);
- } else {
- nm_device_activate_schedule_ip4_config_result (self, ip4_config);
- g_object_unref (ip4_config);
- }
+ if (!ip4_config)
+ ip4_config = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
+ nm_device_activate_schedule_ip4_config_result (self, ip4_config);
+ g_object_unref (ip4_config);
+ } else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
+ _set_ip_state (self, AF_INET, IP_DONE);
+ check_ip_done (self);
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE;
@@ -6895,18 +6895,17 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
_set_ip_state (self, AF_INET6, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
- if (!ip6_config) {
- /* Early finish, nothing more to do */
- _set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_done (self);
- } else {
- /* Here we get a static IPv6 config, like for Shared where it's
- * autogenerated or from modems where it comes from ModemManager.
- */
- g_warn_if_fail (priv->ac_ip6_config == NULL);
- priv->ac_ip6_config = ip6_config;
- nm_device_activate_schedule_ip6_config_result (self);
- }
+ if (!ip6_config)
+ ip6_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self));
+ /* Here we get a static IPv6 config, like for Shared where it's
+ * autogenerated or from modems where it comes from ModemManager.
+ */
+ g_warn_if_fail (priv->ac_ip6_config == NULL);
+ priv->ac_ip6_config = ip6_config;
+ nm_device_activate_schedule_ip6_config_result (self);
+ } else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
+ _set_ip_state (self, AF_INET6, IP_DONE);
+ check_ip_done (self);
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE;