NetworkManager r3248 - in trunk: . src



Author: dcbw
Date: Fri Jan 18 17:04:46 2008
New Revision: 3248
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3248&view=rev

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

	* src/nm-device-802-3-ethernet.c
		- (find_best_connection): check MAC address too
		- (real_get_best_connection): let autoconnect=True connections activate
			for devices that don't have carrier detection

	* src/nm-device-802-11-wireless.c
		- (find_best_connection): check MAC address too



Modified:
   trunk/ChangeLog
   trunk/src/nm-device-802-11-wireless.c
   trunk/src/nm-device-802-3-ethernet.c

Modified: trunk/src/nm-device-802-11-wireless.c
==============================================================================
--- trunk/src/nm-device-802-11-wireless.c	(original)
+++ trunk/src/nm-device-802-11-wireless.c	Fri Jan 18 17:04:46 2008
@@ -845,19 +845,20 @@
 }
 
 typedef struct BestConnectionInfo {
-	NMDevice80211Wireless * self;
-	NMConnection * found;
-	NMAccessPoint * found_ap;
+	NMDevice80211Wireless *self;
+	NMConnection *found;
+	NMAccessPoint *found_ap;
 } BestConnectionInfo;
 
 static void
 find_best_connection (gpointer data, gpointer user_data)
 {
-	BestConnectionInfo * info = (BestConnectionInfo *) user_data;
+	BestConnectionInfo *info = (BestConnectionInfo *) user_data;
+	NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (info->self);
 	NMConnection *connection = NM_CONNECTION (data);
-	NMSettingConnection * s_con;
-	NMSettingWireless * s_wireless;
-	GSList * elt;
+	NMSettingConnection *s_con;
+	NMSettingWireless *s_wireless;
+	GSList *elt;
 
 	if (info->found)
 		return;
@@ -871,8 +872,12 @@
 		return;
 
 	s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
-	if (s_wireless == NULL)
-		return;
+	g_return_if_fail (s_wireless != NULL);
+
+	if (s_wireless->mac_address) {
+		if (memcmp (s_wireless->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
+			return;
+	}
 
 	for (elt = info->self->priv->ap_list; elt; elt = g_slist_next (elt)) {
 		NMAccessPoint *ap = NM_AP (elt->data);

Modified: trunk/src/nm-device-802-3-ethernet.c
==============================================================================
--- trunk/src/nm-device-802-3-ethernet.c	(original)
+++ trunk/src/nm-device-802-3-ethernet.c	Fri Jan 18 17:04:46 2008
@@ -342,17 +342,18 @@
 }
 
 typedef struct BestConnectionInfo {
-	NMDevice8023Ethernet * self;
-	NMConnection * found;
+	NMDevice8023Ethernet *self;
+	NMConnection *found;
 } BestConnectionInfo;
 
 static void
 find_best_connection (gpointer data, gpointer user_data)
 {
-	BestConnectionInfo * info = (BestConnectionInfo *) user_data;
+	BestConnectionInfo *info = (BestConnectionInfo *) user_data;
+	NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (info->self);
 	NMConnection *connection = NM_CONNECTION (data);
-	NMSettingConnection * s_con;
-	NMSettingWired * s_wired;
+	NMSettingConnection *s_con;
+	NMSettingWired *s_wired;
 
 	if (info->found)
 		return;
@@ -366,8 +367,12 @@
 		return;
 
 	s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
-	if (s_wired == NULL)
-		return;
+	g_return_if_fail (s_wired != NULL);
+
+	if (s_wired->mac_address) {
+		if (memcmp (s_wired->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
+			return;
+	}
 
 	info->found = connection;
 }
@@ -379,17 +384,6 @@
 {
 	NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
 	BestConnectionInfo find_info;
-	guint32 caps;
-
-	caps = nm_device_get_capabilities (dev);
-
-	/* FIXME: for now, non-carrier-detect devices don't have a best connection,
-	 * the user needs to pick one.  In the near-future, we want to instead
-	 * honor the first 'autoconnect':True connection we find that applies
-	 * to this device.
-	 */
-	if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
-		return NULL;
 
 	memset (&find_info, 0, sizeof (BestConnectionInfo));
 	find_info.self = self;



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