RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Pasi Sjöholm
Let's start from the basics. Please explain the following:
- When there is an IPv4 only bearer, which are the possible IPv4
  configuration methods?

CONNMAN_IPCONFIG_METHOD_FIXED
CONNMAN_IPCONFIG_METHOD_DHCP

- When there is an IPv6 only bearer, which are the possible IPv6
  configuration methodos?

CONNMAN_IPCONFIG_METHOD_FIXED
CONNMAN_IPCONFIG_METHOD_AUTO (code supports it but I have not seen it 
happenning)

- When there is a dual IPv4/IPv6 bearer, which are the possible IPv4
  and IPv6 configuration methods?

ipv4:
CONNMAN_IPCONFIG_METHOD_FIXED
CONNMAN_IPCONFIG_METHOD_DHCP

ipv6
CONNMAN_IPCONFIG_METHOD_AUTO
CONNMAN_IPCONFIG_METHOD_FIXED (supported by the code, but AUTO is the official 
way according to 3gpp)

There can not be any old nameservers left hanging around, as the code
goes like this:

char *nameservers = NULL;
...
while (...)
...
g_free(context-ipv4_nameservers);
context-ipv4_nameservers = nameservers;
So if oFono provided no nameservers, they are unset after exiting this
function as far as I can see.

If oFono provided nameservers without giving an IP address, the
nameservers are currently remembered. Once DHCP is run, any DHCP
provided nameservers replace the old ones. If there are no nameservers
available via DHCP, the best thing one can do is to keep the ones
provided by oFono earlier with this message. 

What I've seen while testing this is that dhcpv6 does not replace the old 
nameservers when doing this:

1) First connect with ipv6-pdp and you will get nameservers 2001::1 and 2001::2 
as fixed from ofono.
2) Disconnect and change the configuration from ofono to dual/ipv4v6.
3) Connect and query service from connman and you will see 2001::1 and 2001::2 
plus slaacdhcpv6 provided nameservers 2001::3 and 2001::4.

With the patch applied, the nameservers at point 3 will be only the 
slaacdhcpv6 provided 2001::3 and 2001::4.

and yes, I have not had this happening with ipv4 because I have no sim from a 
operator which would use CONNMAN_IPCONFIG_METHOD_DHCP with ipv4 but for sure it 
happens with ipv6.

If oFono is sending
outdated information it is not supposed to send when no IP address is
present (in the DHCP case, I assume), please fix oFono.

It is not ofono but connman using the outdated information.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Patrik Flykt
On Fri, 2014-12-19 at 10:12 +, Pasi Sjöholm wrote:
 3) Connect and query service from connman and you will see 2001::1 and
 2001::2 plus slaacdhcpv6 provided nameservers 2001::3 and 2001::4.
 
 With the patch applied, the nameservers at point 3 will be only the
 slaacdhcpv6 provided 2001::3 and 2001::4.

So what is the problem then of having nameservers 1, 2, 3 and 4 in use
at the same time? Is it that:
- 1 and 2 don't respond when connecting via DHCPv6/autoconfiguration?
- the specification says 1 and 2 must not be used for whatever reason
  when 3 and 4 are provided by DHCPv6/autoconfiguration? And do we even
  care about that if 1 and 2 work anyway?

If DHCPv6/autoconfiguration does not give any nameservers, the one
pushed from oFono are suddenly really good to have...

It is not ofono but connman using the outdated information.

The nameserver information is not outdated if it comes from the oFono
plugin and the proper D-Bus message. If nameservers 1 and 2 are not
supposed to be used with DHCPv6/autoconfiguration, then oFono should not
be sending this information in the first place. It is not the
responsibility of the application (== ConnMan) to interpret which parts
of the message to use; all information provided by oFono will be
exploited to the full extent possible.


Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Patrik Flykt
On Fri, 2014-12-19 at 11:25 +, Pasi Sjöholm wrote:
 The nameservers 1/2 are not included in the new message received when
 the context is re-activated/connected after the pdp-type has been
 changed to dual/ipv4v6.

At start:
 char *nameservers = NULL

If and only if DomainNameServers is set:
 nameservers = extract_nameservers(value)

Independent of DomainNameServers:
 g_free(context-ipv6_nameservers)
 context-ipv6_nameservers = nameservers

At this point nameservers is NULL, if nothing was sent from oFono. At
this point nameservers is non-NULL if oFono sent something.

Looking once more at patch 3/6 makes it clear that the DHCPv6 case
detected by address being NULL, avoids setting context nameservers
altogether. The original code sets non-NULL nameservers only if they are
supplied by the DomainNameServers property. Thus it is oFono that is
sending supposedly outdated information while ConnMan believes
whatever oFono tells it, outdated or not. If the information really is
outdated, oFono needs to be fixed.

If the nameservers indeed are not attached to the message from oFono
while ConnMan keeps on using them, some other part of the code needs
fixing. Patch 3/6 may seem to work simply because some other patch in
the series causes nameservers to be removed later on. This especially if
all of them are tested at the same time.


HTH,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Pasi Sjöholm
Hi,

If the nameservers indeed are not attached to the message from oFono
while ConnMan keeps on using them, some other part of the code needs
fixing. Patch 3/6 may seem to work simply because some other patch in
the series causes nameservers to be removed later on. This especially if
all of them are tested at the same time.

Nope, they are not removed anywhere else, the modem-context-ipv4_nameservers 
and ipv6 are not cleared after disconnection. They are only cleared if the 
context is completely removed. Sure I could move the freeing of the dns-servers 
to the set_disconnected(); but it is still the same fix.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Patrik Flykt
On Fri, 2014-12-19 at 12:33 +, Pasi Sjöholm wrote:
 Nope, they are not removed anywhere else, the
 modem-context-ipv4_nameservers and ipv6 are not cleared after
 disconnection.

Sounds like disconnection part is where this needs to be fixed.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Pasi Sjöholm
Sounds like disconnection part is where this needs to be fixed.

Will update the patchset, and include following code to set_connected():

+   if (!modem-context)
+   return;
+
+   connman_ipaddress_free(modem-context-ipv4_address);
+   modem-context-ipv4_address = NULL;
+   modem-context-index = -1;
+   g_free(modem-context-ipv4_nameservers);
+   modem-context-ipv4_nameservers = NULL;
+
+   connman_ipaddress_free(modem-context-ipv6_address);
+   modem-context-ipv6_address = NULL;
+   modem-context-index = -1;
+   g_free(modem-context-ipv6_nameservers);
+   modem-context-ipv6_nameservers = NULL;

The ip-address freeing from extract_ipv4/6 should be part of set_disconnected() 
as well.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Denis Kenzior

Hi Pasi,

 What I've seen while testing this is that dhcpv6 does not replace the 
old nameservers when doing this:


1) First connect with ipv6-pdp and you will get nameservers 2001::1 and 2001::2 
as fixed from ofono.
2) Disconnect and change the configuration from ofono to dual/ipv4v6.
3) Connect and query service from connman and you will see 2001::1 and 2001::2 plus 
slaacdhcpv6 provided nameservers 2001::3 and 2001::4.



Maybe you should provide an ofono-monitor log (or similar) of what oFono 
actually sends?  Since it is still unclear from this discussion whether 
the fault is with connman or oFono.


Regards,
-Denis
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Pasi Sjöholm
 What I've seen while testing this is that dhcpv6 does not replace the old 
 nameservers when doing this:
 1) First connect with ipv6-pdp and you will get nameservers 2001::1 and 
 2001::2 as fixed from ofono.
 2) Disconnect and change the configuration from ofono to dual/ipv4v6.
 3) Connect and query service from connman and you will see 2001::1 and 
 2001::2 plus slaacdhcpv6 provided nameservers 2001::3 and 2001::4.

Maybe you should provide an ofono-monitor log (or similar) of what oFono
actually sends?  Since it is still unclear from this discussion whether
the fault is with connman or oFono.

If you insist.. (I've cutted pieces off from the ipv6-addresses) ;)

{ConnectionContext} [/ril_0/context1] Protocol = ip
{ConnectionContext} [/ril_0/context1] Settings = { Gateway = 10.233.105.246, 
Address = 10.233.105.245, Method = static, Netmask = 255.255.255.0, Interface = 
rmnet0, DomainNameServers = 62.241.198.245 62.241.198.246 }
{ConnectionContext} [/ril_0/context1] Active = True
{ConnectionContext} [/ril_0/context1] Settings = {}
{ConnectionContext} [/ril_0/context1] Active = False


{ConnectionContext} [/ril_0/context1] Protocol = ipv6
{ConnectionContext} [/ril_0/context1] IPv6.Settings = { Gateway = 2001::1223, 
Address = 2001::8a0f, Interface = rmnet0, DomainNameServers = 2001::0001 
2001::0002 }
{ConnectionContext} [/ril_0/context1] Active = True
{ConnectionContext} [/ril_0/context1] IPv6.Settings = {}
{ConnectionContext} [/ril_0/context1] Active = False


{ConnectionContext} [/ril_0/context1] Protocol = dual
{ConnectionContext} [/ril_0/context1] Settings = { Gateway = 10.233.105.246, 
Address = 10.233.105.245, Method = static, Netmask = 255.255.255.0, Interface = 
rmnet0, DomainNameServers = 62.241.198.245 62.241.198.246 }
{ConnectionContext} [/ril_0/context1] IPv6.Settings = { Interface = rmnet0 }
{ConnectionContext} [/ril_0/context1] Active = True
{ConnectionContext} [/ril_0/context1] Settings = {}
{ConnectionContext} [/ril_0/context1] IPv6.Settings = {}
{ConnectionContext} [/ril_0/context1] Active = False
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-19 Thread Pasi Sjöholm
 {ConnectionContext} [/ril_0/context1] Protocol = ipv6
 {ConnectionContext} [/ril_0/context1] IPv6.Settings = { Gateway = 
 2001::1223, Address = 2001::8a0f, Interface = rmnet0, DomainNameServers = 
 2001::0001 2001::0002 }
 {ConnectionContext} [/ril_0/context1] Active = True
 {ConnectionContext} [/ril_0/context1] IPv6.Settings = {}
 {ConnectionContext} [/ril_0/context1] Active = False


 {ConnectionContext} [/ril_0/context1] Protocol = dual
 {ConnectionContext} [/ril_0/context1] Settings = { Gateway = 10.233.105.246, 
 Address = 10.233.105.245, Method = static, Netmask = 255.255.255.0, 
 Interface = rmnet0, DomainNameServers = 62.241.198.245 62.241.198.246 }
 {ConnectionContext} [/ril_0/context1] IPv6.Settings = { Interface = rmnet0 }
Interesting that in dual-mode the IPv6 settings are different than in
IPv6 only mode.  Is this supposed to be this way?

Yes, basicly slaac (+dhcpv6 for dns) is the only supported way of configuration 
of ipv6-addresses in dual-mode (tried to find some documentation about plain 
ipv6-pdp which would be available in public but did not succeed in 5mins).

Anyway, https://tools.ietf.org/html/rfc6459

5.2 IPv6 Address Configuration

   IPv6 Stateless Address Autoconfiguration (SLAAC), as specified in
   [RFC4861] and [RFC4862], is the only supported address configuration
   mechanism.  Stateful DHCPv6-based address configuration [RFC3315] is
   not supported by 3GPP specifications.


 {ConnectionContext} [/ril_0/context1] Active = True
 {ConnectionContext} [/ril_0/context1] Settings = {}
 {ConnectionContext} [/ril_0/context1] IPv6.Settings = {}
 {ConnectionContext} [/ril_0/context1] Active = False
Otherwise seems like oFono is doing everything just fine.

Yes, and everything is working with the patchset unlike without it only 
ip(v4)-pdp works ok.

Another operator (Three.co.uk):

{ConnectionContext} [/ril_0/context1] Protocol = dual
{ConnectionContext} [/ril_0/context1] Settings = { Method = static, Interface = 
rmnet0, DomainNameServers = 217.171.132.1 217.171.132.1, Netmask = 
255.255.255.0, Address = 92.41.159.199, Gateway = 92.41.159.193 }
{ConnectionContext} [/ril_0/context1] IPv6.Settings = { Interface = rmnet0 }
{ConnectionContext} [/ril_0/context1] Active = True
{ConnectionContext} [/ril_0/context1] Settings = {}
{ConnectionContext} [/ril_0/context1] IPv6.Settings = {}
{ConnectionContext} [/ril_0/context1] Active = False

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Patrik Flykt

Hi,

On Tue, 2014-12-16 at 14:31 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 Nameservers need to be reset when new addresses are extracted
 so that they are not reused when pdp-protocol e.g. changes
 from ipv6 to dual/ipv4v6.

Nameservers should be removed only when they change, which seems to be
the task when the 'DomainNameServers' property.

 ---
  plugins/ofono.c | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/plugins/ofono.c b/plugins/ofono.c
 index 1617764..29dfe90 100644
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -757,6 +757,8 @@ static void extract_ipv4_settings(DBusMessageIter *array,
  
   connman_ipaddress_free(context-ipv4_address);
   context-ipv4_address = NULL;
 + g_free(context-ipv4_nameservers);
 + context-ipv4_nameservers = NULL;
   context-index = -1;
  
   if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
 @@ -860,6 +862,8 @@ static void extract_ipv6_settings(DBusMessageIter *array,
  
   connman_ipaddress_free(context-ipv6_address);
   context-ipv6_address = NULL;
 + g_free(context-ipv6_nameservers);
 + context-ipv6_nameservers = NULL;
   context-index = -1;
  
   if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)

At the start of both functions, nameservers is set to NULL. If the
'DomainNameServers' property is set in the message, the nameservers take
the value supplied. At the end of both functions there are these two
lines which appear to remove the old values from the context like so:

g_free(context-ipv6_nameservers);
context-ipv6_nameservers = nameservers;

Are you sure the extra freeing is needed?

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Pasi Sjöholm
Hi,

At the start of both functions, nameservers is set to NULL. If the
'DomainNameServers' property is set in the message, the nameservers take
the value supplied. At the end of both functions there are these two
lines which appear to remove the old values from the context like so:

   g_free(context-ipv6_nameservers);
context-ipv6_nameservers = nameservers;

Are you sure the extra freeing is needed?

I will modify it a bit so that the freeing is done only if (address) fails.. 
as the new addresses will come through dhcp/dhcpv6 in that case.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Pasi Sjöholm
I think most of the problem solved by this patch set revolves around the
problem that incomplete information is suddenly received from oFono.

What is the minimum acceptable configuration from oFono? At least
missing 'Address' and perhaps also 'Interface' property should ring
alarm bells, is the whole setup faulty in this case?

E.g. should most of the patches be fixed by a strategic check of

if (index  0 || !address || !...)
goto out;

If ipv4_method is dhcp there will be no address, and neither there will an 
address with ipv6 when dual-mode (slaac  dhcpv6) is used.
So we just can jump into conlusions..

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Patrik Flykt
On Thu, 2014-12-18 at 14:10 +, Pasi Sjöholm wrote:
 If ipv4_method is dhcp there will be no address, and neither there
 will an address with ipv6 when dual-mode (slaac  dhcpv6) is used.
 So we just can jump into conlusions..

So this all is about DHCP then...?

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

RE: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Pasi Sjöholm
 If ipv4_method is dhcp there will be no address, and neither there
 will an address with ipv6 when dual-mode (slaac  dhcpv6) is used.
 So we just can jump into conlusions..
So this all is about DHCP then...?

and SLAAC.. which does not provide any method to configure the DNS-servers and 
we can/should not use the old values from any previous configuration/active 
context.

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH 3/6] ofono: Old nameservers need to be cleared

2014-12-18 Thread Jukka Rissanen
Hi Pasi,

On to, 2014-12-18 at 14:42 +, Pasi Sjöholm wrote:
  If ipv4_method is dhcp there will be no address, and neither there
  will an address with ipv6 when dual-mode (slaac  dhcpv6) is used.
  So we just can jump into conlusions..
 So this all is about DHCP then...?
 
 and SLAAC.. which does not provide any method to configure the DNS-servers 
 and we can/should not use the old values from any previous 
 configuration/active context.

There is a RFC for it, see https://tools.ietf.org/html/rfc6106 for
details.


Cheers,
Jukka


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman