From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] plugins, mbpi: make mbpi return only APNs of a given type. When provisioning for internect connection, only OFONO_GPRS_CONTEXT_TYPE_INTERNET APNs will be returned.
Date: Fri, 11 Oct 2013 10:50:21 -0500 [thread overview]
Message-ID: <52581E3D.3090202@gmail.com> (raw)
In-Reply-To: <1381483478-16237-1-git-send-email-alfonso.sanchez-beato@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 3875 bytes --]
Hi Alfonso,
On 10/11/2013 04:24 AM, Alfonso Sanchez-Beato wrote:
> From: Alfonso Sanchez-Beato <alfonsosanchezbeato@yahoo.es>
>
> ---
> plugins/mbpi.c | 7 ++++++-
> plugins/mbpi.h | 1 +
> plugins/provision.c | 3 ++-
> tools/lookup-apn.c | 3 ++-
Please break this up into three patches, one for mbpi.[ch] changes, one
for lookup-apn and one for provision.c. We're not so much concerned
with breaking git bisect.
Also, please keep the patch title under 72 characters if possible.
Sentences should be put into the patch description, not the title.
> 4 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/plugins/mbpi.c b/plugins/mbpi.c
> index 309e1ed..b3e26fd 100644
> --- a/plugins/mbpi.c
> +++ b/plugins/mbpi.c
> @@ -53,6 +53,7 @@ enum MBPI_ERROR {
> struct gsm_data {
> const char *match_mcc;
> const char *match_mnc;
> + enum ofono_gprs_context_type match_type;
> GSList *apns;
> gboolean match_found;
> gboolean allow_duplicates;
> @@ -370,7 +371,9 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
> }
> }
>
> - gsm->apns = g_slist_append(gsm->apns, ap);
> + if (gsm->match_type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
> + gsm->match_type == ap->type)
> + gsm->apns = g_slist_append(gsm->apns, ap);
> }
>
> static const GMarkupParser gsm_parser = {
> @@ -565,6 +568,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
> }
>
> GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
> + enum ofono_gprs_context_type type,
> gboolean allow_duplicates, GError **error)
> {
> struct gsm_data gsm;
> @@ -573,6 +577,7 @@ GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
> memset(&gsm, 0, sizeof(gsm));
> gsm.match_mcc = mcc;
> gsm.match_mnc = mnc;
> + gsm.match_type = type;
> gsm.allow_duplicates = allow_duplicates;
>
> if (mbpi_parse(&toplevel_gsm_parser, &gsm, error) == FALSE) {
> diff --git a/plugins/mbpi.h b/plugins/mbpi.h
> index 64b7ea5..36bbed6 100644
> --- a/plugins/mbpi.h
> +++ b/plugins/mbpi.h
> @@ -24,6 +24,7 @@ const char *mbpi_ap_type(enum ofono_gprs_context_type type);
> void mbpi_ap_free(struct ofono_gprs_provision_data *data);
>
> GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
> + enum ofono_gprs_context_type type,
> gboolean allow_duplicates, GError **error);
>
> char *mbpi_lookup_cdma_provider_name(const char *sid, GError **error);
I'm fine with the above changes, they could be useful I suppose...
> diff --git a/plugins/provision.c b/plugins/provision.c
> index 99c299e..39e037b 100644
> --- a/plugins/provision.c
> +++ b/plugins/provision.c
> @@ -50,7 +50,8 @@ static int provision_get_settings(const char *mcc, const char *mnc,
>
> DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
>
> - apns = mbpi_lookup_apn(mcc, mnc, FALSE, &error);
> + apns = mbpi_lookup_apn(mcc, mnc, OFONO_GPRS_CONTEXT_TYPE_INTERNET,
> + FALSE, &error);
However, why do you think this is a good idea? Provisioning should
provision all context types, not just internet ones.
> if (apns == NULL) {
> if (error != NULL) {
> ofono_error("%s", error->message);
> diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
> index 884b32a..4654b03 100644
> --- a/tools/lookup-apn.c
> +++ b/tools/lookup-apn.c
> @@ -42,7 +42,8 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc,
>
> g_print("Searching for info for network: %s%s\n", match_mcc, match_mnc);
>
> - apns = mbpi_lookup_apn(match_mcc, match_mnc, allow_duplicates, &error);
> + apns = mbpi_lookup_apn(match_mcc, match_mnc, OFONO_GPRS_CONTEXT_TYPE_ANY,
> + allow_duplicates, &error);
>
> if (apns == NULL) {
> if (error != NULL) {
>
Regards,
-Denis
next prev parent reply other threads:[~2013-10-11 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 9:24 [PATCH] plugins, mbpi: make mbpi return only APNs of a given type. When provisioning for internect connection, only OFONO_GPRS_CONTEXT_TYPE_INTERNET APNs will be returned Alfonso Sanchez-Beato
2013-10-11 15:50 ` Denis Kenzior [this message]
2013-10-11 16:17 ` Alfonso Sanchez-Beato
2013-10-11 17:00 ` Denis Kenzior
2013-10-14 7:33 ` Alfonso Sanchez-Beato
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=52581E3D.3090202@gmail.com \
--to=denkenz@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.