Merge lp:~awe/phablet-extras/ofono-lp1204683 into lp:phablet-extras/ofono

Proposed by Tony Espy
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 53
Merged at revision: 51
Proposed branch: lp:~awe/phablet-extras/ofono-lp1204683
Merge into: lp:phablet-extras/ofono
Diff against target: 66 lines (+32/-8)
2 files modified
debian/changelog (+7/-0)
plugins/provision.c (+25/-8)
To merge this branch: bzr merge lp:~awe/phablet-extras/ofono-lp1204683
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+178137@code.launchpad.net

Commit message

[provision] If multiple APNs are found for a SPN/mmc/mnc search, only provision the first.

Description of the change

This fix causes the provisioning plugin to only create a data context for the first APN found in mbpi.

This is a temporary solution to prevent network-manager from creating and trying multiple contexts when only one of them is needed.

Note, this might break auto-provisioning for some people if the first APN found is not the correct APN, however the true fix is to switch to a better source of APNs.

To test, you need first need to ensure that your operator has more than one APN defined in /usr/share/mobile-broadband-provider-info/serviceproviders.xml. If not, then edit the file manually and add one or more APNs for your operator. Ensure that these data contexts have been created using the ofono script 'list-contexts'.

Now, stop ofono and NM, edit the gprs settings file ( /var/lib/ofono/<IMSI>/gprs ) and remove all the contexts. Install the ofono produced from this merge, and reboot. Verify that only one APN/context has been created.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

30 + if ( ap_count > 1)

Mind removing extra space between '(' and 'ap_count'?

Also, would be nice to change the DBG message "Found %d APs" to also say we're just getting the first AP.

42 + if (i == 0)
43 + memcpy(*settings + i, ap,
44 + sizeof(struct ofono_gprs_provision_data));

Mind adding a comment in there before 'i == 0' explaining why we're only copying the first provisioning data? (small one, as you explained on a previous code block).

Would also be nice to remove the extra DGB for the other APNs, as it would confuse folks trying to debug a possible APN issue (you could remove the DBG lines and only get that for the one you copied over to 'settings').

review: Needs Fixing
53. By Tony Espy

[provision] Address review comments.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Looks good, and tested with maguro, worked as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-07-30 15:56:40 +0000
+++ debian/changelog 2013-08-05 17:26:26 +0000
@@ -1,3 +1,10 @@
1ofono (1.12phablet12) saucy; urgency=low
2
3 * plugins/provision.c: if multiple "internet" data contexts
4 are found, only provision the first (LP:1204683).
5
6 -- Tony Espy <espy@canonical.com> Thu, 01 Aug 2013 12:13:37 -0400
7
1ofono (1.12phablet11) saucy; urgency=low8ofono (1.12phablet11) saucy; urgency=low
29
3 * drivers/rilmodem/gprs.c: adding data network state tracking back, but10 * drivers/rilmodem/gprs.c: adding data network state tracking back, but
411
=== modified file 'plugins/provision.c'
--- plugins/provision.c 2013-05-24 22:11:34 +0000
+++ plugins/provision.c 2013-08-05 17:26:26 +0000
@@ -67,7 +67,18 @@
6767
68 ap_count = g_slist_length(apns);68 ap_count = g_slist_length(apns);
6969
70 DBG("Found %d APs", ap_count);70 ofono_info("GPRS Provisioning found %d matching APNs for "
71 "SPN: %s MCC: %d MNC: %d",
72 ap_count, spn, mcc, mnc);
73 /*
74 * Only keep the first APN found.
75 *
76 * This allows auto-provisioning to work most of the time vs.
77 * passing FALSE to mbpi_lookup_apn() which would return an
78 * an empty list if duplicates are found.
79 */
80 if (ap_count > 1)
81 ap_count = 1;
7182
72 *settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);83 *settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);
73 if (*settings == NULL) {84 if (*settings == NULL) {
@@ -86,14 +97,20 @@
86 for (l = apns, i = 0; l; l = l->next, i++) {97 for (l = apns, i = 0; l; l = l->next, i++) {
87 struct ofono_gprs_provision_data *ap = l->data;98 struct ofono_gprs_provision_data *ap = l->data;
8899
89 DBG("Name: '%s'", ap->name);100 /*
90 DBG("APN: '%s'", ap->apn);101 * Only create a data context for the first matching APN.
91 DBG("Type: %s", mbpi_ap_type(ap->type));102 * See comment above that restricts restricts apn_count.
92 DBG("Username: '%s'", ap->username);103 */
93 DBG("Password: '%s'", ap->password);104 if (i == 0) {
105 ofono_info("Name: '%s'", ap->name);
106 ofono_info("APN: '%s'", ap->apn);
107 ofono_info("Type: %s", mbpi_ap_type(ap->type));
108 ofono_info("Username: '%s'", ap->username);
109 ofono_info("Password: '%s'", ap->password);
94110
95 memcpy(*settings + i, ap,111 memcpy(*settings + i, ap,
96 sizeof(struct ofono_gprs_provision_data));112 sizeof(struct ofono_gprs_provision_data));
113 }
97114
98 g_free(ap);115 g_free(ap);
99 }116 }

Subscribers

People subscribed via source and target branches