core: allow default wired connections to stay up when quitting

Previously, the default wired connection was removed on quit when the
device was cleaned up.  This is inconsistent with other connections.
Leave the default wired connection up when quitting to fix this
inconsistency.

This allows default wired connections to be assumed when NM starts.
This commit is contained in:
Dan Williams 2013-11-14 11:33:12 -06:00
parent 7a256b9a05
commit 6a75c9b8e8
3 changed files with 9 additions and 4 deletions

View file

@ -814,7 +814,7 @@ remove_device (NMManager *manager, NMDevice *device, gboolean quitting)
g_signal_handlers_disconnect_matched (device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, manager);
nm_settings_device_removed (priv->settings, device);
nm_settings_device_removed (priv->settings, device, quitting);
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
g_object_unref (device);

View file

@ -1591,14 +1591,19 @@ nm_settings_device_added (NMSettings *self, NMDevice *device)
}
void
nm_settings_device_removed (NMSettings *self, NMDevice *device)
nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quitting)
{
NMSettingsConnection *connection;
connection = g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG);
if (connection) {
default_wired_clear_tag (self, device, connection, FALSE);
nm_settings_connection_delete (connection, NULL, NULL);
/* Don't delete the default wired connection on shutdown, so that it
* remains up and can be assumed if NM starts again.
*/
if (quitting == FALSE)
nm_settings_connection_delete (connection, NULL, NULL);
}
}

View file

@ -120,6 +120,6 @@ char *nm_settings_get_hostname (NMSettings *self);
void nm_settings_device_added (NMSettings *self, NMDevice *device);
void nm_settings_device_removed (NMSettings *self, NMDevice *device);
void nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quitting);
#endif /* __NM_SETTINGS_H__ */