From: Patrik Flykt <[email protected]>

Fix function to update or set the network index only.
---
 src/network.c |   28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/network.c b/src/network.c
index bf01767..bd1b157 100644
--- a/src/network.c
+++ b/src/network.c
@@ -465,34 +465,16 @@ void connman_network_set_index(struct connman_network 
*network, int index)
        struct connman_ipconfig *ipconfig;
 
        service = __connman_service_lookup_from_network(network);
-       if (service == NULL)
+       if (service == NULL || index < 0)
                goto done;
 
        ipconfig = __connman_service_get_ip4config(service);
+       if (ipconfig != NULL)
+               __connman_ipconfig_set_index(ipconfig, index);
 
-       DBG("index %d service %p ip4config %p", network->index,
-               service, ipconfig);
-
-       if (network->index < 0 && ipconfig == NULL) {
-
-               ipconfig = __connman_service_get_ip4config(service);
-               if (ipconfig == NULL)
-                       /*
-                        * This is needed for plugins that havent set their
-                        * ipconfig layer yet, due to not being able to get
-                        * a network index prior to creating a service.
-                        */
-                       __connman_service_create_ip4config(service, index);
-               else
-                       __connman_ipconfig_set_index(ipconfig, index);
-
-       } else {
-               /* If index changed, the index of ipconfig must be reset. */
-               if (ipconfig == NULL)
-                       goto done;
-
+       ipconfig = __connman_service_get_ip6config(service);
+       if (ipconfig != NULL)
                __connman_ipconfig_set_index(ipconfig, index);
-       }
 
 done:
        network->index = index;
-- 
1.7.10

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to