ipconfig: Clear ipconfig address when removing it
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 22 Mar 2011 20:41:23 +0000 (21:41 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 22 Mar 2011 20:41:23 +0000 (21:41 +0100)
src/ipconfig.c

index 9f0d5d9..0599a73 100644 (file)
@@ -1365,6 +1365,8 @@ int __connman_ipconfig_address_add(struct connman_ipconfig *ipconfig)
 
 int __connman_ipconfig_address_remove(struct connman_ipconfig *ipconfig)
 {
+       int err;
+
        DBG("");
 
        if (ipconfig == NULL)
@@ -1381,13 +1383,19 @@ int __connman_ipconfig_address_remove(struct connman_ipconfig *ipconfig)
        case CONNMAN_IPCONFIG_METHOD_DHCP:
        case CONNMAN_IPCONFIG_METHOD_MANUAL:
                if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4)
-                       return connman_inet_clear_address(ipconfig->index,
+                       err = connman_inet_clear_address(ipconfig->index,
                                                        ipconfig->address);
                else if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6)
-                       return connman_inet_clear_ipv6_address(
+                       err = connman_inet_clear_ipv6_address(
                                                ipconfig->index,
                                                ipconfig->address->local,
                                                ipconfig->address->prefixlen);
+               else
+                       err = -EINVAL;
+
+               connman_ipaddress_clear(ipconfig->address);
+
+               return err;
        }
 
        return 0;