network: Clear interface addresses after removing gateway address.
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 22 Jun 2011 10:37:47 +0000 (13:37 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 27 Jun 2011 14:15:09 +0000 (16:15 +0200)
The reason for this patch is that service disconnect code path
is different from service change code path. In disconnect,
the __connman_ipconfig_address_remove() is called which clears the
addresses from interface. When changing from one service to another,
the function __connman_service_disconnect() is not called and thus
the interface address is not removed.
We cannot call __connman_ipconfig_address_remove() yet at this point
because it would clear addresses from internal data structures so we
use __connman_ipconfig_address_unset() instead.

src/network.c

index 4abcb09..0ae77ca 100644 (file)
@@ -1101,6 +1101,9 @@ static gboolean set_connected(gpointer user_data)
                __connman_connection_gateway_remove(service,
                                                CONNMAN_IPCONFIG_TYPE_ALL);
 
+               __connman_ipconfig_address_unset(ipconfig_ipv4);
+               __connman_ipconfig_address_unset(ipconfig_ipv6);
+
                __connman_service_indicate_state(service,
                                        CONNMAN_SERVICE_STATE_IDLE,
                                        CONNMAN_IPCONFIG_TYPE_IPV4);