[PATCH] huawei: ensure MMBearerConnectResult populated into GSimpleAsyncResult
Ben Chan
benchan at chromium.org
Wed Aug 2 00:01:04 UTC 2017
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.
---
plugins/huawei/mm-broadband-bearer-huawei.c | 20 ++++++++------------
1 file 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);
}
--
2.14.0.rc1.383.gd1ce394fe2-goog
More information about the ModemManager-devel
mailing list