diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2011-07-28 13:20:28 +0300 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-08-09 13:22:54 +0200 |
commit | 5b875e36444979b36170cf7074fb3e0f5b970a3e (patch) | |
tree | 87a62ad28048d1a8b3028ea7fbc462d519ffec9b /src | |
parent | d7f9c1d864581aeba3a45b1ddb0e1ad46f5184d1 (diff) | |
download | connman-5b875e36444979b36170cf7074fb3e0f5b970a3e.tar.gz connman-5b875e36444979b36170cf7074fb3e0f5b970a3e.tar.bz2 connman-5b875e36444979b36170cf7074fb3e0f5b970a3e.zip |
dhcp: Try to reuse the IP address we had last time.
This fix will cause the DHCP_REQUESTED_IP option to be sent to
the server.
Fixes BMC #21068
Diffstat (limited to 'src')
-rw-r--r-- | src/dhcp.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -103,6 +103,10 @@ static void dhcp_invalidate(struct connman_dhcp *dhcp, connman_bool_t callback) } } + __connman_ipconfig_set_dhcp_address(ipconfig, + __connman_ipconfig_get_local(ipconfig)); + DBG("last address %s", __connman_ipconfig_get_dhcp_address(ipconfig)); + __connman_ipconfig_address_remove(ipconfig); __connman_ipconfig_set_local(ipconfig, NULL); @@ -205,6 +209,9 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) address = g_dhcp_client_get_address(dhcp_client); + __connman_ipconfig_set_dhcp_address(ipconfig, address); + DBG("last address %s", address); + option = g_dhcp_client_get_option(dhcp_client, G_DHCP_SUBNET); if (option != NULL) netmask = g_strdup(option->data); @@ -365,6 +372,8 @@ static void dhcp_debug(const char *str, void *data) static int dhcp_request(struct connman_dhcp *dhcp) { + struct connman_service *service; + struct connman_ipconfig *ipconfig; GDHCPClient *dhcp_client; GDHCPClientError error; const char *hostname; @@ -412,7 +421,11 @@ static int dhcp_request(struct connman_dhcp *dhcp) dhcp->dhcp_client = dhcp_client; - return g_dhcp_client_start(dhcp_client); + service = __connman_service_lookup_from_network(dhcp->network); + ipconfig = __connman_service_get_ip4config(service); + + return g_dhcp_client_start(dhcp_client, + __connman_ipconfig_get_dhcp_address(ipconfig)); } static int dhcp_release(struct connman_dhcp *dhcp) |