From: Tommi Rekosuo <[email protected]>
If a PPP connection is active, the modem can't detach before
the PPP connection has been disabled. This can happen if
RoamingAllowed is changed when connection is active.
This leaves connman in undefined state as the context
'Active' state is not propagated properly and connman
still thinks we are connected.
---
src/gprs.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/gprs.c b/src/gprs.c
index f1146d06..9df273b1 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1547,18 +1547,26 @@ static void release_active_contexts(struct ofono_gprs
*gprs)
{
GSList *l;
struct pri_context *ctx;
+ DBusConnection *conn;
+ dbus_bool_t value;
for (l = gprs->contexts; l; l = l->next) {
struct ofono_gprs_context *gc;
ctx = l->data;
- if (ctx->active == FALSE)
+ DBG("Context id: %d", ctx->context.cid);
+
+ if (ctx->active == FALSE) {
+ DBG("Context not active");
continue;
+ }
/* This context is already being messed with */
- if (ctx->pending)
+ if (ctx->pending) {
+ DBG("Context in pending state");
continue;
+ }
gc = ctx->context_driver;
@@ -1567,6 +1575,11 @@ static void release_active_contexts(struct ofono_gprs
*gprs)
/* Make sure the context is properly cleared */
release_context(ctx);
+ value = ctx->active;
+ conn = ofono_dbus_get_connection();
+ ofono_dbus_signal_property_changed(conn, ctx->path,
+ OFONO_CONNECTION_CONTEXT_INTERFACE,
+ "Active", DBUS_TYPE_BOOLEAN, &value);
}
}
@@ -1688,6 +1701,13 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
return;
}
+ /* If PPP session if active it needs to be disconnected
+ * before the driver can send at commands */
+ if (!attach) {
+ DBG("Release active contexts");
+ release_active_contexts(gprs);
+ }
+
gprs->flags |= GPRS_FLAG_ATTACHING;
gprs->driver_attached = attach;
--
2.20.1
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono