[PATCH] ipconfig: use only settings related to configuration method

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

If service is ever being configured with manual ip-address, netmask
and gateway and later changed to dhcp, the related settings must
not be read if configuration method is not manual or fixed.
Otherwise they can possible collide with the settings got from
dhcp-server if they are exactly the same
(eg. dhcp.c: lease_available_cb()). This could lead network
interface not being configured correctly.
---
 src/ipconfig.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/ipconfig.c b/src/ipconfig.c
index 5c34e98..803b7d1 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -2249,6 +2249,25 @@ int __connman_ipconfig_load(struct connman_ipconfig 
*ipconfig,
g_free(method);
g_free(key);
 
+   switch (ipconfig-method) {
+   case CONNMAN_IPCONFIG_METHOD_FIXED:
+   case CONNMAN_IPCONFIG_METHOD_MANUAL:
+   break;
+   case CONNMAN_IPCONFIG_METHOD_DHCP:
+   key = g_strdup_printf(%sDHCP.LastAddress, prefix);
+   str = g_key_file_get_string(keyfile, identifier, key, NULL);
+   if (str) {
+   g_free(ipconfig-last_dhcp_address);
+   ipconfig-last_dhcp_address = str;
+   }
+   g_free(key);
+   /* fall through */
+   case CONNMAN_IPCONFIG_METHOD_UNKNOWN:
+   case CONNMAN_IPCONFIG_METHOD_OFF:
+   case CONNMAN_IPCONFIG_METHOD_AUTO:
+   return 0;
+   }
+
key = g_strdup_printf(%snetmask_prefixlen, prefix);
ipconfig-address-prefixlen = g_key_file_get_integer(
keyfile, identifier, key, NULL);
@@ -2278,14 +2297,6 @@ int __connman_ipconfig_load(struct connman_ipconfig 
*ipconfig,
keyfile, identifier, key, NULL);
g_free(key);
 
-   key = g_strdup_printf(%sDHCP.LastAddress, prefix);
-   str = g_key_file_get_string(keyfile, identifier, key, NULL);
-   if (str) {
-   g_free(ipconfig-last_dhcp_address);
-   ipconfig-last_dhcp_address = str;
-   }
-   g_free(key);
-
return 0;
 }
 
-- 
2.1.0

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

[PATCH 3/4] network: make sure that IPv6 is enabled with autoconfiguration

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

Previously IPv6 enabled with manual_ipv6_net but not with
autoconfiguration.
---
 src/network.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/network.c b/src/network.c
index 0e979c9..217be32 100644
--- a/src/network.c
+++ b/src/network.c
@@ -614,6 +614,8 @@ static void autoconf_ipv6_set(struct connman_network 
*network)
if (!ipconfig)
return;
 
+   __connman_ipconfig_enable_ipv6(ipconfig);
+
__connman_ipconfig_address_remove(ipconfig);
 
index = __connman_ipconfig_get_index(ipconfig);
-- 
2.1.0

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

[PATCH 4/4] network: set network-connecting after ip address is set

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

network-connecting was incorrectly set to false on
autoconf_ipv6_set and it needs to be set only after we have
ip addresses for the interface.
---
 src/network.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/network.c b/src/network.c
index 217be32..0cef220 100644
--- a/src/network.c
+++ b/src/network.c
@@ -521,10 +521,14 @@ static void check_dhcpv6(struct nd_router_advert *reply,
/*
 * We do stateful/stateless DHCPv6 if router advertisement says so.
 */
-   if (reply-nd_ra_flags_reserved  ND_RA_FLAG_MANAGED)
+   if (reply-nd_ra_flags_reserved  ND_RA_FLAG_MANAGED) {
__connman_dhcpv6_start(network, prefixes, dhcpv6_callback);
-   else if (reply-nd_ra_flags_reserved  ND_RA_FLAG_OTHER)
+   } else if (reply-nd_ra_flags_reserved  ND_RA_FLAG_OTHER) {
__connman_dhcpv6_start_info(network, dhcpv6_info_callback);
+   network-connecting = false;
+   } else {
+   network-connecting = false;
+   }
 
connman_network_unref(network);
 }
@@ -604,8 +608,6 @@ static void autoconf_ipv6_set(struct connman_network 
*network)
 
connman_device_set_disconnected(network-device, false);
 
-   network-connecting = false;
-
service = connman_service_lookup_from_network(network);
if (!service)
return;
-- 
2.1.0

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

[PATCH 2/4] network: fix eternal associating with IPv6-only

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

It was possible with IPv6-only networks to have eternal
associating variable set as true, especially
when ipv4 configuration method was OFF.
---
 src/network.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index db19cb9..0e979c9 100644
--- a/src/network.c
+++ b/src/network.c
@@ -342,6 +342,8 @@ static int manual_ipv6_set(struct connman_network *network,
 
connman_device_set_disconnected(network-device, false);
 
+   connman_network_set_associating(network, false);
+
network-connecting = false;
 
return 0;
@@ -386,8 +388,6 @@ static int dhcpv6_set_addresses(struct connman_network 
*network)
if (!service)
goto err;
 
-   connman_network_set_associating(network, false);
-
network-connecting = false;
 
ipconfig_ipv6 = __connman_service_get_ip6config(service);
@@ -511,6 +511,8 @@ static void check_dhcpv6(struct nd_router_advert *reply,
if (service) {
connman_service_create_ip6config(service, network-index);
 
+   connman_network_set_associating(network, false);
+
__connman_service_ipconfig_indicate_state(service,
CONNMAN_SERVICE_STATE_CONFIGURATION,
CONNMAN_IPCONFIG_TYPE_IPV6);
-- 
2.1.0

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

Re: [PATCH 2/3] network: fix eternal associating/connecting with IPv6-only

2015-02-11 Thread Pasi Sjöholm


On 10.02.2015 16:56, Patrik Flykt wrote:

  if (service) {
  connman_service_create_ip6config(service, network-index);
  
 +network-connecting = false;
 +
 +connman_network_set_associating(network, false);
 +
  __connman_service_ipconfig_indicate_state(service,
  CONNMAN_SERVICE_STATE_CONFIGURATION,
  CONNMAN_IPCONFIG_TYPE_IPV6);
 
 We're not connected yet at this point, network-connecting can go false
 starting with dhcpv6_callback().

The network-connected is set to true already on set_connected(),
meaning it's done before connecting is changed to false (which is done
on autoconf_ipv6_set()).

Therefore doing network-connecting = false here does not do anything as
it is already false. Will update the PR.

Br,
Pasi




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


[PATCH 2/3 v2] network: fix eternal associating with IPv6-only

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

It was possible with IPv6-only networks to have eternal
associating variable set as true, especially
when ipv4 configuration method was OFF.
---
 src/network.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/network.c b/src/network.c
index db19cb9..5673caf 100644
--- a/src/network.c
+++ b/src/network.c
@@ -342,6 +342,8 @@ static int manual_ipv6_set(struct connman_network *network,
 
connman_device_set_disconnected(network-device, false);
 
+   connman_network_set_associating(network, false);
+
network-connecting = false;
 
return 0;
@@ -386,10 +388,6 @@ static int dhcpv6_set_addresses(struct connman_network 
*network)
if (!service)
goto err;
 
-   connman_network_set_associating(network, false);
-
-   network-connecting = false;
-
ipconfig_ipv6 = __connman_service_get_ip6config(service);
err = __connman_ipconfig_address_add(ipconfig_ipv6);
if (err  0)
@@ -511,6 +509,8 @@ static void check_dhcpv6(struct nd_router_advert *reply,
if (service) {
connman_service_create_ip6config(service, network-index);
 
+   connman_network_set_associating(network, false);
+
__connman_service_ipconfig_indicate_state(service,
CONNMAN_SERVICE_STATE_CONFIGURATION,
CONNMAN_IPCONFIG_TYPE_IPV6);
-- 
2.1.0

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

[PATCH 2/3 v3] network: fix eternal associating with IPv6-only

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

It was possible with IPv6-only networks to have eternal
associating variable set as true, especially
when ipv4 configuration method was OFF.
---
 src/network.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/network.c b/src/network.c
index db19cb9..8bfe121 100644
--- a/src/network.c
+++ b/src/network.c
@@ -342,6 +342,8 @@ static int manual_ipv6_set(struct connman_network *network,
 
connman_device_set_disconnected(network-device, false);
 
+   connman_network_set_associating(network, false);
+
network-connecting = false;
 
return 0;
@@ -386,8 +388,6 @@ static int dhcpv6_set_addresses(struct connman_network 
*network)
if (!service)
goto err;
 
-   connman_network_set_associating(network, false);
-
network-connecting = false;
 
ipconfig_ipv6 = __connman_service_get_ip6config(service);
@@ -511,6 +511,8 @@ static void check_dhcpv6(struct nd_router_advert *reply,
if (service) {
connman_service_create_ip6config(service, network-index);
 
+   connman_network_set_associating(network, false);
+
__connman_service_ipconfig_indicate_state(service,
CONNMAN_SERVICE_STATE_CONFIGURATION,
CONNMAN_IPCONFIG_TYPE_IPV6);
@@ -519,10 +521,14 @@ static void check_dhcpv6(struct nd_router_advert *reply,
/*
 * We do stateful/stateless DHCPv6 if router advertisement says so.
 */
-   if (reply-nd_ra_flags_reserved  ND_RA_FLAG_MANAGED)
+   if (reply-nd_ra_flags_reserved  ND_RA_FLAG_MANAGED) {
__connman_dhcpv6_start(network, prefixes, dhcpv6_callback);
-   else if (reply-nd_ra_flags_reserved  ND_RA_FLAG_OTHER)
+   } else if (reply-nd_ra_flags_reserved  ND_RA_FLAG_OTHER) {
__connman_dhcpv6_start_info(network, dhcpv6_info_callback);
+   network-connecting = false;
+   } else {
+   network-connecting = false;
+   }
 
connman_network_unref(network);
 }
@@ -602,8 +608,6 @@ static void autoconf_ipv6_set(struct connman_network 
*network)
 
connman_device_set_disconnected(network-device, false);
 
-   network-connecting = false;
-
service = connman_service_lookup_from_network(network);
if (!service)
return;
-- 
2.1.0

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

[PATCH 0/4 v2] various IPv6 fixes

2015-02-11 Thread pasi . sjoholm
From: Pasi Sjöholm pasi.sjoh...@jollamobile.com

v2: Splitted patch 2 in two.

Found these problems while playing with IPv4/6-only connections while
other ip-version method is set to OFF.

Pasi Sjöholm (4):
  network: disable IPv6 completely if method is off
  network: fix eternal associating with IPv6-only
  network: make sure that IPv6 is enabled with autoconfiguration
  network: set network-connecting after ip address is set

 src/network.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

-- 
2.1.0

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

Re: [RFC] ofono: Set ipconfig off if indicated that the protocol is not used

2015-02-11 Thread Patrik Flykt
On Tue, 2015-02-10 at 12:20 +0200, Patrik Flykt wrote:
 On Mon, 2015-02-09 at 11:45 +0200, Pasi Sjöholm wrote:
  And by this I mean the two lines below could be removed. :)
  
   +if (modem-active)
   +set_connected(modem);
 
 I'll remove those from the patch, thanks!

Patch applied and modified according to above.

Patrik

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

Re: [PATCH 2/2] ofono: do not reset method if its _OFF

2015-02-11 Thread Patrik Flykt
On Mon, 2015-02-09 at 11:41 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 Method must not be reset from _OFF when disconnecting
 but only through Protocol-message handling.

Applied this patch, thanks!

Patrik

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

Re: [PATCH 0/4 v2] various IPv6 fixes

2015-02-11 Thread Patrik Flykt
On Wed, 2015-02-11 at 12:14 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 v2: Splitted patch 2 in two.
 
 Found these problems while playing with IPv4/6-only connections while
 other ip-version method is set to OFF.

Applied all four patches, thanks!

Patrik

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

Re: [PATCH 1/2] ofono: always set configuration method when connected

2015-02-11 Thread Patrik Flykt
On Mon, 2015-02-09 at 11:41 +0200, pasi.sjoh...@jolla.com wrote:
 From: Pasi Sjöholm pasi.sjoh...@jollamobile.com
 
 If configuration method is not always set the ConnMan
 will use previously set configuration from previous
 connections.
 ---
  plugins/ofono.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)
 
 diff --git a/plugins/ofono.c b/plugins/ofono.c
 index fabbf7c..b79cb0c 100644
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -277,12 +277,11 @@ static void set_connected(struct modem_data *modem)
   if (!service)
   return;
  
 - if (method == CONNMAN_IPCONFIG_METHOD_FIXED ||
 - method == CONNMAN_IPCONFIG_METHOD_DHCP) {
 - connman_service_create_ip4config(service, index);
 -
 - connman_network_set_ipv4_method(modem-network, method);
 + connman_service_create_ip4config(service, index);
 + connman_network_set_ipv4_method(modem-network, method);

So if method is off or unknown, we'd unnecessarily create and ipconfig
here, right?
 
 + if (method == CONNMAN_IPCONFIG_METHOD_FIXED ||
 + method == CONNMAN_IPCONFIG_METHOD_DHCP) {
   setip = true;
   }
  
 @@ -292,10 +291,10 @@ static void set_connected(struct modem_data *modem)
   }
  
   method = modem-context-ipv6_method;
 - if (method == CONNMAN_IPCONFIG_METHOD_AUTO) {
 - connman_service_create_ip6config(service, index);
 - connman_network_set_ipv6_method(modem-network, method);
 + connman_service_create_ip6config(service, index);
 + connman_network_set_ipv6_method(modem-network, method);

And here too?
 
 + if (method == CONNMAN_IPCONFIG_METHOD_AUTO) {
   setip = true;
   }
  

Cheers,

Patrik

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

[RFC] network: Merge identical ipconfig code paths

2015-02-11 Thread Patrik Flykt
Configure IPv4 and IPv6 configurations only once in
__connman_network_enable_ipconfig() and use this function when setting
the network connected. Remove duplicate implementations of the same
functionality and rework the code to centralise configuration state and
error reporting.

The variable network-connecting is true as long as the IPv4 or IPv6
address configuration phase is ongoing.
---

Hi,

This is a fairly large patch that removes duplicate code in set_connected()
in favor of using the one in __connman_network_set_ipconfig(). There is
no change in functionality in this patch.

Please test,

   Patrik


 src/connman.h |   5 +-
 src/network.c | 216 +-
 src/service.c |  21 +++---
 3 files changed, 79 insertions(+), 163 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index 8d4a692..d4765cc 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -587,9 +587,8 @@ int __connman_network_connect(struct connman_network 
*network);
 int __connman_network_disconnect(struct connman_network *network);
 int __connman_network_clear_ipconfig(struct connman_network *network,
struct connman_ipconfig *ipconfig);
-int __connman_network_set_ipconfig(struct connman_network *network,
-   struct connman_ipconfig *ipconfig_ipv4,
-   struct connman_ipconfig *ipconfig_ipv6);
+int __connman_network_enable_ipconfig(struct connman_network *network,
+   struct connman_ipconfig *ipconfig);
 
 const char *__connman_network_get_type(struct connman_network *network);
 const char *__connman_network_get_group(struct connman_network *network);
diff --git a/src/network.c b/src/network.c
index 0cef220..24103df 100644
--- a/src/network.c
+++ b/src/network.c
@@ -153,10 +153,6 @@ static void dhcp_success(struct connman_network *network)
if (!service)
goto err;
 
-   connman_network_set_associating(network, false);
-
-   network-connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
 
DBG(lease acquired for ipconfig %p, ipconfig_ipv4);
@@ -188,9 +184,6 @@ static void dhcp_failure(struct connman_network *network)
if (!service)
return;
 
-   connman_network_set_associating(network, false);
-   network-connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
 
DBG(lease lost for ipconfig %p, ipconfig_ipv4);
@@ -206,55 +199,24 @@ static void dhcp_callback(struct connman_ipconfig 
*ipconfig,
struct connman_network *network,
bool success, gpointer data)
 {
+   network-connecting = false;
+
if (success)
dhcp_success(network);
else
dhcp_failure(network);
 }
 
-static int set_connected_fixed(struct connman_network *network)
-{
-   struct connman_service *service;
-   struct connman_ipconfig *ipconfig_ipv4;
-   int err;
-
-   DBG();
-
-   service = connman_service_lookup_from_network(network);
-
-   ipconfig_ipv4 = __connman_service_get_ip4config(service);
-
-   set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
-   network-connecting = false;
-
-   connman_network_set_associating(network, false);
-
-   err = __connman_ipconfig_address_add(ipconfig_ipv4);
-   if (err  0)
-   goto err;
-
-   err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
-   if (err  0)
-   goto err;
-
-   return 0;
-
-err:
-   connman_network_set_error(network,
-   CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
-
-   return err;
-}
-
-static void set_connected_manual(struct connman_network *network)
+static int set_connected_manual(struct connman_network *network)
 {
+   int err = 0;
struct connman_service *service;
struct connman_ipconfig *ipconfig;
-   int err;
 
DBG(network %p, network);
 
+   network-connecting = false;
+
service = connman_service_lookup_from_network(network);
 
ipconfig = __connman_service_get_ip4config(service);
@@ -262,8 +224,6 @@ static void set_connected_manual(struct connman_network 
*network)
if (!__connman_ipconfig_get_local(ipconfig))
__connman_service_read_ip4config(service);
 
-   set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
err = __connman_ipconfig_address_add(ipconfig);
if (err  0)
goto err;
@@ -272,16 +232,8 @@ static void set_connected_manual(struct connman_network 
*network)
if (err  0)
goto err;
 
-   network-connecting = false;
-
-   connman_network_set_associating(network, false);
-
-   return;
-
 err:
-   connman_network_set_error(network,
-   CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
-   return;
+   

[RFC v2] network: Merge identical ipconfig code paths

2015-02-11 Thread Patrik Flykt
Configure IPv4 and IPv6 configurations only once in
__connman_network_enable_ipconfig() and use this function when setting
the network connected. Remove obsolete function and rework the rest
to centralise configuration state and error reporting.

The variable network-connecting is true as long as the IPv4 or IPv6
address configuration phase is ongoing.
---


Hi,

This is a fairly large patch that removes duplicate code in set_connected()
in favor of using the one in __connman_network_set_ipconfig(). There is
no change in functionality in this patch.

v2 fixes a glitch with variable naming wrt rebasing


Please test,

   Patrik


 src/connman.h |   5 +-
 src/network.c | 218 +-
 src/service.c |  21 +++---
 3 files changed, 80 insertions(+), 164 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index 8d4a692..d4765cc 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -587,9 +587,8 @@ int __connman_network_connect(struct connman_network 
*network);
 int __connman_network_disconnect(struct connman_network *network);
 int __connman_network_clear_ipconfig(struct connman_network *network,
struct connman_ipconfig *ipconfig);
-int __connman_network_set_ipconfig(struct connman_network *network,
-   struct connman_ipconfig *ipconfig_ipv4,
-   struct connman_ipconfig *ipconfig_ipv6);
+int __connman_network_enable_ipconfig(struct connman_network *network,
+   struct connman_ipconfig *ipconfig);
 
 const char *__connman_network_get_type(struct connman_network *network);
 const char *__connman_network_get_group(struct connman_network *network);
diff --git a/src/network.c b/src/network.c
index 0cef220..253966e 100644
--- a/src/network.c
+++ b/src/network.c
@@ -153,10 +153,6 @@ static void dhcp_success(struct connman_network *network)
if (!service)
goto err;
 
-   connman_network_set_associating(network, false);
-
-   network-connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
 
DBG(lease acquired for ipconfig %p, ipconfig_ipv4);
@@ -188,9 +184,6 @@ static void dhcp_failure(struct connman_network *network)
if (!service)
return;
 
-   connman_network_set_associating(network, false);
-   network-connecting = false;
-
ipconfig_ipv4 = __connman_service_get_ip4config(service);
 
DBG(lease lost for ipconfig %p, ipconfig_ipv4);
@@ -206,55 +199,24 @@ static void dhcp_callback(struct connman_ipconfig 
*ipconfig,
struct connman_network *network,
bool success, gpointer data)
 {
+   network-connecting = false;
+
if (success)
dhcp_success(network);
else
dhcp_failure(network);
 }
 
-static int set_connected_fixed(struct connman_network *network)
-{
-   struct connman_service *service;
-   struct connman_ipconfig *ipconfig_ipv4;
-   int err;
-
-   DBG();
-
-   service = connman_service_lookup_from_network(network);
-
-   ipconfig_ipv4 = __connman_service_get_ip4config(service);
-
-   set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
-   network-connecting = false;
-
-   connman_network_set_associating(network, false);
-
-   err = __connman_ipconfig_address_add(ipconfig_ipv4);
-   if (err  0)
-   goto err;
-
-   err = __connman_ipconfig_gateway_add(ipconfig_ipv4);
-   if (err  0)
-   goto err;
-
-   return 0;
-
-err:
-   connman_network_set_error(network,
-   CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
-
-   return err;
-}
-
-static void set_connected_manual(struct connman_network *network)
+static int set_connected_manual(struct connman_network *network)
 {
+   int err = 0;
struct connman_service *service;
struct connman_ipconfig *ipconfig;
-   int err;
 
DBG(network %p, network);
 
+   network-connecting = false;
+
service = connman_service_lookup_from_network(network);
 
ipconfig = __connman_service_get_ip4config(service);
@@ -262,8 +224,6 @@ static void set_connected_manual(struct connman_network 
*network)
if (!__connman_ipconfig_get_local(ipconfig))
__connman_service_read_ip4config(service);
 
-   set_configuration(network, CONNMAN_IPCONFIG_TYPE_IPV4);
-
err = __connman_ipconfig_address_add(ipconfig);
if (err  0)
goto err;
@@ -272,16 +232,8 @@ static void set_connected_manual(struct connman_network 
*network)
if (err  0)
goto err;
 
-   network-connecting = false;
-
-   connman_network_set_associating(network, false);
-
-   return;
-
 err:
-   connman_network_set_error(network,
-   CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL);
- 

Re: Service state progression

2015-02-11 Thread Patrik Flykt
On Fri, 2015-02-06 at 20:42 +, Thomas Green wrote:
 I was wondering what the appropriate state progression for a wifi service 
 that either gets shut off or goes out of range.  From what I have seen, when 
 I shut off an AP that I'm connected to, I get the following signals:
 
 Service.PropertyChanged association
 Service.PropertyChanged disconnect
 Service.PropertyChanged association
 
 all for the same service.

I think wpa_supplicant tries to re-associate to the AP, then figures out
it is indeed disconnected, whereafter it either tries re-association
again or ConnMan tries to reconnect to the network. Looks fully normal.

 Also, what causes a service to be listed in RemovedServices list when
 the Manager.ServicesChanged signal is emitted?  Currently, after some
 timeout after a scan, all wireless services are being listed as
 removed.

wpa_supplicant timeouts networks not seen for ~2 mins. That happens as
ConnMan does not continuously scan for wifi networks. When
wpa_supplicant removes them, ConnMan removes them also.


Cheers,

Patrik

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


Re: [PATCH 1/2] ofono: always set configuration method when connected

2015-02-11 Thread Pasi Sjöholm
Hi,

On 11.02.2015 13:34, Patrik Flykt wrote:
 --- a/plugins/ofono.c
 +++ b/plugins/ofono.c
 @@ -277,12 +277,11 @@ static void set_connected(struct modem_data *modem)
  if (!service)
  return;
  
 -if (method == CONNMAN_IPCONFIG_METHOD_FIXED ||
 -method == CONNMAN_IPCONFIG_METHOD_DHCP) {
 -connman_service_create_ip4config(service, index);
 -
 -connman_network_set_ipv4_method(modem-network, method);
 +connman_service_create_ip4config(service, index);
 +connman_network_set_ipv4_method(modem-network, method);
 So if method is off or unknown, we'd unnecessarily create and ipconfig
 here, right?

connman_service_create_ip4/6config() will not create ipconfig if it
already exists, and we can't set method unless we have existing ipconfig
for a service. So it is necessary even when method is OFF or UNKNOWN.

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