network: Only set index in connman_network_set_index()
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Fri, 10 Aug 2012 09:59:00 +0000 (11:59 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 14 Aug 2012 06:01:41 +0000 (09:01 +0300)
Service ipconfig structures are no longer created in this
function.

src/network.c

index e72e35f..20e3ebc 100644 (file)
@@ -469,31 +469,14 @@ void connman_network_set_index(struct connman_network *network, int index)
                goto done;
 
        ipconfig = __connman_service_get_ip4config(service);
+       if (ipconfig == NULL)
+               goto done;
+
+       /* 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 (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;
-
-               __connman_ipconfig_set_index(ipconfig, index);
-       }
-
 done:
        network->index = index;
 }