summaryrefslogtreecommitdiff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c76
1 files changed, 4 insertions, 72 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index d3fa52436e..1edcda1622 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -249,9 +249,6 @@ typedef struct {
guint timestamp_update_id;
- /* Track auto-activation for software devices */
- GHashTable *noauto_sw_devices;
-
gboolean startup;
gboolean disposed;
} NMManagerPrivate;
@@ -1214,21 +1211,11 @@ system_create_virtual_devices (NMManager *self)
connections = nm_settings_get_connections (priv->settings);
for (iter = connections; iter; iter = g_slist_next (iter)) {
NMConnection *connection = iter->data;
- NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
-
- g_assert (s_con);
- if (connection_needs_virtual_device (connection)) {
- char *iface = get_virtual_iface_name (self, connection, NULL);
- /* We only create a virtual interface if the connection can autoconnect
- * and the interface was not manually disconnected before.
- */
- if ( nm_setting_connection_get_autoconnect (s_con)
- && iface
- && nm_manager_can_device_auto_connect (self, iface))
- system_create_virtual_device (self, connection);
- g_free (iface);
- }
+ /* We only create a virtual interface if the connection can autoconnect */
+ if ( connection_needs_virtual_device (connection)
+ && nm_settings_connection_can_autoconnect (NM_SETTINGS_CONNECTION (connection)))
+ system_create_virtual_device (self, connection);
}
g_slist_free (connections);
}
@@ -2720,31 +2707,8 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
device = nm_active_connection_get_device (active);
if (!device) {
- char *iface;
-
g_assert (connection_needs_virtual_device (connection));
- iface = get_virtual_iface_name (self, connection, NULL);
- g_assert (iface);
-
- /* Create the software device. Only exception is when:
- * - this is an auto-activation *and* the device denies auto-activation
- * at this time (the device was manually disconnected/deleted before)
- */
- if (!nm_manager_can_device_auto_connect (self, iface)) {
- if (nm_active_connection_get_user_requested (active)) {
- /* Manual activation - allow device auto-activation again */
- nm_manager_prevent_device_auto_connect (self, iface, FALSE);
- } else {
- g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED,
- "Automatic activation of '%s' not allowed for connection '%s'",
- iface, nm_connection_get_id (connection));
- g_free (iface);
- return FALSE;
- }
- }
- g_free (iface);
-
device = system_create_virtual_device (self, connection);
if (!device) {
g_set_error_literal (error,
@@ -3617,33 +3581,6 @@ done:
g_clear_error (&error);
}
-/*
- * Track (software) devices that cannot auto activate.
- * It is needed especially for software devices, that can be removed and added
- * again. So we can't simply use a flag inside the device.
- */
-void
-nm_manager_prevent_device_auto_connect (NMManager *manager, const char *ifname, gboolean prevent)
-{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
-
- if (prevent)
- g_hash_table_add (priv->noauto_sw_devices, g_strdup (ifname));
- else
- g_hash_table_remove (priv->noauto_sw_devices, ifname);
-}
-
-gboolean
-nm_manager_can_device_auto_connect (NMManager *manager, const char *ifname)
-{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
-
- if (!ifname)
- return FALSE;
-
- return !g_hash_table_contains (priv->noauto_sw_devices, ifname);
-}
-
static void
do_sleep_wake (NMManager *self)
{
@@ -4719,8 +4656,6 @@ dispose (GObject *object)
g_object_unref (priv->fw_monitor);
}
- g_hash_table_unref (priv->noauto_sw_devices);
-
g_slist_free (priv->factories);
if (priv->timestamp_update_id) {
@@ -5085,9 +5020,6 @@ nm_manager_init (NMManager *manager)
KERNEL_FIRMWARE_DIR);
}
- /* Hash table storing software devices that should not auto activate */
- priv->noauto_sw_devices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
load_device_factories (manager);
/* Update timestamps in active connections */