[PATCH 1/6] network: index needs to be set also for ip6config

2014-12-22 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

Fixes the issue that network index was not set for
ipv6-connections and therefore slaac/dhcpv6 was
not working e.g. ofono cellular connections.
---
 src/network.c | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/network.c b/src/network.c
index b388995..59f8679 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1139,14 +1139,23 @@ void connman_network_set_index(struct connman_network 
*network, int index)
goto done;
 
ipconfig = __connman_service_get_ip4config(service);
-   if (!ipconfig)
-   goto done;
+   if (ipconfig) {
+   /* If index changed, the index of ipconfig must be reset. */
+   __connman_ipconfig_set_index(ipconfig, index);
+
+   DBG(index %d service %p ip4config %p, network-index,
+   service, ipconfig);
+   }
 
-   /* If index changed, the index of ipconfig must be reset. */
-   __connman_ipconfig_set_index(ipconfig, index);
+   ipconfig = __connman_service_get_ip6config(service);
+   if (ipconfig) {
+   /* If index changed, the index of ipconfig must be reset. */
+   __connman_ipconfig_set_index(ipconfig, index);
+
+   DBG(index %d service %p ip6config %p, network-index,
+   service, ipconfig);
+   }
 
-   DBG(index %d service %p ip4config %p, network-index,
-   service, ipconfig);
 done:
network-index = index;
 }
-- 
2.1.0

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

[PATCH 0/6 v6] Fixes for ofono-plugin to support dual/ipv4v6

2014-12-22 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

Patch 1 is required for connman to see the configuration set by
slaac (and then again dhcpv6 (nameservers)).

Patch 2 implements support for Protocol-message so that the old
configuration will be reset to unknown-method until it is
set again.

Patch 3 is for extract_ipv4_settings not to even try
set ip-addres if the configuration from ofono is invalid.

Patch 4 fixes the issue that ipv6_method can actually
be CONNMAN_IPCONFIG_METHOD_AUTO when ipv4v6/dual is used.

Patch 5 makes sure that the old nameservers are cleared
in case e.g. ipv6-pdp type is first used and then switched
to ipv4v6/dual (they might not have same nameservers defined).

Patch 6 makes sure that no old configuration is used
by setting method to CONNMAN_IPCONFIG_METHOD_UNKNOWN
if no valid configuration is received from ofono for
either ipv4 or ipv6.

Work was done together with Jarko Poutiainen 
jarko.poutiai...@oss.tieto.com.

Pasi Sjöholm (6):
  network: index needs to be set also for ip6config
  ofono: Implement protocol-message handling for context_changed
  ofono: Do not set address or nameservers with invalid configuration
  ofono: Set CONNMAN_IPCONFIG_METHOD_AUTO when no address defined
  ofono: Clean nameservers when disconnecting
  ofono: make sure valid addresses/methods are used in set_connected

 plugins/ofono.c | 123 ++--
 src/network.c   |  21 +++---
 2 files changed, 98 insertions(+), 46 deletions(-)

-- 
2.1.0

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

[PATCH 4/6] ofono: Set CONNMAN_IPCONFIG_METHOD_AUTO when no address defined

2014-12-22 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

IPv6 configuration method is either CONNMAN_IPCONFIG_METHOD_FIXED
(ipv6-pdp) or CONNMAN_IPCONFIG_METHOD_AUTO (SLAAC/DHCPv6,
dual/ipv4v6-pdp).
---
 plugins/ofono.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 782c93e..b60e7ba 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -916,19 +916,25 @@ static void extract_ipv6_settings(DBusMessageIter *array,
if (index  0)
goto out;
 
-   context-ipv6_method = CONNMAN_IPCONFIG_METHOD_FIXED;
+   if (address) {
 
-   context-ipv6_address =
-   connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV6);
-   if (!context-ipv6_address)
-   goto out;
+   context-ipv6_address =
+   connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV6);
+   if (!context-ipv6_address)
+   goto out;
 
-   context-index = index;
-   connman_ipaddress_set_ipv6(context-ipv6_address, address,
-   prefix_length, gateway);
+   context-ipv6_method = CONNMAN_IPCONFIG_METHOD_FIXED;
 
-   g_free(context-ipv6_nameservers);
-   context-ipv6_nameservers = nameservers;
+   context-index = index;
+   connman_ipaddress_set_ipv6(context-ipv6_address, address,
+   prefix_length, gateway);
+
+   g_free(context-ipv6_nameservers);
+   context-ipv6_nameservers = nameservers;
+   } else {
+   context-index = index;
+   context-ipv6_method = CONNMAN_IPCONFIG_METHOD_AUTO;
+   }
 
 out:
if (context-ipv6_nameservers != nameservers)
-- 
2.1.0

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

[PATCH 2/6] ofono: Implement protocol-message handling for context_changed

2014-12-22 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

Reset ipv4/6_method to CONNMAN_IPCONFIG_METHOD_UNKNOWN when
protocol is set ip/ipv6/dual on ofono, which can be only
done when context is not active.
---
 plugins/ofono.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 7a8442b..1617764 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -1210,6 +1210,11 @@ static gboolean context_changed(DBusConnection *conn,
DBG(%s IPv6.Settings, modem-path);
 
extract_ipv6_settings(value, modem-context);
+   } else if (g_str_equal(key, Protocol)) {
+   DBG(%s Protocol, modem-path);
+
+   modem-context-ipv4_method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
+   modem-context-ipv6_method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
} else if (g_str_equal(key, Active)) {
dbus_bool_t active;
 
-- 
2.1.0

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

Re: [PATCH 2/6] ofono: Implement protocol-message handling for context_changed

2014-12-22 Thread Patrik Flykt
On Mon, 2014-12-22 at 13:01 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 Reset ipv4/6_method to CONNMAN_IPCONFIG_METHOD_UNKNOWN when
 protocol is set ip/ipv6/dual on ofono, which can be only
 done when context is not active.
 ---
  plugins/ofono.c | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/plugins/ofono.c b/plugins/ofono.c
 index 7a8442b..1617764 100644
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -1210,6 +1210,11 @@ static gboolean context_changed(DBusConnection *conn,
   DBG(%s IPv6.Settings, modem-path);
  
   extract_ipv6_settings(value, modem-context);
 + } else if (g_str_equal(key, Protocol)) {
 + DBG(%s Protocol, modem-path);
 +
 + modem-context-ipv4_method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
 + modem-context-ipv6_method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;

NACK.

If the protocol is ip, IPv6 needs to be off, if ipv6, IPv4 needs to be
off. The other protocol should be set to unknown (or dhcp/auto,
depending on how it works with the other patches).

Cheers,

Patrik


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

Re: [PATCH 3/6] ofono: Do not set address or nameservers with invalid configuration

2014-12-22 Thread Patrik Flykt
On Mon, 2014-12-22 at 13:01 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 ---
  plugins/ofono.c | 25 ++---
  1 file changed, 14 insertions(+), 11 deletions(-)
 
 diff --git a/plugins/ofono.c b/plugins/ofono.c
 index 1617764..782c93e 100644
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -824,20 +824,23 @@ static void extract_ipv4_settings(DBusMessageIter 
 *array,
  
   context-index = index;
  
 - if (context-ipv4_method != CONNMAN_IPCONFIG_METHOD_FIXED)
 - goto out;
 + if (address) {
  
 - context-ipv4_address = 
 connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV4);
 - if (!context-ipv4_address) {
 - context-index = -1;
 - goto out;
 - }
 + if (context-ipv4_method != CONNMAN_IPCONFIG_METHOD_FIXED)
 + goto out;
  
 - connman_ipaddress_set_ipv4(context-ipv4_address, address,
 - netmask, gateway);
 + context-ipv4_address = 
 connman_ipaddress_alloc(CONNMAN_IPCONFIG_TYPE_IPV4);
 + if (!context-ipv4_address) {
 + context-index = -1;
 + goto out;
 + }
  
 - g_free(context-ipv4_nameservers);
 - context-ipv4_nameservers = nameservers;
 + connman_ipaddress_set_ipv4(context-ipv4_address, address,
 + netmask, gateway);
 +
 + g_free(context-ipv4_nameservers);
 + context-ipv4_nameservers = nameservers;
 + }
  
  out:
   if (context-ipv4_nameservers != nameservers)

NACK.

From your other mail:
{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 = { Gateway =
2001::1223, Address = 2001::8a0f, Interface = rmnet0, DomainNameServers
= 2001::0001 2001::0002 }

This clearly shows oFono is sending DomainNameServers which ConnMan does
not have any reason not to use. Unless some RFC clearly says
DomainNameServers are to be ignored if updated via DHCP or stateless
DHCPv6.

I don't see anything *invalid* being sent/stale information being used
by the code.

Cheers,

Patrik


As your ofono trace shows, 

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

Re: [PATCH 4/6] ofono: Set CONNMAN_IPCONFIG_METHOD_AUTO when no address defined

2014-12-22 Thread Patrik Flykt
On Mon, 2014-12-22 at 13:01 +0200, pasi.sjoh...@jolla.com wrote:
 IPv6 configuration method is either CONNMAN_IPCONFIG_METHOD_FIXED
 (ipv6-pdp) or CONNMAN_IPCONFIG_METHOD_AUTO (SLAAC/DHCPv6,
 dual/ipv4v6-pdp).

RFC 6459, Section 5.2, IPv6 Address Configuration says: 

...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.  On the other hand, stateless
DHCPv6 service to obtain other configuration information is supported
RFC3736].  This implies that the M-bit is always zero and that the
O-bit may be set to one in the Router Advertisement (RA) sent to
the UE...

So only CONNMAN_IPCONFIG_METHOD_AUTO is allowed for IPv6 configuration,
right?


Cheers,

Patrik

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


Re: [PATCH 1/6] network: index needs to be set also for ip6config

2014-12-22 Thread Patrik Flykt
On Mon, 2014-12-22 at 13:01 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 Fixes the issue that network index was not set for
 ipv6-connections and therefore slaac/dhcpv6 was
 not working e.g. ofono cellular connections.

Applied, thanks!

Patrik

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

Re: [PATCH 5/6] ofono: Clean nameservers when disconnecting

2014-12-22 Thread Patrik Flykt
On Mon, 2014-12-22 at 13:01 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 Nameservers need to be cleaned after
 disconnecting so that they are not reused when
 pdp-protocol e.g. changes from ipv6 to dual/ipv4v6.

Applied, thanks!

Patrik

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

Re: No Carrier Error

2014-12-22 Thread Patrik Flykt

Hi,

On Sun, 2014-12-21 at 14:29 -0500, ajb...@myfairpoint.net wrote:
 Error /net/connman/technology/wifi: No carrier

Check that wifi technology is enabled and wpa_supplicant started via
ConnMan or with 'wpa_supplicant -u'

Cheers,

Patrik


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