Ok I just tested the patch with ofono/connman
connman correctly displays the 3 context as 3 separate services
vodafone IE cellular_272018013806642_context3
vodafone IE cellular_272018013806642_context2
vodafone IE cellular_272018013806642_context1
and permit to connect to one of thos
connmanctl connect cellular_272018013806642_context3
it also remember the profile where it was connected before and
reconnect to it if the modem is plugged in again
So I think the patch is valid.
Probably I need to submit a patch to connman to manipulate the context
from connman
I'll have a look at it later
Cheers
Nicola Lunghi
onnmanctl services
*AO vodafone IE cellular_272018013806642_context3
*AR Wired ethernet_0001c021c28c_cable
vodafone IE cellular_272018013806642_context1
vodafone IE cellular_272018013806642_context2
wifi-aaa21c26a
wifi_c8df844b53ae_62756d626c656265652d323163323661_managed_psk
....
connmanctl services cellular_272018013806642_context3
/net/connman/service/cellular_272018013806642_context3
Type = cellular
Security = [ ]
State = online
Strength = 40
Favorite = True
Immutable = False
AutoConnect = True
Name = vodafone IE
Roaming = False
Ethernet = [ Method=auto, Interface=ppp0, Address=00:00:00:00:00:00,
MTU=1500 ]
IPv4 = [ Method=fixed, Address=10.119.15.154, Netmask=255.255.255.255 ]
IPv4.Configuration = [ Method=fixed, Address=10.119.15.154,
Netmask=255.255.255.255 ]
IPv6 = [ ]
IPv6.Configuration = [ Method=off ]
Nameservers = [ 89.19.64.44, 89.19.64.172 ]
Nameservers.Configuration = [ ]
Timeservers = [ ]
Timeservers.Configuration = [ ]
Domains = [ ]
Domains.Configuration = [ ]
Proxy = [ Method=direct ]
Proxy.Configuration = [ ]
mDNS = False
mDNS.Configuration = False
Provider = [ ]
./list-context
[ /telit_2 ]
[ /telit_2/context1 ]
Name = Internet
Active = 0
Type = internet
Protocol = ip
AccessPointName = hs.vodafone.ie
Username = vodafone
Password = vodafone
AuthenticationMethod = chap
Settings = { }
IPv6.Settings = { }
[ /telit_2/context2 ]
Name = Old
Active = 0
Type = internet
Protocol = ip
AccessPointName = isp.vodafone.ie
Username = vodafone
Password = vodafone
AuthenticationMethod = chap
Settings = { }
IPv6.Settings = { }
[ /telit_2/context3 ]
Name = Prepaid
Active = 1
Type = internet
Protocol = ip
AccessPointName =
live.vodafone.com
Username = vodafone
Password = vodafone
AuthenticationMethod = chap
Settings = { Interface=ppp0 Method=static
Address=10.119.15.154 Netmask=255.255.255.255
DomainNameServers=89.19.64.44,89.19.64.172, }
IPv6.Settings = { }
diff --git a/plugins/provision.c b/plugins/provision.c
index 99c299eb..aa0b05e4 100644
--- a/plugins/provision.c
+++ b/plugins/provision.c
@@ -50,7 +50,7 @@ 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, TRUE, &error);
if (apns == NULL) {
if (error != NULL) {
ofono_error("%s", error->message);
On Mon, 2 Mar 2020 at 14:38, nick83ola <nick83ola(a)gmail.com> wrote:
>
> Hi Martin,
> Yes because the current behaviour in my opinion doesn't make any sense :-)
>
> Currently ofono creates an invalid empty internet context with no apn at all
>
> [ /telit_0 ]
> [ /telit_0/context1 ]
> Name = Internet
> Active = 0
> Type = internet
> Protocol = ip
> AccessPointName =
> Username =
> Password =
> AuthenticationMethod = chap
> Settings = { }
> IPv6.Settings = { }
>
> [ /stktest ]
>
> instead of
>
> nlunghiadm@nick-bbestie:~/tmp/modem/ofono$ test/list-contexts
> [ /telit_0 ]
> [ /telit_0/context1 ]
> Name = Internet
> Active = 0
> Type = internet
> Protocol = ip
> AccessPointName = hs.vodafone.ie
> Username = vodafone
> Password = vodafone
> AuthenticationMethod = chap
> Settings = { }
> IPv6.Settings = { }
>
> [ /telit_0/context2 ]
> Name = Old
> Active = 0
> Type = internet
> Protocol = ip
> AccessPointName = isp.vodafone.ie
> Username = vodafone
> Password = vodafone
> AuthenticationMethod = chap
> Settings = { }
> IPv6.Settings = { }
>
> [ /telit_0/context3 ]
> Name = Prepaid
> Active = 0
> Type = internet
> Protocol = ip
> AccessPointName =
live.vodafone.com
> Username = vodafone
> Password = vodafone
> AuthenticationMethod = chap
> Settings = { }
> IPv6.Settings = { }
> [ /stktest ]
>
> I'll test if connman handles this and then I will resubmit your patch
>
> the alternative could be to provide a DBus Interface to query the apn
> from mbpi and then set it via DBus would be better??
>
> Cheers
> Nicola Lunghi
>
> On Mon, 2 Mar 2020 at 13:56, Martin Hundebøll <martin(a)geanix.com> wrote:
> >
> > Hi,
> >
> > On 02/03/2020 14.49, nick83ola wrote:
> > > Hi all,
> > > In regarding to this I found the provision plugin and at line 53 it
> > > uses the mbpi lookup to provision for the default apns but at line 53
> > > it does
> > >
> > > apns = mbpi_lookup_apn(mcc, mnc, FALSE, &error);
> > >
> > > that gives an error in case of multiple providers. -> but if I change
> > > it to gboolean allow_duplicates=TRUE
> > > It works and it creates multiple contexts
> > >
> > > ap_count = g_slist_length(apns);
> > > .....
> > > for (l = apns, i = 0; l; l = l->next, i++) {
> > > struct ofono_gprs_provision_data *ap = l->data;
> > >
> > > memcpy(*settings + i, ap,
> > > sizeof(struct ofono_gprs_provision_data));
> > >
> > > g_free(ap);
> > > }
> > >
> > > What's the issue in setting mbpi_lookup_apn(mcc, mnc, TRUE,
&error); ?????
> >
> > You're not the first:
> >
https://lists.ofono.org/hyperkitty/list/ofono@ofono.org/thread/2SC46PH5CW...
> >
> > :)
> >
> > // Martin