diff options
author | Pavel Šimerda <psimerda@redhat.com> | 2013-08-22 19:17:03 +0200 |
---|---|---|
committer | Pavel Šimerda <psimerda@redhat.com> | 2013-08-29 19:58:46 +0200 |
commit | f6597edf86032603c204a7198cd01c6ff7131e14 (patch) | |
tree | 167194d2f283b57094c67183ed23da560034fe4b | |
parent | 89a4d964ea99d9236e24c0a7634b8af42cd296d6 (diff) | |
download | NetworkManager-f6597edf86032603c204a7198cd01c6ff7131e14.tar.gz |
core: handle foreign connections properly
For now just keep the NMDevice instance in UNMANAGED state when the
detected configuration doesn't match any known connection profile.
-rw-r--r-- | src/nm-manager.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 870f2d2e03..5131ccd944 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2117,6 +2117,7 @@ add_device (NMManager *self, NMDevice *device) static guint32 devcount = 0; const GSList *unmanaged_specs; NMConnection *connection; + gboolean existing; gboolean enabled = FALSE; RfKillType rtype; NMDeviceType devtype; @@ -2202,11 +2203,20 @@ add_device (NMManager *self, NMDevice *device) nm_log_info (LOGD_CORE, "(%s): exported as %s", iface, path); g_free (path); - connection = get_connection (self, device, NULL); + connection = get_connection (self, device, &existing); - /* Start the device if it's supposed to be managed */ + /* Set the device managed if the following conditions are met: + * + * 1) Device configuration matches an existing NMConnection or + * no configuration was detected for a non-software device. + * + * 2) NetworkManager is not sleeping. + * + * 3) Local configuration allows the device to be managed. + */ unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings); - if ( !manager_sleeping (self) + if ( (existing || (!nm_device_is_software (device) && !connection)) + && !manager_sleeping (self) && !nm_device_spec_match_list (device, unmanaged_specs)) { nm_device_set_manager_managed (device, TRUE, |