dhcp: Clear ipaddresses from ipconfig before starting DHCP
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 1 Nov 2012 12:16:24 +0000 (14:16 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 2 Nov 2012 08:42:24 +0000 (10:42 +0200)
This is needed if manually configured addresses were used and later
DHCP was taken into use. If the manually configured IP information
(address, netmask and gateway) and the information given by DHCP is the
same, DHCP will not set the IP address to the interface.

src/dhcp.c

index 1dbe1ba..e64c975 100644 (file)
@@ -449,6 +449,12 @@ static int dhcp_request(struct connman_dhcp *dhcp)
        service = connman_service_lookup_from_network(dhcp->network);
        ipconfig = __connman_service_get_ip4config(service);
 
+       /*
+        * Clear the addresses at startup so that lease callback will
+        * take the lease and set ip address properly.
+        */
+       __connman_ipconfig_clear_address(ipconfig);
+
        return g_dhcp_client_start(dhcp_client,
                                __connman_ipconfig_get_dhcp_address(ipconfig));
 }