network: Read only the ipconfig data if we have no address
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Fri, 26 Aug 2011 11:43:10 +0000 (14:43 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 26 Aug 2011 15:34:17 +0000 (17:34 +0200)
We must not read ipconfig data from file if there is already a valid
address that was set by service set_property().

Fixes BMC#22767

src/network.c

index 95aecc7..d360282 100644 (file)
@@ -890,10 +890,11 @@ static void set_connected_manual(struct connman_network *network)
 
        service = __connman_service_lookup_from_network(network);
 
-       __connman_service_read_ip4config(service);
-
        ipconfig = __connman_service_get_ip4config(service);
 
+       if (__connman_ipconfig_get_local(ipconfig) == NULL)
+               __connman_service_read_ip4config(service);
+
        set_configuration(network);
 
        err = __connman_ipconfig_address_add(ipconfig);
@@ -945,7 +946,8 @@ static int manual_ipv6_set(struct connman_network *network,
        if (service == NULL)
                return -EINVAL;
 
-       __connman_service_read_ip6config(service);
+       if (__connman_ipconfig_get_local(ipconfig_ipv6) == NULL)
+               __connman_service_read_ip6config(service);
 
        err = __connman_ipconfig_address_add(ipconfig_ipv6);
        if (err < 0) {