ipconfig: Save last used DHCPv6 address
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Mon, 6 May 2013 10:06:32 +0000 (13:06 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 6 May 2013 11:33:56 +0000 (14:33 +0300)
This is needed when implementing CONFIRM message decision logic.

src/ipconfig.c

index 6927936f44f6d6c367f4b4969e94cbacfa1ce5c2..9de73aa7e7f4e572b7336baac293df4e21891b1c 100644 (file)
@@ -2222,6 +2222,15 @@ int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
                key = g_strdup_printf("%sprivacy", prefix);
                g_key_file_set_string(keyfile, identifier, key, privacy);
                g_free(key);
+
+               key = g_strdup_printf("%sDHCP.LastAddress", prefix);
+               if (ipconfig->last_dhcp_address != NULL &&
+                               strlen(ipconfig->last_dhcp_address) > 0)
+                       g_key_file_set_string(keyfile, identifier, key,
+                                       ipconfig->last_dhcp_address);
+               else
+                       g_key_file_remove_key(keyfile, identifier, key, NULL);
+               g_free(key);
        }
 
        switch (ipconfig->method) {