Fix configuration loading for unknown service
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 18 Feb 2010 10:58:53 +0000 (08:58 -0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Feb 2010 17:13:03 +0000 (09:13 -0800)
In case a service is unknown, the expected behavior is that it uses
dhcp. Currently, method will be left blank and thus connman will not be
able to connect to that service unless method is explicitly set through
IPv4.Configuration property.

src/ipconfig.c

index 9e1dbf4..91ce244 100644 (file)
@@ -1238,7 +1238,10 @@ int __connman_ipconfig_load(struct connman_ipconfig *ipconfig,
 
        key = g_strdup_printf("%smethod", prefix);
        method = g_key_file_get_string(keyfile, identifier, key, NULL);
-       ipconfig->method = __connman_ipconfig_string2method(method);
+       if (method == NULL)
+               ipconfig->method = CONNMAN_IPCONFIG_METHOD_DHCP;
+       else
+               ipconfig->method = __connman_ipconfig_string2method(method);
        g_free(key);
 
        key = g_strdup_printf("%snetmask_prefixlen", prefix);