ipconfig: Save prefixlen only if not cleared
authorJulien Massot <jmassot@aldebaran-robotics.com>
Fri, 15 Jun 2012 13:15:31 +0000 (13:15 +0000)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 25 Jun 2012 06:49:30 +0000 (09:49 +0300)
This commit fixes a bug when using manual ipv4 addressing.
The first time it works, but once the service is reconnected it uses
an invalid netmask: 255.255.255.255.

src/ipconfig.c

index b401c23..5e34ac0 100644 (file)
@@ -2344,8 +2344,9 @@ int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
        }
 
        key = g_strdup_printf("%snetmask_prefixlen", prefix);
-       g_key_file_set_integer(keyfile, identifier,
-                       key, ipconfig->address->prefixlen);
+       if (ipconfig->address->prefixlen != 0)
+               g_key_file_set_integer(keyfile, identifier,
+                               key, ipconfig->address->prefixlen);
        g_free(key);
 
        key = g_strdup_printf("%slocal_address", prefix);