modemmanager: Update patches
Allowing configuration of default bearer through modemamanger (0001) Replacing the old dirty hack for default context by a better handling specific to ublox devices. (0002 and 0003). Handling reconnect requests from the modem (0004). BugzID: 59580
This commit is contained in:
		
							parent
							
								
									a015e1d748
								
							
						
					
					
						commit
						b43b5ad630
					
				| 
						 | 
					@ -1,68 +0,0 @@
 | 
				
			||||||
From 66d04a3003f5974dbf1acd5b03b4fa7e50a1ccb0 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Alexandre Bard <alexandre.bard@netmodule.com>
 | 
					 | 
				
			||||||
Date: Wed, 12 Dec 2018 15:25:11 +0100
 | 
					 | 
				
			||||||
Subject: [PATCH] Use default PDP ctx(4) with LTE and don't try to authenticate
 | 
					 | 
				
			||||||
 on it
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 plugins/ublox/mm-broadband-bearer-ublox.c |  2 +-
 | 
					 | 
				
			||||||
 src/mm-broadband-bearer.c                 | 14 +++++++++++++-
 | 
					 | 
				
			||||||
 2 files changed, 14 insertions(+), 2 deletions(-)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/plugins/ublox/mm-broadband-bearer-ublox.c b/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
					 | 
				
			||||||
index 1adcaa2..37338de 100644
 | 
					 | 
				
			||||||
--- a/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
					 | 
				
			||||||
+++ b/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
					 | 
				
			||||||
@@ -530,7 +530,7 @@ check_supported_authentication_methods (GTask *task)
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
     /* Flag whether authentication is required. If it isn't, we won't fail
 | 
					 | 
				
			||||||
      * connection attempt if the +UAUTHREQ command fails */
 | 
					 | 
				
			||||||
-    ctx->auth_required = (user && password && allowed_auth != MM_BEARER_ALLOWED_AUTH_NONE);
 | 
					 | 
				
			||||||
+    ctx->auth_required = (ctx->cid != 4 && user && password && allowed_auth != MM_BEARER_ALLOWED_AUTH_NONE);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
     /* If we already cached the support, not do it again */
 | 
					 | 
				
			||||||
     if (self->priv->allowed_auths != MM_UBLOX_BEARER_ALLOWED_AUTH_UNKNOWN) {
 | 
					 | 
				
			||||||
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
 | 
					 | 
				
			||||||
index 779cd9a..db570bd 100644
 | 
					 | 
				
			||||||
--- a/src/mm-broadband-bearer.c
 | 
					 | 
				
			||||||
+++ b/src/mm-broadband-bearer.c
 | 
					 | 
				
			||||||
@@ -773,6 +773,7 @@ parse_cid_range (MMBaseModem              *modem,
 | 
					 | 
				
			||||||
             gchar *ip_family_str;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
             ip_family_str = mm_bearer_ip_family_build_string_from_mask (format->pdp_type);
 | 
					 | 
				
			||||||
+            if (ctx->max_cid == 3) ctx->max_cid = 4;
 | 
					 | 
				
			||||||
             if (ctx->max_cid < format->max_cid) {
 | 
					 | 
				
			||||||
                 cid = ctx->max_cid + 1;
 | 
					 | 
				
			||||||
                 mm_dbg ("Using empty CID %u with PDP type '%s'", cid, ip_family_str);
 | 
					 | 
				
			||||||
@@ -810,6 +811,7 @@ parse_pdp_list (MMBaseModem             *modem,
 | 
					 | 
				
			||||||
     GList *pdp_list;
 | 
					 | 
				
			||||||
     GList *l;
 | 
					 | 
				
			||||||
     guint cid;
 | 
					 | 
				
			||||||
+    gboolean lte_dflt_cid_detected = FALSE;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
     /* If cancelled, set result error */
 | 
					 | 
				
			||||||
     if (g_cancellable_is_cancelled (ctx->cancellable)) {
 | 
					 | 
				
			||||||
@@ -862,9 +864,19 @@ parse_pdp_list (MMBaseModem             *modem,
 | 
					 | 
				
			||||||
         g_free (ip_family_str);
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
-    /* Look for the exact PDP context we want */
 | 
					 | 
				
			||||||
+    /* Check if PDP context 4 is present */
 | 
					 | 
				
			||||||
     for (l = pdp_list; l; l = g_list_next (l)) {
 | 
					 | 
				
			||||||
         MM3gppPdpContext *pdp = l->data;
 | 
					 | 
				
			||||||
+        if(pdp->cid == 4){
 | 
					 | 
				
			||||||
+            lte_dflt_cid_detected = TRUE;
 | 
					 | 
				
			||||||
+            ctx->use_existing_cid = TRUE;
 | 
					 | 
				
			||||||
+            cid = 4;
 | 
					 | 
				
			||||||
+            break;
 | 
					 | 
				
			||||||
+        }
 | 
					 | 
				
			||||||
+    }
 | 
					 | 
				
			||||||
+    /* Look for the exact PDP context we want */
 | 
					 | 
				
			||||||
+    for (l = pdp_list; l && !lte_dflt_cid_detected; l = g_list_next (l)) {
 | 
					 | 
				
			||||||
+        MM3gppPdpContext *pdp = l->data;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
         if (pdp->pdp_type == ctx->ip_family) {
 | 
					 | 
				
			||||||
             const gchar *apn;
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.1.4
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,115 @@
 | 
				
			||||||
 | 
					From 12a4f1b2ebf65f8fc58d5707d940f5cabd3a76d4 Mon Sep 17 00:00:00 2001
 | 
				
			||||||
 | 
					From: Alexandre Bard <alexandre.bard@sunrise.ch>
 | 
				
			||||||
 | 
					Date: Thu, 5 Sep 2019 16:14:15 +0200
 | 
				
			||||||
 | 
					Subject: [PATCH 1/4] ublox: Add support for configuration of initial EPS
 | 
				
			||||||
 | 
					 bearer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BugzID: 59579
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					 plugins/ublox/mm-broadband-modem-ublox.c | 68 ++++++++++++++++++++++++
 | 
				
			||||||
 | 
					 1 file changed, 68 insertions(+)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c
 | 
				
			||||||
 | 
					index 83352fa8..475f2d5c 100644
 | 
				
			||||||
 | 
					--- a/plugins/ublox/mm-broadband-modem-ublox.c
 | 
				
			||||||
 | 
					+++ b/plugins/ublox/mm-broadband-modem-ublox.c
 | 
				
			||||||
 | 
					@@ -34,14 +34,17 @@
 | 
				
			||||||
 | 
					 #include "mm-modem-helpers-ublox.h"
 | 
				
			||||||
 | 
					 #include "mm-ublox-enums-types.h"
 | 
				
			||||||
 | 
					 #include "mm-call-ublox.h"
 | 
				
			||||||
 | 
					+#include "mm-bearer-properties.h"
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 static void iface_modem_init (MMIfaceModem *iface);
 | 
				
			||||||
 | 
					+static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
 | 
				
			||||||
 | 
					 static void iface_modem_voice_init (MMIfaceModemVoice *iface);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 static MMIfaceModemVoice *iface_modem_voice_parent;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 G_DEFINE_TYPE_EXTENDED (MMBroadbandModemUblox, mm_broadband_modem_ublox, MM_TYPE_BROADBAND_MODEM, 0,
 | 
				
			||||||
 | 
					                         G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
 | 
				
			||||||
 | 
					+                        G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
 | 
				
			||||||
 | 
					                         G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_VOICE, iface_modem_voice_init))
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 typedef enum {
 | 
				
			||||||
 | 
					@@ -674,6 +677,64 @@ common_modem_power_operation (MMBroadbandModemUblox  *self,
 | 
				
			||||||
 | 
					                               task);
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+static gboolean
 | 
				
			||||||
 | 
					+modem_3gpp_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp  *self,
 | 
				
			||||||
 | 
					+                                                   GAsyncResult      *res,
 | 
				
			||||||
 | 
					+                                                   GError           **error)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    return g_task_propagate_boolean (G_TASK (res), error);
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+static void
 | 
				
			||||||
 | 
					+modem_3gpp_set_initial_eps_bearer_settings_ready (MMBaseModem  *_self,
 | 
				
			||||||
 | 
					+                  GAsyncResult *res,
 | 
				
			||||||
 | 
					+                  GTask        *task)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    //MMBroadbandModemUblox *self  = MM_BROADBAND_MODEM_UBLOX (_self);
 | 
				
			||||||
 | 
					+    GError                *error = NULL;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    if (!mm_base_modem_at_command_full_finish (_self, res, &error))
 | 
				
			||||||
 | 
					+        g_task_return_error (task, error);
 | 
				
			||||||
 | 
					+    else
 | 
				
			||||||
 | 
					+        g_task_return_boolean(task, TRUE);
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    g_object_unref (task);
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+static void
 | 
				
			||||||
 | 
					+modem_3gpp_set_initial_eps_bearer_settings (MMIfaceModem3gpp    *self,
 | 
				
			||||||
 | 
					+                                            MMBearerProperties  *config,
 | 
				
			||||||
 | 
					+                                            GAsyncReadyCallback  callback,
 | 
				
			||||||
 | 
					+                                            gpointer             user_data)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    GTask       *task;
 | 
				
			||||||
 | 
					+    gchar *command;
 | 
				
			||||||
 | 
					+    const gchar *ucgdflt_cmd = "+UCGDFLT=0,\"%s\",\"%s\",0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,%s,%s,%s,\"\"";
 | 
				
			||||||
 | 
					+    const gchar *apn = mm_bearer_properties_get_apn (config);
 | 
				
			||||||
 | 
					+    MMBearerIpFamily ipfamily = mm_bearer_properties_get_ip_type(config);
 | 
				
			||||||
 | 
					+    const gchar *ip_family_str = ipfamily ? mm_bearer_ip_family_build_string_from_mask (ipfamily) : "IP";
 | 
				
			||||||
 | 
					+    const gchar *user = mm_bearer_properties_get_user (config);
 | 
				
			||||||
 | 
					+    const gchar *password = mm_bearer_properties_get_password (config);
 | 
				
			||||||
 | 
					+    const gchar *auth = user ? "1" : "0";
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    user = user ? user : "";
 | 
				
			||||||
 | 
					+    password = password ? password : "";
 | 
				
			||||||
 | 
					+    user = apn ? apn : "";
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    task = g_task_new (self, NULL, callback, user_data);
 | 
				
			||||||
 | 
					+    g_task_set_task_data (task, g_object_ref (config), g_object_unref);
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    command = g_strdup_printf (ucgdflt_cmd, ip_family_str, apn, auth, user, password);
 | 
				
			||||||
 | 
					+    mm_base_modem_at_command (
 | 
				
			||||||
 | 
					+        MM_BASE_MODEM (self),
 | 
				
			||||||
 | 
					+        command,
 | 
				
			||||||
 | 
					+        120,
 | 
				
			||||||
 | 
					+        FALSE,
 | 
				
			||||||
 | 
					+        (GAsyncReadyCallback) modem_3gpp_set_initial_eps_bearer_settings_ready,
 | 
				
			||||||
 | 
					+        task);
 | 
				
			||||||
 | 
					+    g_free (command);
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					 static void
 | 
				
			||||||
 | 
					 modem_reset (MMIfaceModem        *self,
 | 
				
			||||||
 | 
					              GAsyncReadyCallback  callback,
 | 
				
			||||||
 | 
					@@ -1256,6 +1317,13 @@ iface_modem_init (MMIfaceModem *iface)
 | 
				
			||||||
 | 
					     iface->set_current_bands_finish = common_set_current_modes_bands_finish;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+static void
 | 
				
			||||||
 | 
					+iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    iface->set_initial_eps_bearer_settings = modem_3gpp_set_initial_eps_bearer_settings;
 | 
				
			||||||
 | 
					+    iface->set_initial_eps_bearer_settings_finish = modem_3gpp_set_initial_eps_bearer_settings_finish;
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					 static void
 | 
				
			||||||
 | 
					 iface_modem_voice_init (MMIfaceModemVoice *iface)
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					-- 
 | 
				
			||||||
 | 
					2.20.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,43 @@
 | 
				
			||||||
 | 
					From f30f4848562366204e539312f5fbdf133c55451c Mon Sep 17 00:00:00 2001
 | 
				
			||||||
 | 
					From: Alexandre Bard <alexandre.bard@netmodule.com>
 | 
				
			||||||
 | 
					Date: Mon, 14 Oct 2019 17:33:38 +0200
 | 
				
			||||||
 | 
					Subject: [PATCH 2/4] ublox: ignore uauth failure on default PDP context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Default PDP context has to be configured using UCGDFLT and therefor
 | 
				
			||||||
 | 
					trying to use UAUTHREQ on this context lead to an unknown error,
 | 
				
			||||||
 | 
					which is used to identify this case (since no other option seems available).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In case there is really another problem leading to this error or
 | 
				
			||||||
 | 
					the default context has not been configured properly, an error will
 | 
				
			||||||
 | 
					be thrown later, when trying to connect.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BugzID: 59579
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					 plugins/ublox/mm-broadband-bearer-ublox.c | 10 +++++++++-
 | 
				
			||||||
 | 
					 1 file changed, 9 insertions(+), 1 deletion(-)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/plugins/ublox/mm-broadband-bearer-ublox.c b/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
				
			||||||
 | 
					index 10d29818..808c23d8 100644
 | 
				
			||||||
 | 
					--- a/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
				
			||||||
 | 
					+++ b/plugins/ublox/mm-broadband-bearer-ublox.c
 | 
				
			||||||
 | 
					@@ -463,8 +463,16 @@ uauthreq_ready (MMBaseModem  *modem,
 | 
				
			||||||
 | 
					         CommonConnectContext *ctx;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					         ctx = (CommonConnectContext *) g_task_get_task_data (task);
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+        // ignore unkown error thrown when trying to authenticate on default ctx
 | 
				
			||||||
 | 
					+        if (error && g_error_matches (error,
 | 
				
			||||||
 | 
					+                       MM_MOBILE_EQUIPMENT_ERROR,
 | 
				
			||||||
 | 
					+                       MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN)) {
 | 
				
			||||||
 | 
					+            mm_dbg ("u-blox: uauthreq failed with unkown error: \n"
 | 
				
			||||||
 | 
					+                    "  likely to be because of trying to authenticate on default context: ignore");
 | 
				
			||||||
 | 
					+        }
 | 
				
			||||||
 | 
					         /* If authentication required and the +UAUTHREQ failed, abort */
 | 
				
			||||||
 | 
					-        if (ctx->auth_required) {
 | 
				
			||||||
 | 
					+        else if (ctx->auth_required) {
 | 
				
			||||||
 | 
					             g_task_return_error (task, error);
 | 
				
			||||||
 | 
					             g_object_unref (task);
 | 
				
			||||||
 | 
					             return;
 | 
				
			||||||
 | 
					-- 
 | 
				
			||||||
 | 
					2.20.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,84 @@
 | 
				
			||||||
 | 
					From 33b8d7208a266e83427c490fe4e605b741b98fc8 Mon Sep 17 00:00:00 2001
 | 
				
			||||||
 | 
					From: Alexandre Bard <alexandre.bard@netmodule.com>
 | 
				
			||||||
 | 
					Date: Wed, 16 Oct 2019 17:30:34 +0200
 | 
				
			||||||
 | 
					Subject: [PATCH 3/4] broadband-modem: Choose default context over others when
 | 
				
			||||||
 | 
					 possible
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With ublox modems, the default context can be active and already
 | 
				
			||||||
 | 
					having an address. In this case trying to activate another context
 | 
				
			||||||
 | 
					will likely fail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To avoid this failure, the default context is identified during
 | 
				
			||||||
 | 
					contexts lookup by checking if an IP address has been assigned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BugzID: 59579
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					 src/mm-broadband-bearer.c |  7 ++++---
 | 
				
			||||||
 | 
					 src/mm-modem-helpers.c    | 10 ++++++++++
 | 
				
			||||||
 | 
					 src/mm-modem-helpers.h    |  1 +
 | 
				
			||||||
 | 
					 3 files changed, 15 insertions(+), 3 deletions(-)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
 | 
				
			||||||
 | 
					index 16acb2b1..94f636b6 100644
 | 
				
			||||||
 | 
					--- a/src/mm-broadband-bearer.c
 | 
				
			||||||
 | 
					+++ b/src/mm-broadband-bearer.c
 | 
				
			||||||
 | 
					@@ -869,12 +869,13 @@ parse_pdp_list (MMBaseModem             *modem,
 | 
				
			||||||
 | 
					                 cid = pdp->cid;
 | 
				
			||||||
 | 
					                 ctx->use_existing_cid = TRUE;
 | 
				
			||||||
 | 
					                 g_free (ip_family_str);
 | 
				
			||||||
 | 
					-                /* In this case, stop searching */
 | 
				
			||||||
 | 
					-                break;
 | 
				
			||||||
 | 
					+                /* In case the context has no address, try to find a better one */
 | 
				
			||||||
 | 
					+                if (pdp->has_address)
 | 
				
			||||||
 | 
					+                    break;
 | 
				
			||||||
 | 
					             }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					             /* PDP with no APN set? we may use that one if not exact match found */
 | 
				
			||||||
 | 
					-            if (!pdp->apn || !pdp->apn[0]) {
 | 
				
			||||||
 | 
					+            if (cid == 0 && (!pdp->apn || !pdp->apn[0])) {
 | 
				
			||||||
 | 
					                 mm_dbg ("Found PDP context with CID %u and no APN",
 | 
				
			||||||
 | 
					                         pdp->cid);
 | 
				
			||||||
 | 
					                 cid = pdp->cid;
 | 
				
			||||||
 | 
					diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
 | 
				
			||||||
 | 
					index cf008d73..a3b5727a 100644
 | 
				
			||||||
 | 
					--- a/src/mm-modem-helpers.c
 | 
				
			||||||
 | 
					+++ b/src/mm-modem-helpers.c
 | 
				
			||||||
 | 
					@@ -1535,6 +1535,7 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
 | 
				
			||||||
 | 
					                 mm_dbg ("Ignoring PDP context type: '%s'", str);
 | 
				
			||||||
 | 
					             else {
 | 
				
			||||||
 | 
					                 MM3gppPdpContext *pdp;
 | 
				
			||||||
 | 
					+                gchar * ip_str;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					                 pdp = g_slice_new0 (MM3gppPdpContext);
 | 
				
			||||||
 | 
					                 if (!mm_get_uint_from_match_info (match_info, 1, &pdp->cid)) {
 | 
				
			||||||
 | 
					@@ -1547,6 +1548,15 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
 | 
				
			||||||
 | 
					                 pdp->pdp_type = ip_family;
 | 
				
			||||||
 | 
					                 pdp->apn = mm_get_string_unquoted_from_match_info (match_info, 3);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+                ip_str = mm_get_string_unquoted_from_match_info (match_info, 4);
 | 
				
			||||||
 | 
					+                if (ip_str) {
 | 
				
			||||||
 | 
					+                    pdp->has_address = strlen(ip_str) > 0;
 | 
				
			||||||
 | 
					+                    g_free(ip_str);
 | 
				
			||||||
 | 
					+                }
 | 
				
			||||||
 | 
					+                else {
 | 
				
			||||||
 | 
					+                    pdp->has_address = FALSE;
 | 
				
			||||||
 | 
					+                }
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					                 list = g_list_prepend (list, pdp);
 | 
				
			||||||
 | 
					             }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
 | 
				
			||||||
 | 
					index 237046ad..a0c7a3a2 100644
 | 
				
			||||||
 | 
					--- a/src/mm-modem-helpers.h
 | 
				
			||||||
 | 
					+++ b/src/mm-modem-helpers.h
 | 
				
			||||||
 | 
					@@ -173,6 +173,7 @@ typedef struct {
 | 
				
			||||||
 | 
					     guint cid;
 | 
				
			||||||
 | 
					     MMBearerIpFamily pdp_type;
 | 
				
			||||||
 | 
					     gchar *apn;
 | 
				
			||||||
 | 
					+    gboolean has_address;
 | 
				
			||||||
 | 
					 } MM3gppPdpContext;
 | 
				
			||||||
 | 
					 void mm_3gpp_pdp_context_list_free (GList *pdp_list);
 | 
				
			||||||
 | 
					 GList *mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
 | 
				
			||||||
 | 
					-- 
 | 
				
			||||||
 | 
					2.20.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,77 @@
 | 
				
			||||||
 | 
					From ca52ad3f25a16ef9d52b1b5226309aca807067dd Mon Sep 17 00:00:00 2001
 | 
				
			||||||
 | 
					From: Alexandre Bard <alexandre.bard@netmodule.com>
 | 
				
			||||||
 | 
					Date: Wed, 9 Oct 2019 14:47:11 +0200
 | 
				
			||||||
 | 
					Subject: [PATCH 4/4] broadband-modem: Handle reconnect requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BugzID: 59455
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					 src/mm-broadband-modem.c | 43 ++++++++++++++++++++++++++++++++++++++++
 | 
				
			||||||
 | 
					 1 file changed, 43 insertions(+)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
 | 
				
			||||||
 | 
					index c1535596..a48f2e7c 100644
 | 
				
			||||||
 | 
					--- a/src/mm-broadband-modem.c
 | 
				
			||||||
 | 
					+++ b/src/mm-broadband-modem.c
 | 
				
			||||||
 | 
					@@ -2709,6 +2709,47 @@ bearer_list_report_disconnections (MMBroadbandModem *self,
 | 
				
			||||||
 | 
					     g_object_unref (list);
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					+static void
 | 
				
			||||||
 | 
					+bearer_connect (MMBaseBearer *bearer,
 | 
				
			||||||
 | 
					+                gpointer      user_data)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    guint cid;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    cid = GPOINTER_TO_UINT (user_data);
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    /* If we're told to connect a single context and this is not the
 | 
				
			||||||
 | 
					+     * bearer associated to that context, ignore operation */
 | 
				
			||||||
 | 
					+    if (cid > 0 &&
 | 
				
			||||||
 | 
					+        MM_IS_BROADBAND_BEARER (bearer) &&
 | 
				
			||||||
 | 
					+        mm_broadband_bearer_get_3gpp_cid (MM_BROADBAND_BEARER (bearer)) != cid)
 | 
				
			||||||
 | 
					+        return;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    /* If already connected, ignore operation */
 | 
				
			||||||
 | 
					+    if (mm_base_bearer_get_status (bearer) == MM_BEARER_STATUS_CONNECTED)
 | 
				
			||||||
 | 
					+        return;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    /* Try to connct */
 | 
				
			||||||
 | 
					+    mm_base_bearer_connect (bearer, NULL, NULL);
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+static void
 | 
				
			||||||
 | 
					+bearer_list_connect (MMBroadbandModem *self,
 | 
				
			||||||
 | 
					+                     guint             cid)
 | 
				
			||||||
 | 
					+{
 | 
				
			||||||
 | 
					+    MMBearerList *list = NULL;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    g_object_get (self,
 | 
				
			||||||
 | 
					+                  MM_IFACE_MODEM_BEARER_LIST, &list,
 | 
				
			||||||
 | 
					+                  NULL);
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    /* If empty bearer list, nothing else to do */
 | 
				
			||||||
 | 
					+    if (!list)
 | 
				
			||||||
 | 
					+        return;
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+    mm_bearer_list_foreach (list, (MMBearerListForeachFunc)bearer_connect, GUINT_TO_POINTER (cid));
 | 
				
			||||||
 | 
					+    g_object_unref (list);
 | 
				
			||||||
 | 
					+}
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					 static void
 | 
				
			||||||
 | 
					 cgev_process_detach (MMBroadbandModem *self,
 | 
				
			||||||
 | 
					                      MM3gppCgev        type)
 | 
				
			||||||
 | 
					@@ -2744,9 +2785,11 @@ cgev_process_primary (MMBroadbandModem *self,
 | 
				
			||||||
 | 
					     switch (type) {
 | 
				
			||||||
 | 
					     case MM_3GPP_CGEV_NW_ACT_PRIMARY:
 | 
				
			||||||
 | 
					         mm_info ("network request to activate context (cid %u)", cid);
 | 
				
			||||||
 | 
					+        bearer_list_connect(self, cid);
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					     case MM_3GPP_CGEV_ME_ACT_PRIMARY:
 | 
				
			||||||
 | 
					         mm_info ("mobile equipment request to activate context (cid %u)", cid);
 | 
				
			||||||
 | 
					+        bearer_list_connect(self, cid);
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					     case MM_3GPP_CGEV_NW_DEACT_PRIMARY:
 | 
				
			||||||
 | 
					         mm_info ("network request to deactivate context (cid %u)", cid);
 | 
				
			||||||
 | 
					-- 
 | 
				
			||||||
 | 
					2.20.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,8 @@
 | 
				
			||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 | 
					FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SRC_URI_append = " \
 | 
					SRC_URI_append = " \
 | 
				
			||||||
    ${@bb.utils.contains('MACHINE_FEATURES', 'toby-l2', 'file://0001-Use-default-PDP-ctx-4-with-LTE-and-don-t-try-to-auth.patch', '', d)} \
 | 
					    file://0001-ublox-Add-support-for-configuration-of-initial-EPS-b.patch \
 | 
				
			||||||
 | 
					    file://0002-ublox-ignore-uauth-failure-on-default-PDP-context.patch \
 | 
				
			||||||
 | 
					    file://0003-broadband-modem-Choose-default-context-over-others-w.patch \
 | 
				
			||||||
 | 
					    file://0004-broadband-modem-Handle-reconnect-requests.patch \
 | 
				
			||||||
    "
 | 
					    "
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue