From: Dragos Tatulea <dragos@endocode.com>
To: ofono@ofono.org
Subject: [PATCH 12/19] gprs: allow APN updates from gprs-context driver
Date: Wed, 09 Mar 2016 16:44:53 +0100 [thread overview]
Message-ID: <1457538300-7183-13-git-send-email-dragos@endocode.com> (raw)
In-Reply-To: <1457538300-7183-1-git-send-email-dragos@endocode.com>
[-- Attachment #1: Type: text/plain, Size: 2625 bytes --]
In the context activation callback, check for a changed APN. The default
PDP in a 4G network is usually automatically activated. We might not know
the APN. So allow the driver to read the APN and push it back into the
core context.
---
src/gprs.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/gprs.c b/src/gprs.c
index 9192e68..d31e91b 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -103,6 +103,7 @@ struct ipv6_settings {
};
struct context_settings {
+ char *apn;
char *interface;
struct ipv4_settings *ipv4;
struct ipv6_settings *ipv6;
@@ -383,6 +384,9 @@ static void context_settings_free(struct context_settings *settings)
settings->ipv6 = NULL;
}
+ g_free(settings->apn);
+ settings->apn = NULL;
+
g_free(settings->interface);
settings->interface = NULL;
}
@@ -867,6 +871,9 @@ static DBusMessage *pri_get_properties(DBusConnection *conn,
return reply;
}
+static DBusMessage *pri_set_apn(struct pri_context *ctx, DBusConnection *conn,
+ DBusMessage *msg, const char *apn);
+
static void pri_activate_callback(const struct ofono_error *error, void *data)
{
struct pri_context *ctx = data;
@@ -886,6 +893,11 @@ static void pri_activate_callback(const struct ofono_error *error, void *data)
return;
}
+
+ if (gc->settings->apn && strcmp(gc->settings->apn, ctx->context.apn))
+ /* APN changed during context activation. */
+ pri_set_apn(ctx, conn, NULL, gc->settings->apn);
+
ctx->active = TRUE;
__ofono_dbus_pending_reply(&ctx->pending,
dbus_message_new_method_return(ctx->pending));
@@ -955,13 +967,13 @@ static DBusMessage *pri_set_apn(struct pri_context *ctx, DBusConnection *conn,
storage_sync(ctx->gprs->imsi, SETTINGS_STORE, settings);
}
- g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
+ if (msg)
+ g_dbus_send_reply(conn, msg, DBUS_TYPE_INVALID);
ofono_dbus_signal_property_changed(conn, ctx->path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
"AccessPointName",
DBUS_TYPE_STRING, &apn);
-
return NULL;
}
@@ -2688,6 +2700,15 @@ void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
settings->interface = g_strdup(interface);
}
+void ofono_gprs_context_set_apn(struct ofono_gprs_context *gc,
+ const char *apn)
+{
+ struct context_settings *settings = gc->settings;
+
+ g_free(settings->apn);
+ settings->apn = g_strdup(apn);
+}
+
void ofono_gprs_context_set_ipv4_address(struct ofono_gprs_context *gc,
const char *address,
ofono_bool_t static_ip)
--
2.5.0
next prev parent reply other threads:[~2016-03-09 15:44 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 15:44 [PATCH 00/19] Support for U-Blox Toby L2 modems Dragos Tatulea
2016-03-09 15:44 ` [PATCH 01/19] plugins/udevng: support the U-Blox TOBY-L2 series Dragos Tatulea
2016-03-10 14:00 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 02/19] plugins/udevng: support different interface strings to detect TOBY series Dragos Tatulea
2016-03-10 14:01 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 03/19] plugins/udevng: ublox: set model string Dragos Tatulea
2016-03-10 14:04 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 04/19] include: vendor.h: add vendor for ublox toby Dragos Tatulea
2016-03-10 14:05 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 05/19] plugins/ublox: allow enabling of TOBY L2 modems Dragos Tatulea
2016-03-10 14:11 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 06/19] plugins/ublox: use vendor from structure instead of fixed Dragos Tatulea
2016-03-09 15:44 ` [PATCH 07/19] atmodem: ublox: EPS now supported by newer ublox Dragos Tatulea
2016-03-10 14:29 ` Denis Kenzior
2016-03-10 14:43 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 08/19] atmodem: add support for U-Blox TOBY L2 modems Dragos Tatulea
2016-03-10 14:34 ` Denis Kenzior
2016-03-10 14:38 ` Dragos Tatulea
2016-03-09 15:44 ` [PATCH 09/19] atmodem: work around CGREG issues in UBlox Toby L2 Dragos Tatulea
2016-03-10 14:40 ` Denis Kenzior
2016-03-09 15:44 ` [PATCH 10/19] ubloxmodem: add Toby L2 gprs context driver Dragos Tatulea
2016-03-09 15:44 ` [PATCH 11/19] gprs-context.h: add function for setting APN Dragos Tatulea
2016-03-09 15:44 ` Dragos Tatulea [this message]
2016-03-09 15:44 ` [PATCH 13/19] ubloxmodem: push back APN into gprs context Dragos Tatulea
2016-03-09 15:44 ` [PATCH 14/19] plugins/ublox: give names to model ids Dragos Tatulea
2016-03-09 15:44 ` [PATCH 15/19] plugins/ublox: enable ubloxmodem driver when possible Dragos Tatulea
2016-03-09 15:44 ` [PATCH 16/19] plugins/ublox: support more internet contexts Dragos Tatulea
2016-03-09 15:44 ` [PATCH 17/19] ubloxmodem: support authentication Dragos Tatulea
2016-03-09 15:44 ` [PATCH 18/19] plugins/ublox: read network mode Dragos Tatulea
2016-03-09 15:45 ` [PATCH 19/19] ubloxmodem: add routed mode support Dragos Tatulea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457538300-7183-13-git-send-email-dragos@endocode.com \
--to=dragos@endocode.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox