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().
This commit is contained in:
Thomas Haller
2016-08-29 15:33:33 +02:00
parent 94f42e9bec
commit 398e1e8b3c
2 changed files with 24 additions and 21 deletions

View File

@@ -32,7 +32,6 @@ enum NMActStageReturn {
NM_ACT_STAGE_RETURN_POSTPONE, /* Long-running operation in progress */ 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_WAIT, /* Not ready to start stage; wait */
NM_ACT_STAGE_RETURN_STOP, /* Activation not wanted */ 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 #define NM_DEVICE_CAP_NONSTANDARD_CARRIER 0x80000000

View File

@@ -5995,7 +5995,7 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason)
} }
/* success; already have the LL address; kick off DHCP */ /* 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)) { if (!dhcp6_start_with_link_ready (self, connection)) {
@@ -6182,7 +6182,7 @@ linklocal6_start (NMDevice *self)
if ( priv->ip6_config if ( priv->ip6_config
&& nm_ip6_config_get_address_first_nontentative (priv->ip6_config, TRUE)) && 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); connection = nm_device_get_applied_connection (self);
g_assert (connection); g_assert (connection);
@@ -6507,7 +6507,7 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
} }
/* success; already have the LL address; kick off router discovery */ /* 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); 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) { } else if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) == 0) {
/* New blank config */ /* New blank config */
*out_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self)); *out_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self));
g_assert (*out_config);
ret = NM_ACT_STAGE_RETURN_SUCCESS; ret = NM_ACT_STAGE_RETURN_SUCCESS;
} else } else
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method); _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); _set_ip_state (self, AF_INET, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &reason); ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
g_assert (ip4_config); if (!ip4_config) {
nm_device_activate_schedule_ip4_config_result (self, ip4_config); /* Early finish, nothing more to do */
g_object_unref (ip4_config); _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) { } else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE; return FALSE;
} else if (ret == NM_ACT_STAGE_RETURN_STOP) { } else if (ret == NM_ACT_STAGE_RETURN_STOP) {
/* Early finish */ /* Activation not wanted */
_set_ip_state (self, AF_INET, IP_FAIL); _set_ip_state (self, AF_INET, IP_FAIL);
} else if (ret == NM_ACT_STAGE_RETURN_WAIT) { } else if (ret == NM_ACT_STAGE_RETURN_WAIT) {
/* Wait for something to try IP config again */ /* 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); _set_ip_state (self, AF_INET6, IP_CONF);
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &reason); ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
g_assert (ip6_config); if (!ip6_config) {
/* Here we get a static IPv6 config, like for Shared where it's /* Early finish, nothing more to do */
* autogenerated or from modems where it comes from ModemManager. _set_ip_state (self, AF_INET6, IP_DONE);
*/ check_ip_done (self);
g_warn_if_fail (priv->ac_ip6_config == NULL); } else {
priv->ac_ip6_config = ip6_config; /* Here we get a static IPv6 config, like for Shared where it's
nm_device_activate_schedule_ip6_config_result (self); * 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) { } else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
return FALSE; return FALSE;
} else if (ret == NM_ACT_STAGE_RETURN_STOP) { } else if (ret == NM_ACT_STAGE_RETURN_STOP) {
/* Activation not wanted */ /* Activation not wanted */
_set_ip_state (self, AF_INET6, IP_FAIL); _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) { } else if (ret == NM_ACT_STAGE_RETURN_WAIT) {
/* Wait for something to try IP config again */ /* Wait for something to try IP config again */
_set_ip_state (self, AF_INET6, IP_WAIT); _set_ip_state (self, AF_INET6, IP_WAIT);