NetworkManager r3231 - in branches/NETWORKMANAGER_0_6_0_RELEASE: . src



Author: dcbw
Date: Thu Jan 10 23:21:17 2008
New Revision: 3231
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3231&view=rev

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

	Fix gnome.org #464215.  Requires the kernel patch titled
	"Introduce WEXT scan capabilities" but will handle the patch not being
	present, you'll just continue to have problems with hidden SSIDs when
	using mac80211-based drivers.

	* src/nm-device-802-11-wireless.c
		- (real_init): check whether or not the driver supports SSID scans
		- (supplicant_send_network_config): if the driver supports SSID scans,
			and the AP is hidden, use ap_scan=1 instead of ap_scan=2



Modified:
   branches/NETWORKMANAGER_0_6_0_RELEASE/ChangeLog
   branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-device-802-11-wireless.c

Modified: branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-device-802-11-wireless.c
==============================================================================
--- branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-device-802-11-wireless.c	(original)
+++ branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-device-802-11-wireless.c	Thu Jan 10 23:21:17 2008
@@ -86,6 +86,7 @@
 	/* Static options from driver */
 	guint8			we_version;
 	guint32			capabilities;
+	gboolean		has_scan_capa_ssid;
 };
 
 
@@ -383,6 +384,27 @@
 	self->priv->supplicant.pid = -1;
 }
 
+
+/* Until a new wireless-tools comes out that has the defs and the structure,
+ * need to copy them here.
+ */
+/* Scan capability flags - in (struct iw_range *)->scan_capa */
+#define NM_IW_SCAN_CAPA_NONE		0x00
+#define NM_IW_SCAN_CAPA_ESSID		0x01
+
+struct iw_range_with_scan_capa
+{
+	guint32		throughput;
+	guint32		min_nwid;
+	guint32		max_nwid;
+	guint16		old_num_channels;
+	guint8		old_num_frequency;
+
+	guint8		scan_capa;
+/* don't need the rest... */
+};
+
+
 static void
 real_init (NMDevice *dev)
 {
@@ -422,6 +444,7 @@
 
 		if (ioctl (nm_dev_sock_get_fd (sk), SIOCGIWRANGE, &wrq) >= 0)
 		{
+			struct iw_range_with_scan_capa *scan_capa_range;
 			int i;
 
 			self->priv->max_qual.qual = range.max_qual.qual;
@@ -440,6 +463,14 @@
 
 			self->priv->we_version = range.we_version_compiled;
 
+			/* Check for the ability to scan specific SSIDs.  Until the scan_capa
+			 * field gets added to wireless-tools, need to work around that by casting
+			 * to the custom structure.
+			 */
+			scan_capa_range = (struct iw_range_with_scan_capa *) &range;
+			if (scan_capa_range->scan_capa & NM_IW_SCAN_CAPA_ESSID)
+				self->priv->has_scan_capa_ssid = TRUE;
+
 			/* 802.11 wireless-specific capabilities */
 			self->priv->capabilities = get_wireless_capabilities (self, &range, wrq.u.data.length);
 		}
@@ -2858,12 +2889,16 @@
 				|| (caps & NM_802_11_CAP_PROTO_WPA2);
 
 	/* Use "AP_SCAN 2" if:
-	 * - The wireless network is non-broadcast or Ad-Hoc
+	 * - The wireless network is non-broadcast and the driver doesn't support
+	 *     scanning specific SSIDs
+	 * - The wireless network is Ad-Hoc
 	 * - The wireless driver does not support WPA (stupid drivers...)
 	 */
 	is_adhoc = (nm_ap_get_mode(ap) == IW_MODE_ADHOC);
-	if (!nm_ap_get_broadcast (ap) || is_adhoc || !supports_wpa)
+	if (is_adhoc || !supports_wpa)
 		ap_scan = "AP_SCAN 2";
+	else if (!nm_ap_get_broadcast (ap))
+		ap_scan = self->priv->has_scan_capa_ssid ? "AP_SCAN 1" : "AP_SCAN 2";
 
 	/* Tell wpa_supplicant that we'll do the scanning */
 	if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, ap_scan))



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