diff options
author | Thomas Haller <thaller@redhat.com> | 2016-08-29 15:33:33 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-09-06 18:35:34 +0200 |
commit | e6103741494e49ee6b9e80a7a1bf9c50674e06c8 (patch) | |
tree | b7b6dab1e4fdf548da07002bbc6db5d8256bcbab | |
parent | 6f0d326c963b85bb3d60fdac08aad57babbebf3c (diff) | |
download | NetworkManager-e6103741494e49ee6b9e80a7a1bf9c50674e06c8.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.h | 1 | ||||
-rw-r--r-- | src/devices/nm-device.c | 44 |
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 f4a113634d..af6984655d 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6006,7 +6006,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)) { @@ -6193,7 +6193,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); @@ -6518,7 +6518,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); } @@ -6808,8 +6808,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); @@ -6852,14 +6850,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 */ @@ -6889,23 +6892,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); |