core: fix unmanaging of devices when quitting

When NM quits, we don't want to unmanage a device that has
an active connection and can take that connection over again when
NM starts back up.  This makes '/etc/init.d/NetworkManager restart'
work seamlessly.  All other devices get unmanaged so their
connection (and any dependent VPN connections or wpa_supplicant
processes) get terminated.  This bug caused active VPN connections
over wifi to be left running even when they didn't have IP
connectivity.

There were two bugs:

1) the NMDevice class implemented connection_match_config() for
all device subclasses, but only Ethernet devices can assume
connections at startup.  Thus the quit-time check passed for
active wifi devices too, and they weren't properly cleaned up

2) The logic for figuring out which devices to clean up after when
quitting was somewhat flawed; we want to default to unmanaging
devices and then skip that step for ones that meet specific
criteria.  Instead the code defaulted to leaving all devices active
at shutdown.
This commit is contained in:
Dan Williams
2010-08-11 17:26:33 -05:00
parent 92babdb658
commit 37c578a2a2
4 changed files with 37 additions and 24 deletions

View File

@@ -398,11 +398,13 @@ nm_device_interface_connection_match_config (NMDeviceInterface *device,
}
gboolean
nm_device_interface_can_assume_connection (NMDeviceInterface *device)
nm_device_interface_can_assume_connections (NMDeviceInterface *device)
{
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), FALSE);
return !!NM_DEVICE_INTERFACE_GET_INTERFACE (device)->connection_match_config;
if (NM_DEVICE_INTERFACE_GET_INTERFACE (device)->can_assume_connections)
return NM_DEVICE_INTERFACE_GET_INTERFACE (device)->can_assume_connections (device);
return FALSE;
}
void