summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-08-29 15:33:33 +0200
committerThomas Haller <thaller@redhat.com>2016-09-09 14:10:27 +0200
commit398e1e8b3c7e63161e7a3c8ac614bb29fd7e3e7c (patch)
tree47e7d6b691035948365879766a87a87d4c97c426
parent94f42e9bec87fa2b62fc368d2eace8f3323778b4 (diff)
downloadNetworkManager-398e1e8b3c7e63161e7a3c8ac614bb29fd7e3e7c.tar.gz
device: remove unneeded activation-stage result NM_ACT_STAGE_RETURN_FINISH
We can express FINISH by returning SUCCESS and not set out_config in act_stage3_ip4_config_start().
-rw-r--r--src/devices/nm-device-private.h1
-rw-r--r--src/devices/nm-device.c44
2 files changed, 24 insertions, 21 deletions
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
index c85cb969ba..a91bb422f2 100644
--- a/src/devices/nm-device-private.h
+++ b/src/devices/nm-device-private.h
@@ -32,7 +32,6 @@ enum NMActStageReturn {
NM_ACT_STAGE_RETURN_POSTPONE, /* Long-running operation in progress */
NM_ACT_STAGE_RETURN_WAIT, /* Not ready to start stage; wait */
NM_ACT_STAGE_RETURN_STOP, /* Activation not wanted */
- NM_ACT_STAGE_RETURN_FINISH /* Activation stage done; nothing to do */
};
#define NM_DEVICE_CAP_NONSTANDARD_CARRIER 0x80000000
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index b776a24dc4..790a4a93c7 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5995,7 +5995,7 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason)
}
/* success; already have the LL address; kick off DHCP */
- g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS || ret == NM_ACT_STAGE_RETURN_FINISH);
+ g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
}
if (!dhcp6_start_with_link_ready (self, connection)) {
@@ -6182,7 +6182,7 @@ linklocal6_start (NMDevice *self)
if ( priv->ip6_config
&& nm_ip6_config_get_address_first_nontentative (priv->ip6_config, TRUE))
- return NM_ACT_STAGE_RETURN_FINISH;
+ return NM_ACT_STAGE_RETURN_SUCCESS;
connection = nm_device_get_applied_connection (self);
g_assert (connection);
@@ -6507,7 +6507,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
}
/* success; already have the LL address; kick off router discovery */
- g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS || ret == NM_ACT_STAGE_RETURN_FINISH);
+ g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
return addrconf6_start_with_link_ready (self);
}
@@ -6797,8 +6797,6 @@ act_stage3_ip6_config_start (NMDevice *self,
} 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));
- g_assert (*out_config);
-
ret = NM_ACT_STAGE_RETURN_SUCCESS;
} else
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method);
@@ -6841,14 +6839,19 @@ 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) {
- g_assert (ip4_config);
- nm_device_activate_schedule_ip4_config_result (self, ip4_config);
- g_object_unref (ip4_config);
+ 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);
+ }
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE;
} else if (ret == NM_ACT_STAGE_RETURN_STOP) {
- /* Early finish */
+ /* Activation not wanted */
_set_ip_state (self, AF_INET, IP_FAIL);
} else if (ret == NM_ACT_STAGE_RETURN_WAIT) {
/* Wait for something to try IP config again */
@@ -6878,23 +6881,24 @@ 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) {
- g_assert (ip6_config);
- /* 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) {
+ /* 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);
+ }
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE;
} else if (ret == NM_ACT_STAGE_RETURN_STOP) {
/* Activation not wanted */
_set_ip_state (self, AF_INET6, IP_FAIL);
- } else if (ret == NM_ACT_STAGE_RETURN_FINISH) {
- /* Early finish, nothing more to do */
- _set_ip_state (self, AF_INET6, IP_DONE);
- check_ip_done (self);
} else if (ret == NM_ACT_STAGE_RETURN_WAIT) {
/* Wait for something to try IP config again */
_set_ip_state (self, AF_INET6, IP_WAIT);