Possibility to auto-connect also dialup connections



And again hello.

Another patch for discussion. This time it is about having the possibility to use auto-connect for dial-up. I know, usually most people, do not want to auto-connect UMTS, but this patch just gives people the possibility to auto-connect and let NM decide, whether the UMTS connection is the best available connection.

BR,
Markus

Index: src/nm-gsm-device.c
===================================================================
--- src/nm-gsm-device.c	(revision 3644)
+++ src/nm-gsm-device.c	(working copy)
@@ -5,6 +5,7 @@
 #include "nm-gsm-device.h"
 #include "nm-device-interface.h"
 #include "nm-device-private.h"
+#include "nm-setting-connection.h"
 #include "nm-setting-gsm.h"
 #include "nm-utils.h"
 #include "nm-properties-changed-signal.h"
@@ -515,6 +550,31 @@
 	return priv->pending_id ? NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE;
 }

+static NMConnection *
+real_get_best_auto_connection (NMDevice *dev,
+                               GSList *connections,
+                               char **specific_object)
+{
+	GSList *iter;
+
+	for (iter = connections; iter; iter = g_slist_next (iter)) {
+		NMConnection *connection = NM_CONNECTION (iter->data);
+		NMSettingConnection *s_con;
+
+		s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+		g_assert (s_con);
+
+		if (!s_con->autoconnect)
+			continue;
+
+		if (strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME))
+			continue;
+
+		return connection;
+	}
+	return NULL;
+}
+
 static guint32
 real_get_generic_capabilities (NMDevice *dev)
 {
@@ -765,6 +825,8 @@
 	object_class->set_property = set_property;
 	object_class->finalize = finalize;

+	device_class->get_best_auto_connection = real_get_best_auto_connection;
+
 	device_class->get_generic_capabilities = real_get_generic_capabilities;
 	device_class->act_stage1_prepare = real_act_stage1_prepare;
 	device_class->connection_secrets_updated = real_connection_secrets_updated;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]