ipconfig: Fix IPv6.Configuration parsing
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Mon, 24 Sep 2012 12:04:26 +0000 (15:04 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 28 Sep 2012 06:39:22 +0000 (09:39 +0300)
PrefixLength is exposed as a byte in the API, but code was
waiting for a string when setting a new value.

src/ipconfig.c

index 0c88fa5..3de30cd 100644 (file)
@@ -2095,7 +2095,7 @@ int __connman_ipconfig_set_config(struct connman_ipconfig *ipconfig,
 {
        enum connman_ipconfig_method method = CONNMAN_IPCONFIG_METHOD_UNKNOWN;
        const char *address = NULL, *netmask = NULL, *gateway = NULL,
-               *prefix_length_string = NULL, *privacy_string = NULL;
+               *privacy_string = NULL;
        int prefix_length = 0, privacy = 0;
        DBusMessageIter dict;
 
@@ -2140,13 +2140,11 @@ int __connman_ipconfig_set_config(struct connman_ipconfig *ipconfig,
 
                        dbus_message_iter_get_basic(&value, &address);
                } else if (g_str_equal(key, "PrefixLength") == TRUE) {
-                       if (type != DBUS_TYPE_STRING)
+                       if (type != DBUS_TYPE_BYTE)
                                return -EINVAL;
 
-                       dbus_message_iter_get_basic(&value,
-                                                       &prefix_length_string);
+                       dbus_message_iter_get_basic(&value, &prefix_length);
 
-                       prefix_length = atoi(prefix_length_string);
                        if (prefix_length < 0 || prefix_length > 128)
                                return -EINVAL;
                } else if (g_str_equal(key, "Netmask") == TRUE) {