Update DHCP address when DHCP process successfully stopped

---
 src/dhcp.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/dhcp.c b/src/dhcp.c
index 3425b6d..fa2a408 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -185,6 +185,7 @@ static void lease_available_cb(GDHCPClient *dhcp_client,
gpointer user_data)
        struct connman_dhcp *dhcp = user_data;
        GList *list, *option = NULL;
        char *address, *netmask = NULL, *gateway = NULL;
+       char *server_address = NULL;
        const char *c_address, *c_gateway;
        char *domainname = NULL, *hostname = NULL;
        char **nameservers, **timeservers, *pac = NULL;
@@ -218,6 +219,11 @@ static void lease_available_cb(GDHCPClient
*dhcp_client, gpointer user_data)
        __connman_ipconfig_set_dhcp_address(ipconfig, address);
        DBG("last address %s", address);
 
+       server_address = g_dhcp_client_get_dhcp_server_address(dhcp_client);
+
+       __connman_ipconfig_set_dhcp_server_address(ipconfig,
server_address);
+       DBG("last dhcp server address %s", server_address);
+
        option = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET);
        if (option != NULL)
                netmask = g_strdup(option->data);
@@ -344,6 +350,7 @@ static void lease_available_cb(GDHCPClient *dhcp_client,
gpointer user_data)
        __connman_6to4_probe(service);
 
        g_free(address);
+       g_free(server_address);
        g_free(netmask);
        g_free(gateway);
        g_free(domainname);
@@ -378,6 +385,8 @@ static void ipv4ll_available_cb(GDHCPClient
*dhcp_client, gpointer user_data)
        __connman_ipconfig_set_prefixlen(ipconfig, prefixlen);
        __connman_ipconfig_set_gateway(ipconfig, NULL);
 
+       __connman_ipconfig_set_dhcp_server_address(ipconfig, NULL);
+
        dhcp_valid(dhcp);
 
        g_free(address);
-- 
1.7.9.5


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to