2008-05-13 Dan Williams <dcbw@redhat.com>

Fix refcounting issues over sleep/wake when a VPN connection was active that
	caused NM to try registering an object path for a device upon wake that was
	the same as an already registered object path.

	* src/nm-device.c
		- (nm_device_take_down): properly handle cases where the device is
			no longer active but was just active, and therefore must be
			deactivated.  When a device moves to unmanaged mode, this function
			previously would not deactivate the device, because the state was
			already unmanaged by the time this function was called.

	* src/vpn-manager/nm-vpn-connection.c
		- (device_state_changed): properly handle multiple devices states in
			which the device is now deactivated.  Code previously didn't handle
			transitions to the UNAVAILABLE (like rfkill or carrier off) and
			UNMANAGED states.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3667 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-05-14 02:56:01 +00:00
parent aa44d70038
commit 493f808b01
3 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,22 @@
2008-05-13 Dan Williams <dcbw@redhat.com>
Fix refcounting issues over sleep/wake when a VPN connection was active that
caused NM to try registering an object path for a device upon wake that was
the same as an already registered object path.
* src/nm-device.c
- (nm_device_take_down): properly handle cases where the device is
no longer active but was just active, and therefore must be
deactivated. When a device moves to unmanaged mode, this function
previously would not deactivate the device, because the state was
already unmanaged by the time this function was called.
* src/vpn-manager/nm-vpn-connection.c
- (device_state_changed): properly handle multiple devices states in
which the device is now deactivated. Code previously didn't handle
transitions to the UNAVAILABLE (like rfkill or carrier off) and
UNMANAGED states.
2008-05-13 Dan Williams <dcbw@redhat.com>
* src/nm-device-private.h

View file

@ -1470,12 +1470,9 @@ nm_device_bring_up (NMDevice *self, gboolean wait)
void
nm_device_take_down (NMDevice *self, gboolean wait)
{
NMDeviceState state;
g_return_if_fail (NM_IS_DEVICE (self));
state = nm_device_get_state (self);
if ((state == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating (self))
if (nm_device_get_act_request (self))
nm_device_interface_deactivate (NM_DEVICE_INTERFACE (self));
if (nm_device_is_up (self)) {

View file

@ -179,7 +179,7 @@ device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data)
{
NMVPNConnection *connection = NM_VPN_CONNECTION (user_data);
if (state == NM_DEVICE_STATE_DISCONNECTED) {
if (state <= NM_DEVICE_STATE_DISCONNECTED) {
nm_vpn_connection_set_vpn_state (connection,
NM_VPN_CONNECTION_STATE_DISCONNECTED,
NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED);