From 6a75c9b8e8c92562bd16ac63718167926cd09317 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 14 Nov 2013 11:33:12 -0600 Subject: [PATCH] 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. --- src/nm-manager.c | 2 +- src/settings/nm-settings.c | 9 +++++++-- src/settings/nm-settings.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 039a6067e6..bf03084886 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index e6d98ff067..8c29a9111b 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -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); } } diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h index 1f97240d72..345eb04d44 100644 --- a/src/settings/nm-settings.h +++ b/src/settings/nm-settings.h @@ -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__ */