summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Sansanwal <abhishek.s94@samsung.com>2017-04-10 06:38:14 (GMT)
committerAbhishek Sansanwal <abhishek.s94@samsung.com>2017-04-10 06:38:14 (GMT)
commit1a8bd8384824f7b4b6e513c7eff6a6f4f02769cd (patch)
treea3f99c96bbbb3a8197c97f5fe6a7e741cd89405d
parent6df34c52ef916fd3122053525647ccfbad82def9 (diff)
downloadconnman-1a8bd8384824f7b4b6e513c7eff6a6f4f02769cd.zip
connman-1a8bd8384824f7b4b6e513c7eff6a6f4f02769cd.tar.gz
connman-1a8bd8384824f7b4b6e513c7eff6a6f4f02769cd.tar.bz2
Change-Id: I61defbc6fba37e7c3a04516d1946f2b5cd22af1a Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
-rwxr-xr-xsrc/dhcp.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/dhcp.c b/src/dhcp.c
index 32ffcd9..0a2f6fc 100755
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -439,7 +439,7 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
char *address, *netmask = NULL, *gateway = NULL;
const char *c_address, *c_gateway;
unsigned char prefixlen, c_prefixlen;
- bool ip_change;
+ bool ip_change = false;
DBG("Lease available");
@@ -471,14 +471,21 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
DBG("c_address %s", c_address);
- if (g_strcmp0(address, c_address))
+ if (g_strcmp0(address, c_address)) {
ip_change = true;
- else if (g_strcmp0(gateway, c_gateway))
+ if (c_address) {
+ /* Remove old ip address */
+ __connman_ipconfig_address_remove(dhcp->ipconfig);
+ }
+ }
+ if (g_strcmp0(gateway, c_gateway)) {
ip_change = true;
- else if (prefixlen != c_prefixlen)
+ if (c_gateway) {
+ /* Remove gateway ip address */
+ __connman_ipconfig_gateway_remove(dhcp->ipconfig);
+ }
+ } else if (prefixlen != c_prefixlen)
ip_change = true;
- else
- ip_change = false;
__connman_ipconfig_set_method(dhcp->ipconfig,
CONNMAN_IPCONFIG_METHOD_DHCP);