summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-06-25 14:56:05 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-06-25 14:56:05 +0200
commit47cd3d91cb069be8cbd6b1e72d6b33cab01e3b13 (patch)
tree464f43dd3486bc968e6d5d26a3b593b8389e345e /src/network.c
parentc6edc0442806a1de5e2f72eac86b22f530250fbc (diff)
downloadconnman-47cd3d91cb069be8cbd6b1e72d6b33cab01e3b13.tar.gz
connman-47cd3d91cb069be8cbd6b1e72d6b33cab01e3b13.tar.bz2
connman-47cd3d91cb069be8cbd6b1e72d6b33cab01e3b13.zip
Create service ipconfig only when it's NULL
If a service already has an allocated ipconfig layer but the corresponding network index is negative, the only thing left to do is to set the ipconfig index properly. The oFono plugin toggles the network index between connection while the service ipconfig layer stays alive.
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network.c b/src/network.c
index a241d15d..c36298e6 100644
--- a/src/network.c
+++ b/src/network.c
@@ -447,12 +447,15 @@ const char *connman_network_get_path(struct connman_network *network)
void connman_network_set_index(struct connman_network *network, int index)
{
struct connman_service *service;
+ struct connman_ipconfig *ipconfig;
service = __connman_service_lookup_from_network(network);
if (service == NULL)
goto done;
- if (network->element.index < 0)
+ ipconfig = __connman_service_get_ipconfig(service);
+
+ if (network->element.index < 0 && ipconfig == NULL)
/*
* This is needed for plugins that havent set their ipconfig
* layer yet, due to not being able to get a network index
@@ -460,10 +463,7 @@ void connman_network_set_index(struct connman_network *network, int index)
*/
__connman_service_create_ipconfig(service, index);
else {
- struct connman_ipconfig *ipconfig;
-
/* If index changed, the index of ipconfig must be reset. */
- ipconfig = __connman_service_get_ipconfig(service);
if (ipconfig == NULL)
goto done;