aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2017-08-01 17:01:04 -0700
committerAleksander Morgado <aleksander@aleksander.es>2017-08-03 12:35:40 +0200
commite1823e605e69121fae50e6ca3c097ad7a94156f4 (patch)
tree902049ce69d79dfc43eea092a1d771c5dbc32976
parent0bb01ab68d36e63d08f9ed827524a24829c26835 (diff)
huawei: ensure MMBearerConnectResult populated into GSimpleAsyncResult
During the CONNECT_3GPP_CONTEXT_STEP_LAST step, connect_3gpp_context_step() conditionally creates and populates a MMBearerConnectResult object into the GSimpleAsyncResult object when the ipv4_config field of the Connect3gppContext struct is set. That assumes the ipv4_config field is always initialized in connect_dhcp_check_ready() during the CONNECT_3GPP_CONTEXT_STEP_IP_CONFIG step. Instead of having such an assumption, this patch modifies connect_3gpp to always initialize the ipv4_config field, such that connect_3gpp_context_step() always populates a MMBearerConnectResult object into the GSimpleAsyncResult object.
-rw-r--r--plugins/huawei/mm-broadband-bearer-huawei.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c
index 124b8ed1..175fe5b6 100644
--- a/plugins/huawei/mm-broadband-bearer-huawei.c
+++ b/plugins/huawei/mm-broadband-bearer-huawei.c
@@ -129,10 +129,6 @@ connect_dhcp_check_ready (MMBaseModem *modem,
/* Balance refcount */
g_object_unref (self);
- /* Default to automatic/DHCP addressing */
- ctx->ipv4_config = mm_bearer_ip_config_new ();
- mm_bearer_ip_config_set_method (ctx->ipv4_config, MM_BEARER_IP_METHOD_DHCP);
-
/* Cache IPv4 details if available, otherwise clients will have to use DHCP */
response = mm_base_modem_at_command_full_finish (modem, res, &error);
if (response) {
@@ -482,14 +478,10 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
ctx->self->priv->connect_pending = NULL;
/* Setup result */
- {
- if (ctx->ipv4_config) {
- g_simple_async_result_set_op_res_gpointer (
- ctx->result,
- mm_bearer_connect_result_new (ctx->data, ctx->ipv4_config, NULL),
- (GDestroyNotify)mm_bearer_connect_result_unref);
- }
- }
+ g_simple_async_result_set_op_res_gpointer (
+ ctx->result,
+ mm_bearer_connect_result_new (ctx->data, ctx->ipv4_config, NULL),
+ (GDestroyNotify)mm_bearer_connect_result_unref);
connect_3gpp_context_complete_and_free (ctx);
return;
@@ -540,6 +532,10 @@ connect_3gpp (MMBroadbandBearer *self,
/* Get correct dial port to use */
ctx->primary = get_dial_port (MM_BROADBAND_MODEM_HUAWEI (ctx->modem), ctx->data, primary);
+ /* Default to automatic/DHCP addressing */
+ ctx->ipv4_config = mm_bearer_ip_config_new ();
+ mm_bearer_ip_config_set_method (ctx->ipv4_config, MM_BEARER_IP_METHOD_DHCP);
+
/* Run! */
connect_3gpp_context_step (ctx);
}