From: arron <[email protected]>

---
 src/network.c |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/src/network.c b/src/network.c
index e7ae5d6..269fe62 100644
--- a/src/network.c
+++ b/src/network.c
@@ -308,27 +308,32 @@ void connman_network_set_index(struct connman_network 
*network, int index)
        DBG("index %d service %p ip4config %p", network->element.index,
                service, ipconfig);
 
-       if (network->element.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);
+       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);
+               goto next;
+       }
 
-       } else {
-               /* If index changed, the index of ipconfig must be reset. */
-               if (ipconfig == NULL)
-                       goto done;
+       /* If index changed, the index of ipconfig must be reset. */
+       __connman_ipconfig_set_index(ipconfig, index);
+
+next:
+       ipconfig = __connman_service_get_ip6config(service);
 
-               __connman_ipconfig_set_index(ipconfig, index);
+       DBG("index %d service %p ip6config %p", network->element.index,
+               service, ipconfig);
+
+       if (ipconfig == NULL) {
+               __connman_service_create_ip6config(service, index);
+               goto done;
        }
 
+       __connman_ipconfig_set_index(ipconfig, index);
+
 done:
        network->element.index = index;
 }
-- 
1.7.2.2

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

Reply via email to