NetworkManager r3258 - in trunk: . src



Author: dcbw
Date: Sat Jan 19 16:15:38 2008
New Revision: 3258
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3258&view=rev

Log:
2008-01-19  Dan Williams  <dcbw redhat com>

	* src/NetworkManagerPolicy.c
		- (nm_policy_device_change_check): system connections override user
			connections; don't activate a user connection if there's a currently
			active system connection, and new, better system connections always
			interrupt user connections



Modified:
   trunk/ChangeLog
   trunk/src/NetworkManagerPolicy.c

Modified: trunk/src/NetworkManagerPolicy.c
==============================================================================
--- trunk/src/NetworkManagerPolicy.c	(original)
+++ trunk/src/NetworkManagerPolicy.c	Sat Jan 19 16:15:38 2008
@@ -315,6 +315,27 @@
 		gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
 		gboolean old_has_link = nm_device_has_active_link (old_dev);
 
+		/* If an old device is active or being activated, and its connection is
+		 * a system connection, and the best connection is a user connection,
+		 * don't switch.
+		 */
+		if (   old_connection
+		    && (nm_manager_get_connection_type (old_connection) == NM_CONNECTION_TYPE_SYSTEM)
+		    && (nm_manager_get_connection_type (connection) == NM_CONNECTION_TYPE_USER))
+			goto out;
+
+		if (   (nm_manager_get_connection_type (connection) == NM_CONNECTION_TYPE_SYSTEM)
+		    && (nm_manager_get_connection_type (old_connection) == NM_CONNECTION_TYPE_USER)) {
+			do_switch = TRUE;
+			nm_info ("SWITCH: found system connection '%s (%s)', overrides"
+			         " current connection '%s (%s)'.",
+			         connection ? get_connection_id (connection) : "(none)",
+			         nm_device_get_iface (new_dev),
+			         old_connection ? get_connection_id (old_connection) : "(none)",
+			         nm_device_get_iface (old_dev));
+			goto do_switch;
+		}
+
 		if (NM_IS_DEVICE_802_3_ETHERNET (old_dev)) {
 			/* Only switch if the old device was not user requested, and we are switching to
 			 * a new device.  Note that new_dev will never be wireless since automatic device picking
@@ -364,6 +385,7 @@
 		}
 	}
 
+do_switch:
 	if (do_switch) {
 		// FIXME: remove old_dev deactivation when multiple device support lands
 		if (old_dev)



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