[pkg-wpa-devel] r963 - in /wpasupplicant/trunk: debian/ src/drivers/ src/l2_packet/ src/rsn_supp/ wpa_supplicant/ wpa_supplicant/doc/docbook/ wpa_supplicant/wpa_gui-qt4/ wpa_supplicant/wpa_gui/

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Fri Dec 28 01:54:44 UTC 2007


Author: kelmo-guest
Date: Fri Dec 28 01:54:44 2007
New Revision: 963

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=963
Log:
import new git snapshot f320a8b

Added:
    wpasupplicant/trunk/src/drivers/scan_helpers.c
      - copied unchanged from r962, wpasupplicant/branches/upstream/current/src/drivers/scan_helpers.c
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.sgml
      - copied unchanged from r962, wpasupplicant/branches/upstream/current/wpa_supplicant/doc/docbook/wpa_priv.sgml
Modified:
    wpasupplicant/trunk/debian/changelog
    wpasupplicant/trunk/src/drivers/driver.h
    wpasupplicant/trunk/src/drivers/driver_atmel.c
    wpasupplicant/trunk/src/drivers/driver_hostap.c
    wpasupplicant/trunk/src/drivers/driver_ipw.c
    wpasupplicant/trunk/src/drivers/driver_madwifi.c
    wpasupplicant/trunk/src/drivers/driver_ndiswrapper.c
    wpasupplicant/trunk/src/drivers/driver_prism54.c
    wpasupplicant/trunk/src/drivers/driver_privsep.c
    wpasupplicant/trunk/src/drivers/driver_test.c
    wpasupplicant/trunk/src/drivers/driver_wext.c
    wpasupplicant/trunk/src/drivers/driver_wext.h
    wpasupplicant/trunk/src/l2_packet/l2_packet_privsep.c
    wpasupplicant/trunk/src/rsn_supp/preauth.c
    wpasupplicant/trunk/src/rsn_supp/preauth.h
    wpasupplicant/trunk/wpa_supplicant/ChangeLog
    wpasupplicant/trunk/wpa_supplicant/Makefile
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h
    wpasupplicant/trunk/wpa_supplicant/dbus-wpa_supplicant.conf
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/Makefile
    wpasupplicant/trunk/wpa_supplicant/events.c
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h
    wpasupplicant/trunk/wpa_supplicant/wpa_priv.c
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h
    wpasupplicant/trunk/wpa_supplicant/wpas_glue.c

Modified: wpasupplicant/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/changelog?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Fri Dec 28 01:54:44 2007
@@ -1,4 +1,4 @@
-wpasupplicant (0.6.2~git20071227.00d591e-1) UNRELEASED; urgency=low
+wpasupplicant (0.6.2~git20071227.f320a8b-1) UNRELEASED; urgency=low
 
   * New upstream git snapshot.
   * Allow "wpa-key-mgmt NONE" to form a network block via the wpa_cli calls in
@@ -56,7 +56,7 @@
     scripts. wpa-debug-level n (for n in 1 2 3).
   * Enhance README.modes with new supplicant debugging methods.
 
- -- Kel Modderman <kel at otaku42.de>  Fri, 28 Dec 2007 00:23:14 +1000
+ -- Kel Modderman <kel at otaku42.de>  Fri, 28 Dec 2007 11:52:42 +1000
 
 wpasupplicant (0.6.1~git20071119-1) unstable; urgency=low
 

Modified: wpasupplicant/trunk/src/drivers/driver.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver.h (original)
+++ wpasupplicant/trunk/src/drivers/driver.h Fri Dec 28 01:54:44 2007
@@ -32,7 +32,7 @@
 
 #define SSID_MAX_WPA_IE_LEN 40
 /**
- * struct wpa_scan_result - Scan results
+ * struct wpa_scan_result - Scan results (old structure)
  * @bssid: BSSID
  * @ssid: SSID
  * @ssid_len: length of the ssid
@@ -54,6 +54,12 @@
  * This structure is used as a generic format for scan results from the
  * driver. Each driver interface implementation is responsible for converting
  * the driver or OS specific scan results into this format.
+ *
+ * This structure is the old data structure used for scan results. It is
+ * obsoleted by the new struct wpa_scan_res structure and the old version is
+ * only included for backwards compatibility with existing driver wrapper
+ * implementations. New implementations are encouraged to implement for struct
+ * wpa_scan_res. The old structure will be removed at some point.
  */
 struct wpa_scan_result {
 	u8 bssid[ETH_ALEN];
@@ -74,6 +80,51 @@
 	u64 tsf;
 };
 
+
+/**
+ * struct wpa_scan_res - Scan result for an BSS/IBSS
+ * @bssid: BSSID
+ * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
+ * @beacon_int: beacon interval in TUs (host byte order)
+ * @caps: capability information field in host byte order
+ * @qual: signal quality
+ * @noise: noise level
+ * @level: signal level
+ * @tsf: Timestamp
+ * @ie_len: length of the following IE field in octets
+ *
+ * This structure is used as a generic format for scan results from the
+ * driver. Each driver interface implementation is responsible for converting
+ * the driver or OS specific scan results into this format.
+ *
+ * If the driver does not support reporting all IEs, the IE data structure is
+ * constructed of the IEs that are available. This field will also need to
+ * include SSID in IE format. All drivers are encouraged to be extended to
+ * report all IEs to make it easier to support future additions.
+ */
+struct wpa_scan_res {
+	u8 bssid[ETH_ALEN];
+	int freq;
+	u16 beacon_int;
+	u16 caps;
+	int qual;
+	int noise;
+	int level;
+	u64 tsf;
+	size_t ie_len;
+	/* followed by ie_len octets of IEs */
+};
+
+/**
+ * struct wpa_scan_results - Scan results
+ * @res: Array of pointers to allocated variable length scan result entries
+ * @num: Number of entries in the scan result array
+ */
+struct wpa_scan_results {
+	struct wpa_scan_res **res;
+	size_t num;
+};
+
 /**
  * struct wpa_driver_associate_params - Association parameters
  * Data for struct wpa_driver_ops::associate().
@@ -371,8 +422,7 @@
 	 * set_key - Configure encryption key
 	 * @priv: private driver interface data
 	 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
-	 *	%WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_DHV,
-	 *	%WPA_ALG_PMK);
+	 *	%WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
 	 *	%WPA_ALG_NONE clears the key.
 	 * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
 	 *	broadcast/default keys
@@ -389,7 +439,7 @@
 	 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
 	 *	8-byte Rx Mic Key
 	 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
-	 *	TKIP: 32, CCMP: 16, IGTK: 16, DHV: 16)
+	 *	TKIP: 32, CCMP: 16, IGTK: 16)
 	 *
 	 * Returns: 0 on success, -1 on failure
 	 *
@@ -503,7 +553,7 @@
 	int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
 
 	/**
-	 * get_scan_results - Fetch the latest scan results
+	 * get_scan_results - Fetch the latest scan results (old version)
 	 * @priv: private driver interface data
 	 * @results: pointer to buffer for scan results
 	 * @max_size: maximum number of entries (buffer size)
@@ -514,6 +564,9 @@
 	 * If scan results include more than max_size BSSes, max_size will be
 	 * returned and the remaining entries will not be included in the
 	 * buffer.
+	 *
+	 * This function is depracated. New driver wrapper implementations
+	 * should implement support for get_scan_results2().
 	 */
 	int (*get_scan_results)(void *priv,
 				struct wpa_scan_result *results,
@@ -858,6 +911,15 @@
 	 */
 	int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
 			      const u8 *ies, size_t ies_len);
+
+	/**
+	 * get_scan_results2 - Fetch the latest scan results
+	 * @priv: private driver interface data
+	 *
+	 * Returns: Allocated buffer of scan results (caller is responsible for
+	 * freeing the data structure) on success, NULL on failure
+	 */
+	 struct wpa_scan_results * (*get_scan_results2)(void *priv);
 };
 
 /**
@@ -1140,4 +1202,10 @@
 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
 			     const u8 *buf, size_t len);
 
+u8 * wpa_scan_get_ie(struct wpa_scan_res *res, u8 ie);
+#define WPA_IE_VENDOR_TYPE 0x0050f201
+u8 * wpa_scan_get_vendor_ie(struct wpa_scan_res *res, u32 vendor_type);
+int wpa_scan_get_max_rate(struct wpa_scan_res *res);
+void wpa_scan_results_free(struct wpa_scan_results *res);
+
 #endif /* DRIVER_H */

Modified: wpasupplicant/trunk/src/drivers/driver_atmel.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_atmel.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_atmel.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_atmel.c Fri Dec 28 01:54:44 2007
@@ -437,12 +437,10 @@
 }
 
 
-static int wpa_driver_atmel_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_atmel_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results * wpa_driver_atmel_get_scan_results(void *priv)
+{
+	struct wpa_driver_atmel_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -500,7 +498,7 @@
 	.set_countermeasures = wpa_driver_atmel_set_countermeasures,
 	.set_drop_unencrypted = wpa_driver_atmel_set_drop_unencrypted,
 	.scan = wpa_driver_atmel_scan,
-	.get_scan_results = wpa_driver_atmel_get_scan_results,
+	.get_scan_results2 = wpa_driver_atmel_get_scan_results,
 	.deauthenticate = wpa_driver_atmel_deauthenticate,
 	.disassociate = wpa_driver_atmel_disassociate,
 	.associate = wpa_driver_atmel_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_hostap.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_hostap.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_hostap.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_hostap.c Fri Dec 28 01:54:44 2007
@@ -431,12 +431,10 @@
 }
 
 
-static int wpa_driver_hostap_get_scan_results(void *priv,
-					      struct wpa_scan_result *results,
-					      size_t max_size)
-{
-	struct wpa_driver_hostap_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results * wpa_driver_hostap_get_scan_results(void *priv)
+{
+	struct wpa_driver_hostap_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -504,7 +502,7 @@
 	.set_countermeasures = wpa_driver_hostap_set_countermeasures,
 	.set_drop_unencrypted = wpa_driver_hostap_set_drop_unencrypted,
 	.scan = wpa_driver_hostap_scan,
-	.get_scan_results = wpa_driver_hostap_get_scan_results,
+	.get_scan_results2 = wpa_driver_hostap_get_scan_results,
 	.deauthenticate = wpa_driver_hostap_deauthenticate,
 	.disassociate = wpa_driver_hostap_disassociate,
 	.associate = wpa_driver_hostap_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_ipw.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_ipw.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_ipw.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_ipw.c Fri Dec 28 01:54:44 2007
@@ -382,12 +382,10 @@
 }
 
 
-static int wpa_driver_ipw_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_ipw_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results * wpa_driver_ipw_get_scan_results(void *priv)
+{
+	struct wpa_driver_ipw_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -454,7 +452,7 @@
 	.set_countermeasures = wpa_driver_ipw_set_countermeasures,
 	.set_drop_unencrypted = wpa_driver_ipw_set_drop_unencrypted,
 	.scan = wpa_driver_ipw_scan,
-	.get_scan_results = wpa_driver_ipw_get_scan_results,
+	.get_scan_results2 = wpa_driver_ipw_get_scan_results,
 	.deauthenticate = wpa_driver_ipw_deauthenticate,
 	.disassociate = wpa_driver_ipw_disassociate,
 	.associate = wpa_driver_ipw_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_madwifi.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_madwifi.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_madwifi.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_madwifi.c Fri Dec 28 01:54:44 2007
@@ -461,12 +461,11 @@
 }
 
 
-static int wpa_driver_madwifi_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_madwifi_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results *
+wpa_driver_madwifi_get_scan_results(void *priv)
+{
+	struct wpa_driver_madwifi_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -557,7 +556,7 @@
 	.set_countermeasures	= wpa_driver_madwifi_set_countermeasures,
 	.set_drop_unencrypted	= wpa_driver_madwifi_set_drop_unencrypted,
 	.scan			= wpa_driver_madwifi_scan,
-	.get_scan_results	= wpa_driver_madwifi_get_scan_results,
+	.get_scan_results2	= wpa_driver_madwifi_get_scan_results,
 	.deauthenticate		= wpa_driver_madwifi_deauthenticate,
 	.disassociate		= wpa_driver_madwifi_disassociate,
 	.associate		= wpa_driver_madwifi_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_ndiswrapper.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_ndiswrapper.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_ndiswrapper.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_ndiswrapper.c Fri Dec 28 01:54:44 2007
@@ -277,12 +277,10 @@
 }
 
 
-static int wpa_ndiswrapper_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_ndiswrapper_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results * wpa_ndiswrapper_get_scan_results(void *priv)
+{
+	struct wpa_driver_ndiswrapper_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -360,7 +358,7 @@
 	.get_bssid = wpa_ndiswrapper_get_bssid,
 	.get_ssid = wpa_ndiswrapper_get_ssid,
 	.scan = wpa_ndiswrapper_scan,
-	.get_scan_results = wpa_ndiswrapper_get_scan_results,
+	.get_scan_results2 = wpa_ndiswrapper_get_scan_results,
 	.init = wpa_ndiswrapper_init,
 	.deinit = wpa_ndiswrapper_deinit,
 	.get_capa = wpa_ndiswrapper_get_capa,

Modified: wpasupplicant/trunk/src/drivers/driver_prism54.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_prism54.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_prism54.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_prism54.c Fri Dec 28 01:54:44 2007
@@ -311,12 +311,11 @@
 }
 
 
-static int wpa_driver_prism54_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_prism54_data *drv = priv;
-	return wpa_driver_wext_get_scan_results(drv->wext, results, max_size);
+static struct wpa_scan_results *
+wpa_driver_prism54_get_scan_results(void *priv)
+{
+	struct wpa_driver_prism54_data *drv = priv;
+	return wpa_driver_wext_get_scan_results(drv->wext);
 }
 
 
@@ -372,7 +371,7 @@
 	.set_countermeasures = wpa_driver_prism54_set_countermeasures,
 	.set_drop_unencrypted = wpa_driver_prism54_set_drop_unencrypted,
 	.scan = wpa_driver_prism54_scan,
-	.get_scan_results = wpa_driver_prism54_get_scan_results,
+	.get_scan_results2 = wpa_driver_prism54_get_scan_results,
 	.deauthenticate = wpa_driver_prism54_deauthenticate,
 	.disassociate = wpa_driver_prism54_disassociate,
 	.associate = wpa_driver_prism54_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_privsep.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_privsep.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_privsep.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_privsep.c Fri Dec 28 01:54:44 2007
@@ -120,30 +120,79 @@
 }
 
 
-static int wpa_driver_privsep_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_privsep_data *drv = priv;
-	int res;
-	int buf_size = max_size;
-	size_t reply_len = max_size * sizeof(*results);
-
+static struct wpa_scan_results *
+wpa_driver_privsep_get_scan_results2(void *priv)
+{
+	struct wpa_driver_privsep_data *drv = priv;
+	int res, num;
+	u8 *buf, *pos, *end;
+	size_t reply_len = 60000;
+	struct wpa_scan_results *results;
+	struct wpa_scan_res *r;
+
+	buf = os_malloc(reply_len);
+	if (buf == NULL)
+		return NULL;
 	res = wpa_priv_cmd(drv, PRIVSEP_CMD_GET_SCAN_RESULTS,
-			   &buf_size, sizeof(buf_size),
-			   results, &reply_len);
-	if (res < 0)
-		return res;
+			   NULL, 0, buf, &reply_len);
+	if (res < 0) {
+		os_free(buf);
+		return NULL;
+	}
 
 	wpa_printf(MSG_DEBUG, "privsep: Received %lu bytes of scan results",
 		   (unsigned long) reply_len);
-	if (reply_len % sizeof(*results)) {
+	if (reply_len < sizeof(int)) {
 		wpa_printf(MSG_DEBUG, "privsep: Invalid scan result len %lu",
 			   (unsigned long) reply_len);
-		return -1;
-	}
-
-	return reply_len / sizeof(*results);
+		os_free(buf);
+		return NULL;
+	}
+
+	pos = buf;
+	end = buf + reply_len;
+	os_memcpy(&num, pos, sizeof(int));
+	if (num < 0 || num > 1000) {
+		os_free(buf);
+		return NULL;
+	}
+	pos += sizeof(int);
+
+	results = os_zalloc(sizeof(*results));
+	if (results == NULL) {
+		os_free(buf);
+		return NULL;
+	}
+
+	results->res = os_zalloc(num * sizeof(struct wpa_scan_res *));
+	if (results->res == NULL) {
+		os_free(results);
+		os_free(buf);
+		return NULL;
+	}
+
+	while (results->num < (size_t) num && pos + sizeof(int) < end) {
+		int len;
+		os_memcpy(&len, pos, sizeof(int));
+		pos += sizeof(int);
+		if (len < 0 || len > 10000 || pos + len > end)
+			break;
+
+		r = os_malloc(len);
+		if (r == NULL)
+			break;
+		os_memcpy(r, pos, len);
+		pos += len;
+		if (sizeof(*r) + r->ie_len > (size_t) len) {
+			os_free(r);
+			break;
+		}
+
+		results->res[results->num++] = r;
+	}
+
+	os_free(buf);
+	return results;
 }
 
 
@@ -690,7 +739,7 @@
 	NULL /* set_countermeasures */,
 	NULL /* set_drop_unencrypted */,
 	wpa_driver_privsep_scan,
-	wpa_driver_privsep_get_scan_results,
+	NULL /*  get_scan_results */,
 	wpa_driver_privsep_deauthenticate,
 	wpa_driver_privsep_disassociate,
 	wpa_driver_privsep_associate,
@@ -713,7 +762,8 @@
 	NULL /* mlme_add_sta */,
 	NULL /* mlme_remove_sta */,
 	NULL /* update_ft_ies */,
-	NULL /* send_ft_action */
+	NULL /* send_ft_action */,
+	wpa_driver_privsep_get_scan_results2
 };
 
 

Modified: wpasupplicant/trunk/src/drivers/driver_test.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_test.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_test.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_test.c Fri Dec 28 01:54:44 2007
@@ -38,7 +38,7 @@
 	u8 ssid[32];
 	size_t ssid_len;
 #define MAX_SCAN_RESULTS 30
-	struct wpa_scan_result scanres[MAX_SCAN_RESULTS];
+	struct wpa_scan_res *scanres[MAX_SCAN_RESULTS];
 	size_t num_scanres;
 	int use_associnfo;
 	u8 assoc_wpa_ie[80];
@@ -134,17 +134,35 @@
 }
 
 
-static int wpa_driver_test_get_scan_results(void *priv,
-					    struct wpa_scan_result *results,
-					    size_t max_size)
-{
-	struct wpa_driver_test_data *drv = priv;
-	size_t num = drv->num_scanres;
-	if (num > max_size)
-		num = max_size;
-	os_memcpy(results, &drv->scanres,
-		  num * sizeof(struct wpa_scan_result));
-	return num;
+static struct wpa_scan_results * wpa_driver_test_get_scan_results2(void *priv)
+{
+	struct wpa_driver_test_data *drv = priv;
+	struct wpa_scan_results *res;
+	size_t i;
+
+	res = os_zalloc(sizeof(*res));
+	if (res == NULL)
+		return NULL;
+
+	res->res = os_zalloc(drv->num_scanres * sizeof(struct wpa_scan_res *));
+	if (res->res == NULL) {
+		os_free(res);
+		return NULL;
+	}
+
+	for (i = 0; i < drv->num_scanres; i++) {
+		struct wpa_scan_res *r;
+		if (drv->scanres[i] == NULL)
+			continue;
+		r = os_malloc(sizeof(*r) + drv->scanres[i]->ie_len);
+		if (r == NULL)
+			break;
+		os_memcpy(r, drv->scanres[i],
+			  sizeof(*r) + drv->scanres[i]->ie_len);
+		res->res[res->num++] = r;
+	}
+
+	return res;
 }
 
 
@@ -301,10 +319,11 @@
 				     socklen_t fromlen,
 				     const char *data)
 {
-	struct wpa_scan_result *res;
+	struct wpa_scan_res *res;
 	const char *pos, *pos2;
 	size_t len;
-	u8 ie[200], *ipos, *end;
+	u8 *ie_pos, *ie_start, *ie_end;
+#define MAX_IE_LEN 1000
 
 	wpa_printf(MSG_DEBUG, "test_driver: SCANRESP %s", data);
 	if (drv->num_scanres >= MAX_SCAN_RESULTS) {
@@ -314,11 +333,16 @@
 	}
 
 	/* SCANRESP BSSID SSID IEs */
-	res = &drv->scanres[drv->num_scanres];
-
-	os_memset(res, 0, sizeof(*res));
+
+	res = os_zalloc(sizeof(*res) + MAX_IE_LEN);
+	if (res == NULL)
+		return;
+	ie_start = ie_pos = (u8 *) (res + 1);
+	ie_end = ie_pos + MAX_IE_LEN;
+
 	if (hwaddr_aton(data, res->bssid)) {
 		wpa_printf(MSG_DEBUG, "test_driver: invalid BSSID in scanres");
+		os_free(res);
 		return;
 	}
 
@@ -329,16 +353,24 @@
 	if (pos2 == NULL) {
 		wpa_printf(MSG_DEBUG, "test_driver: invalid SSID termination "
 			   "in scanres");
+		os_free(res);
 		return;
 	}
 	len = (pos2 - pos) / 2;
-	if (len > sizeof(res->ssid))
-		len = sizeof(res->ssid);
-	if (hexstr2bin(pos, res->ssid, len) < 0) {
+	if (len > 32)
+		len = 32;
+	/*
+	 * Generate SSID IE from the SSID field since this IE is not included
+	 * in the main IE field.
+	 */
+	*ie_pos++ = WLAN_EID_SSID;
+	*ie_pos++ = len;
+	if (hexstr2bin(pos, ie_pos, len) < 0) {
 		wpa_printf(MSG_DEBUG, "test_driver: invalid SSID in scanres");
+		os_free(res);
 		return;
 	}
-	res->ssid_len = len;
+	ie_pos += len;
 
 	pos = pos2 + 1;
 	pos2 = os_strchr(pos, ' ');
@@ -346,29 +378,15 @@
 		len = os_strlen(pos) / 2;
 	else
 		len = (pos2 - pos) / 2;
-	if (len > sizeof(ie))
-		len = sizeof(ie);
-	if (hexstr2bin(pos, ie, len) < 0) {
+	if ((int) len > ie_end - ie_pos)
+		len = ie_end - ie_pos;
+	if (hexstr2bin(pos, ie_pos, len) < 0) {
 		wpa_printf(MSG_DEBUG, "test_driver: invalid IEs in scanres");
+		os_free(res);
 		return;
 	}
-
-	ipos = ie;
-	end = ipos + len;
-	while (ipos + 1 < end && ipos + 2 + ipos[1] <= end) {
-		len = 2 + ipos[1];
-		if (len > SSID_MAX_WPA_IE_LEN)
-			len = SSID_MAX_WPA_IE_LEN;
-		if (ipos[0] == WLAN_EID_RSN) {
-			os_memcpy(res->rsn_ie, ipos, len);
-			res->rsn_ie_len = len;
-		} else if (ipos[0] == WLAN_EID_VENDOR_SPECIFIC) {
-			os_memcpy(res->wpa_ie, ipos, len);
-			res->wpa_ie_len = len;
-		}
-
-		ipos += 2 + ipos[1];
-	}
+	ie_pos += len;
+	res->ie_len = ie_pos - ie_start;
 
 	if (pos2) {
 		pos = pos2 + 1;
@@ -378,7 +396,8 @@
 			res->caps |= IEEE80211_CAP_PRIVACY;
 	}
 
-	drv->num_scanres++;
+	os_free(drv->scanres[drv->num_scanres]);
+	drv->scanres[drv->num_scanres++] = res;
 }
 
 
@@ -537,10 +556,13 @@
 static void wpa_driver_test_deinit(void *priv)
 {
 	struct wpa_driver_test_data *drv = priv;
+	int i;
 	wpa_driver_test_close_test_socket(drv);
 	eloop_cancel_timeout(wpa_driver_test_scan_timeout, drv, drv->ctx);
 	eloop_cancel_timeout(wpa_driver_test_poll, drv, NULL);
 	os_free(drv->test_dir);
+	for (i = 0; i < MAX_SCAN_RESULTS; i++)
+		os_free(drv->scanres[i]);
 	os_free(drv);
 }
 
@@ -926,7 +948,7 @@
 	NULL /* set_countermeasures */,
 	NULL /* set_drop_unencrypted */,
 	wpa_driver_test_scan,
-	wpa_driver_test_get_scan_results,
+	NULL /* get_scan_results */,
 	wpa_driver_test_deauthenticate,
 	wpa_driver_test_disassociate,
 	wpa_driver_test_associate,
@@ -959,5 +981,6 @@
 	NULL /* mlme_remove_sta */,
 #endif /* CONFIG_CLIENT_MLME */
 	NULL /* update_ft_ies */,
-	NULL /* send_ft_action */
+	NULL /* send_ft_action */,
+	wpa_driver_test_get_scan_results2
 };

Modified: wpasupplicant/trunk/src/drivers/driver_wext.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_wext.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_wext.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_wext.c Fri Dec 28 01:54:44 2007
@@ -1132,15 +1132,21 @@
  * better. */
 static int wpa_scan_result_compar(const void *a, const void *b)
 {
-	const struct wpa_scan_result *wa = a;
-	const struct wpa_scan_result *wb = b;
+	struct wpa_scan_res **_wa = (void *) a;
+	struct wpa_scan_res **_wb = (void *) b;
+	struct wpa_scan_res *wa = *_wa;
+	struct wpa_scan_res *wb = *_wb;
+	int wpa_a, wpa_b, maxrate_a, maxrate_b;
 
 	/* WPA/WPA2 support preferred */
-	if ((wb->wpa_ie_len || wb->rsn_ie_len) &&
-	    !(wa->wpa_ie_len || wa->rsn_ie_len))
+	wpa_a = wpa_scan_get_vendor_ie(wa, WPA_IE_VENDOR_TYPE) != NULL ||
+		wpa_scan_get_ie(wa, WLAN_EID_RSN) != NULL;
+	wpa_b = wpa_scan_get_vendor_ie(wb, WPA_IE_VENDOR_TYPE) != NULL ||
+		wpa_scan_get_ie(wb, WLAN_EID_RSN) != NULL;
+
+	if (wpa_b && !wpa_a)
 		return 1;
-	if (!(wb->wpa_ie_len || wb->rsn_ie_len) &&
-	    (wa->wpa_ie_len || wa->rsn_ie_len))
+	if (!wpa_b && wpa_a)
 		return -1;
 
 	/* privacy support preferred */
@@ -1152,8 +1158,10 @@
 		return -1;
 
 	/* best/max rate preferred if signal level close enough XXX */
-	if (wa->maxrate != wb->maxrate && abs(wb->level - wa->level) < 5)
-		return wb->maxrate - wa->maxrate;
+	maxrate_a = wpa_scan_get_max_rate(wa);
+	maxrate_b = wpa_scan_get_max_rate(wb);
+	if (maxrate_a != maxrate_b && abs(wb->level - wa->level) < 5)
+		return maxrate_b - maxrate_a;
 
 	/* use freq for channel preference */
 
@@ -1210,18 +1218,32 @@
 }
 
 
+/*
+ * Data structure for collecting WEXT scan results. This is needed to allow
+ * the various methods of reporting IEs to be combined into a single IE buffer.
+ */
+struct wext_scan_data {
+	struct wpa_scan_res res;
+	u8 *ie;
+	size_t ie_len;
+	u8 ssid[32];
+	size_t ssid_len;
+	int maxrate;
+};
+
+
 static void wext_get_scan_mode(struct iw_event *iwe,
-			       struct wpa_scan_result *res)
+			       struct wext_scan_data *res)
 {
 	if (iwe->u.mode == IW_MODE_ADHOC)
-		res->caps |= IEEE80211_CAP_IBSS;
+		res->res.caps |= IEEE80211_CAP_IBSS;
 	else if (iwe->u.mode == IW_MODE_MASTER || iwe->u.mode == IW_MODE_INFRA)
-		res->caps |= IEEE80211_CAP_ESS;
+		res->res.caps |= IEEE80211_CAP_ESS;
 }
 
 
 static void wext_get_scan_ssid(struct iw_event *iwe,
-			       struct wpa_scan_result *res, char *custom,
+			       struct wext_scan_data *res, char *custom,
 			       char *end)
 {
 	int ssid_len = iwe->u.essid.length;
@@ -1237,7 +1259,7 @@
 
 
 static void wext_get_scan_freq(struct iw_event *iwe,
-			       struct wpa_scan_result *res)
+			       struct wext_scan_data *res)
 {
 	int divi = 1000000, i;
 
@@ -1248,10 +1270,10 @@
 		 * IEEE 802.11b/g.
 		 */
 		if (iwe->u.freq.m >= 1 && iwe->u.freq.m <= 13) {
-			res->freq = 2407 + 5 * iwe->u.freq.m;
+			res->res.freq = 2407 + 5 * iwe->u.freq.m;
 			return;
 		} else if (iwe->u.freq.m == 14) {
-			res->freq = 2484;
+			res->res.freq = 2484;
 			return;
 		}
 	}
@@ -1259,35 +1281,36 @@
 	if (iwe->u.freq.e > 6) {
 		wpa_printf(MSG_DEBUG, "Invalid freq in scan results (BSSID="
 			   MACSTR " m=%d e=%d)",
-			   MAC2STR(res->bssid), iwe->u.freq.m, iwe->u.freq.e);
+			   MAC2STR(res->res.bssid), iwe->u.freq.m,
+			   iwe->u.freq.e);
 		return;
 	}
 
 	for (i = 0; i < iwe->u.freq.e; i++)
 		divi /= 10;
-	res->freq = iwe->u.freq.m / divi;
+	res->res.freq = iwe->u.freq.m / divi;
 }
 
 
 static void wext_get_scan_qual(struct iw_event *iwe,
-			       struct wpa_scan_result *res)
-{
-	res->qual = iwe->u.qual.qual;
-	res->noise = iwe->u.qual.noise;
-	res->level = iwe->u.qual.level;
+			       struct wext_scan_data *res)
+{
+	res->res.qual = iwe->u.qual.qual;
+	res->res.noise = iwe->u.qual.noise;
+	res->res.level = iwe->u.qual.level;
 }
 
 
 static void wext_get_scan_encode(struct iw_event *iwe,
-				 struct wpa_scan_result *res)
+				 struct wext_scan_data *res)
 {
 	if (!(iwe->u.data.flags & IW_ENCODE_DISABLED))
-		res->caps |= IEEE80211_CAP_PRIVACY;
+		res->res.caps |= IEEE80211_CAP_PRIVACY;
 }
 
 
 static void wext_get_scan_rate(struct iw_event *iwe,
-			       struct wpa_scan_result *res, char *pos,
+			       struct wext_scan_data *res, char *pos,
 			       char *end)
 {
 	int maxrate;
@@ -1312,10 +1335,11 @@
 
 
 static void wext_get_scan_iwevgenie(struct iw_event *iwe,
-				    struct wpa_scan_result *res, char *custom,
+				    struct wext_scan_data *res, char *custom,
 				    char *end)
 {
 	char *genie, *gpos, *gend;
+	u8 *tmp;
 
 	gpos = genie = custom;
 	gend = genie + iwe->u.data.length;
@@ -1324,34 +1348,21 @@
 		return;
 	}
 
-	while (gpos + 1 < gend && gpos + 2 + (u8) gpos[1] <= gend) {
-		u8 ie = gpos[0], ielen = gpos[1] + 2;
-		switch (ie) {
-		case WLAN_EID_VENDOR_SPECIFIC:
-			if (ielen < 2 + 4 ||
-			    ielen > SSID_MAX_WPA_IE_LEN ||
-			    os_memcmp(&gpos[2], "\x00\x50\xf2\x01", 4) != 0)
-				break;
-			os_memcpy(res->wpa_ie, gpos, ielen);
-			res->wpa_ie_len = ielen;
-			break;
-		case WLAN_EID_RSN:
-			if (ielen > SSID_MAX_WPA_IE_LEN)
-				break;
-			os_memcpy(res->rsn_ie, gpos, ielen);
-			res->rsn_ie_len = ielen;
-			break;
-		}
-		gpos += ielen;
-	}
+	tmp = os_realloc(res->ie, res->ie_len + gend - gpos);
+	if (tmp == NULL)
+		return;
+	os_memcpy(tmp + res->ie_len, gpos, gend - gpos);
+	res->ie = tmp;
+	res->ie_len += gend - gpos;
 }
 
 
 static void wext_get_scan_custom(struct iw_event *iwe,
-				 struct wpa_scan_result *res, char *custom,
+				 struct wext_scan_data *res, char *custom,
 				 char *end)
 {
 	size_t clen;
+	u8 *tmp;
 
 	clen = iwe->u.data.length;
 	if (custom + clen > end)
@@ -1365,12 +1376,12 @@
 		if (bytes & 1)
 			return;
 		bytes /= 2;
-		if (bytes > SSID_MAX_WPA_IE_LEN) {
-			wpa_printf(MSG_INFO, "Too long WPA IE (%d)", bytes);
+		tmp = os_realloc(res->ie, res->ie_len + bytes);
+		if (tmp == NULL)
 			return;
-		}
-		hexstr2bin(spos, res->wpa_ie, bytes);
-		res->wpa_ie_len = bytes;
+		hexstr2bin(spos, tmp + res->ie_len, bytes);
+		res->ie = tmp;
+		res->ie_len += bytes;
 	} else if (clen > 7 && os_strncmp(custom, "rsn_ie=", 7) == 0) {
 		char *spos;
 		int bytes;
@@ -1379,12 +1390,11 @@
 		if (bytes & 1)
 			return;
 		bytes /= 2;
-		if (bytes > SSID_MAX_WPA_IE_LEN) {
-			wpa_printf(MSG_INFO, "Too long RSN IE (%d)", bytes);
+		tmp = os_realloc(res->ie, res->ie_len + bytes);
+		if (tmp == NULL)
 			return;
-		}
-		hexstr2bin(spos, res->rsn_ie, bytes);
-		res->rsn_ie_len = bytes;
+		hexstr2bin(spos, tmp + res->ie_len, bytes);
+		res->ie_len += bytes;
 	} else if (clen > 4 && os_strncmp(custom, "tsf=", 4) == 0) {
 		char *spos;
 		int bytes;
@@ -1397,7 +1407,7 @@
 		}
 		bytes /= 2;
 		hexstr2bin(spos, bin, bytes);
-		res->tsf += WPA_GET_BE64(bin);
+		res->res.tsf += WPA_GET_BE64(bin);
 	}
 }
 
@@ -1410,21 +1420,80 @@
 }
 
 
+static void wpa_driver_wext_add_scan_entry(struct wpa_scan_results *res,
+					   struct wext_scan_data *data)
+{
+	struct wpa_scan_res **tmp;
+	struct wpa_scan_res *r;
+	size_t extra_len;
+	u8 *pos, *end, *ssid_ie = NULL, *rate_ie = NULL;
+
+	/* Figure out whether we need to fake any IEs */
+	pos = data->ie;
+	end = pos + data->ie_len;
+	while (pos && pos + 1 < end) {
+		if (pos + 2 + pos[1] > end)
+			break;
+		if (pos[0] == WLAN_EID_SSID)
+			ssid_ie = pos;
+		else if (pos[0] == WLAN_EID_SUPP_RATES)
+			rate_ie = pos;
+		else if (pos[0] == WLAN_EID_EXT_SUPP_RATES)
+			rate_ie = pos;
+		pos += 2 + pos[1];
+	}
+
+	extra_len = 0;
+	if (ssid_ie == NULL)
+		extra_len += 2 + data->ssid_len;
+	if (rate_ie == NULL && data->maxrate)
+		extra_len += 3;
+
+	r = os_zalloc(sizeof(*r) + extra_len + data->ie_len);
+	if (r == NULL)
+		return;
+	os_memcpy(r, &data->res, sizeof(*r));
+	r->ie_len = extra_len + data->ie_len;
+	pos = (u8 *) (r + 1);
+	if (ssid_ie == NULL) {
+		/*
+		 * Generate a fake SSID IE since the driver did not report
+		 * a full IE list.
+		 */
+		*pos++ = WLAN_EID_SSID;
+		*pos++ = data->ssid_len;
+		os_memcpy(pos, data->ssid, data->ssid_len);
+		pos += data->ssid_len;
+	}
+	if (rate_ie == NULL && data->maxrate) {
+		/*
+		 * Generate a fake Supported Rates IE since the driver did not
+		 * report a full IE list.
+		 */
+		*pos++ = WLAN_EID_SUPP_RATES;
+		*pos++ = 1;
+		*pos++ = data->maxrate;
+	}
+	if (data->ie)
+		os_memcpy(pos, data->ie, data->ie_len);
+
+	tmp = os_realloc(res->res,
+			 (res->num + 1) * sizeof(struct wpa_scan_res *));
+	if (tmp == NULL) {
+		os_free(r);
+		return;
+	}
+	tmp[res->num++] = r;
+	res->res = tmp;
+}
+				      
+
 /**
  * wpa_driver_wext_get_scan_results - Fetch the latest scan results
  * @priv: Pointer to private wext data from wpa_driver_wext_init()
- * @results: Pointer to buffer for scan results
- * @max_size: Maximum number of entries (buffer size)
- * Returns: Number of scan result entries used on success, -1 on
- * failure
- *
- * If scan results include more than max_size BSSes, max_size will be
- * returned and the remaining entries will not be included in the
- * buffer.
+ * Returns: Scan results on success, -1 on failure
  */
-int wpa_driver_wext_get_scan_results(void *priv,
-				     struct wpa_scan_result *results,
-				     size_t max_size)
+struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv)
 {
 	struct wpa_driver_wext_data *drv = priv;
 	size_t ap_num = 0, len;
@@ -1432,20 +1501,27 @@
 	u8 *res_buf;
 	struct iw_event iwe_buf, *iwe = &iwe_buf;
 	char *pos, *end, *custom;
-
-	os_memset(results, 0, max_size * sizeof(struct wpa_scan_result));
+	struct wpa_scan_results *res;
+	struct wext_scan_data data;
 
 	res_buf = wpa_driver_wext_giwscan(drv, &len);
 	if (res_buf == NULL)
-		return -1;
+		return NULL;
 
 	ap_num = 0;
 	first = 1;
 
+	res = os_zalloc(sizeof(*res));
+	if (res == NULL) {
+		os_free(res_buf);
+		return NULL;
+	}
+
 	pos = (char *) res_buf;
 	end = (char *) res_buf + len;
-
-	while (ap_num < max_size && pos + IW_EV_LCP_LEN <= end) {
+	os_memset(&data, 0, sizeof(data));
+
+	while (pos + IW_EV_LCP_LEN <= end) {
 		/* Event data may be unaligned, so make a local, aligned copy
 		 * before processing. */
 		os_memcpy(&iwe_buf, pos, IW_EV_LCP_LEN);
@@ -1467,38 +1543,36 @@
 		switch (iwe->cmd) {
 		case SIOCGIWAP:
 			if (!first)
-				ap_num++;
+				wpa_driver_wext_add_scan_entry(res, &data);
 			first = 0;
-			if (ap_num < max_size) {
-				os_memcpy(results[ap_num].bssid,
-					  iwe->u.ap_addr.sa_data, ETH_ALEN);
-			}
+			os_free(data.ie);
+			os_memset(&data, 0, sizeof(data));
+			os_memcpy(data.res.bssid,
+				  iwe->u.ap_addr.sa_data, ETH_ALEN);
 			break;
 		case SIOCGIWMODE:
-			wext_get_scan_mode(iwe, &results[ap_num]);
+			wext_get_scan_mode(iwe, &data);
 			break;
 		case SIOCGIWESSID:
-			wext_get_scan_ssid(iwe, &results[ap_num], custom, end);
+			wext_get_scan_ssid(iwe, &data, custom, end);
 			break;
 		case SIOCGIWFREQ:
-			wext_get_scan_freq(iwe, &results[ap_num]);
+			wext_get_scan_freq(iwe, &data);
 			break;
 		case IWEVQUAL:
-			wext_get_scan_qual(iwe, &results[ap_num]);
+			wext_get_scan_qual(iwe, &data);
 			break;
 		case SIOCGIWENCODE:
-			wext_get_scan_encode(iwe, &results[ap_num]);
+			wext_get_scan_encode(iwe, &data);
 			break;
 		case SIOCGIWRATE:
-			wext_get_scan_rate(iwe, &results[ap_num], pos, end);
+			wext_get_scan_rate(iwe, &data, pos, end);
 			break;
 		case IWEVGENIE:
-			wext_get_scan_iwevgenie(iwe, &results[ap_num],
-						custom, end);
+			wext_get_scan_iwevgenie(iwe, &data, custom, end);
 			break;
 		case IWEVCUSTOM:
-			wext_get_scan_custom(iwe, &results[ap_num],
-					     custom, end);
+			wext_get_scan_custom(iwe, &data, custom, end);
 			break;
 		}
 
@@ -1507,21 +1581,16 @@
 	os_free(res_buf);
 	res_buf = NULL;
 	if (!first)
-		ap_num++;
-	if (ap_num > max_size) {
-		wpa_printf(MSG_DEBUG, "Too small scan result buffer - "
-			   "%lu BSSes but room only for %lu",
-			   (unsigned long) ap_num,
-			   (unsigned long) max_size);
-		ap_num = max_size;
-	}
-	qsort(results, ap_num, sizeof(struct wpa_scan_result),
+		wpa_driver_wext_add_scan_entry(res, &data);
+	os_free(data.ie);
+
+	qsort(res->res, res->num, sizeof(struct wpa_scan_res *),
 	      wpa_scan_result_compar);
 
 	wpa_printf(MSG_DEBUG, "Received %lu bytes of scan results (%lu BSSes)",
-		   (unsigned long) len, (unsigned long) ap_num);
-
-	return ap_num;
+		   (unsigned long) len, (unsigned long) res->num);
+
+	return res;
 }
 
 
@@ -2473,7 +2542,7 @@
 	.set_countermeasures = wpa_driver_wext_set_countermeasures,
 	.set_drop_unencrypted = wpa_driver_wext_set_drop_unencrypted,
 	.scan = wpa_driver_wext_scan,
-	.get_scan_results = wpa_driver_wext_get_scan_results,
+	.get_scan_results2 = wpa_driver_wext_get_scan_results,
 	.deauthenticate = wpa_driver_wext_deauthenticate,
 	.disassociate = wpa_driver_wext_disassociate,
 	.associate = wpa_driver_wext_associate,

Modified: wpasupplicant/trunk/src/drivers/driver_wext.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_wext.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_wext.h (original)
+++ wpasupplicant/trunk/src/drivers/driver_wext.h Fri Dec 28 01:54:44 2007
@@ -30,9 +30,7 @@
 			    int set_tx, const u8 *seq, size_t seq_len,
 			    const u8 *key, size_t key_len);
 int wpa_driver_wext_scan(void *priv, const u8 *ssid, size_t ssid_len);
-int wpa_driver_wext_get_scan_results(void *priv,
-				     struct wpa_scan_result *results,
-				     size_t max_size);
+struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv);
 
 void wpa_driver_wext_scan_timeout(void *eloop_ctx, void *timeout_ctx);
 

Modified: wpasupplicant/trunk/src/l2_packet/l2_packet_privsep.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/l2_packet/l2_packet_privsep.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/l2_packet/l2_packet_privsep.c (original)
+++ wpasupplicant/trunk/src/l2_packet/l2_packet_privsep.c Fri Dec 28 01:54:44 2007
@@ -244,6 +244,11 @@
 		eloop_unregister_read_sock(l2->fd);
 		close(l2->fd);
 	}
+
+	if (l2->own_socket_path) {
+		unlink(l2->own_socket_path);
+		os_free(l2->own_socket_path);
+	}
 		
 	os_free(l2);
 }

Modified: wpasupplicant/trunk/src/rsn_supp/preauth.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/preauth.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/preauth.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/preauth.c Fri Dec 28 01:54:44 2007
@@ -24,6 +24,7 @@
 #include "preauth.h"
 #include "pmksa_cache.h"
 #include "wpa_i.h"
+#include "ieee802_11_defs.h"
 
 
 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA2)
@@ -423,15 +424,14 @@
  * rsn_preauth_scan_results - Process scan results to find PMKSA candidates
  * @sm: Pointer to WPA state machine data from wpa_sm_init()
  * @results: Scan results
- * @count: Number of BSSes in scan results
  *
  * This functions goes through the scan results and adds all suitable APs
  * (Authenticators) into PMKSA candidate list.
  */
 void rsn_preauth_scan_results(struct wpa_sm *sm,
-			      struct wpa_scan_result *results, int count)
-{
-	struct wpa_scan_result *r;
+			      struct wpa_scan_results *results)
+{
+	struct wpa_scan_res *r;
 	struct wpa_ie_data ie;
 	int i;
 	struct rsn_pmksa_cache_entry *pmksa;
@@ -445,18 +445,21 @@
 	 */
 	pmksa_candidate_free(sm);
 
-	for (i = count - 1; i >= 0; i--) {
-		r = &results[i];
-		if (r->ssid_len != sm->cur_ssid->ssid_len ||
-		    os_memcmp(r->ssid, sm->cur_ssid->ssid,
-			      r->ssid_len) != 0)
+	for (i = results->num - 1; i >= 0; i--) {
+		u8 *ssid, *rsn;
+
+		r = results->res[i];
+
+		ssid = wpa_scan_get_ie(r, WLAN_EID_SSID);
+		if (ssid == NULL || ssid[1] != sm->cur_ssid->ssid_len ||
+		    os_memcmp(ssid + 2, sm->cur_ssid->ssid, ssid[1]) != 0)
 			continue;
 
 		if (os_memcmp(r->bssid, sm->bssid, ETH_ALEN) == 0)
 			continue;
 
-		if (r->rsn_ie_len == 0 ||
-		    wpa_parse_wpa_ie(r->rsn_ie, r->rsn_ie_len, &ie))
+		rsn = wpa_scan_get_ie(r, WLAN_EID_RSN);
+		if (rsn == NULL || wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ie))
 			continue;
 
 		pmksa = pmksa_cache_get(sm->pmksa, r->bssid, NULL);

Modified: wpasupplicant/trunk/src/rsn_supp/preauth.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/preauth.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/preauth.h (original)
+++ wpasupplicant/trunk/src/rsn_supp/preauth.h Fri Dec 28 01:54:44 2007
@@ -15,7 +15,7 @@
 #ifndef PREAUTH_H
 #define PREAUTH_H
 
-struct wpa_scan_result;
+struct wpa_scan_results;
 
 #if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA2)
 
@@ -24,7 +24,7 @@
 		     struct wpa_ssid *config);
 void rsn_preauth_deinit(struct wpa_sm *sm);
 void rsn_preauth_scan_results(struct wpa_sm *sm,
-			      struct wpa_scan_result *results, int count);
+			      struct wpa_scan_results *results);
 void pmksa_candidate_add(struct wpa_sm *sm, const u8 *bssid,
 			 int prio, int preauth);
 void rsn_preauth_candidate_process(struct wpa_sm *sm);
@@ -52,8 +52,7 @@
 {
 }
 static inline void rsn_preauth_scan_results(struct wpa_sm *sm,
-					    struct wpa_scan_result *results,
-					    int count)
+					    struct wpa_scan_results *results)
 {
 }
 

Modified: wpasupplicant/trunk/wpa_supplicant/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ChangeLog?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ChangeLog (original)
+++ wpasupplicant/trunk/wpa_supplicant/ChangeLog Fri Dec 28 01:54:44 2007
@@ -28,6 +28,12 @@
 	  non-root process); see 'Privilege separation' in README for details;
 	  this is disabled by default and can be enabled with CONFIG_PRIVSEP=y
 	  in .config
+	* changed scan results data structure to include all information
+	  elements to make it easier to support new IEs; old get_scan_result()
+	  driver_ops is still supported for backwards compatibility (results
+	  are converted internally to the new format), but all drivers should
+	  start using the new get_scan_results2() to make them more likely to
+	  work with new features
 
 2007-11-24 - v0.6.1
 	* added support for configuring password as NtPasswordHash

Modified: wpasupplicant/trunk/wpa_supplicant/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/Makefile?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/Makefile (original)
+++ wpasupplicant/trunk/wpa_supplicant/Makefile Fri Dec 28 01:54:44 2007
@@ -922,8 +922,10 @@
 OBJS_t2 := $(OBJS) preauth_test.o
 OBJS += $(CONFIG_MAIN).o
 
+OBJS += ../src/drivers/scan_helpers.o
+
 ifdef CONFIG_PRIVSEP
-OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o
+OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o ../src/drivers/scan_helpers.o
 OBJS_priv += $(OBJS_l2)
 OBJS_priv += ../src/utils/os_$(CONFIG_OS).o
 OBJS_priv += ../src/utils/$(CONFIG_ELOOP).o

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c Fri Dec 28 01:54:44 2007
@@ -513,13 +513,13 @@
 	struct wpa_supplicant *wpa_s, char *buf, size_t buflen)
 {
 	char *pos, *end;
-	struct wpa_scan_result *res;
-	int i, ret;
-
-	if (wpa_s->scan_results == NULL &&
+	struct wpa_scan_res *res;
+	u8 *ie, *ie2;
+	int ret;
+	size_t i;
+
+	if (wpa_s->scan_res == NULL &&
 	    wpa_supplicant_get_scan_results(wpa_s) < 0)
-		return 0;
-	if (wpa_s->scan_results == NULL)
 		return 0;
 
 	pos = buf;
@@ -530,25 +530,24 @@
 		return pos - buf;
 	pos += ret;
 
-	for (i = 0; i < wpa_s->num_scan_results; i++) {
-		res = &wpa_s->scan_results[i];
+	for (i = 0; i < wpa_s->scan_res->num; i++) {
+		res = wpa_s->scan_res->res[i];
 		ret = os_snprintf(pos, end - pos, MACSTR "\t%d\t%d\t",
 				  MAC2STR(res->bssid), res->freq, res->level);
 		if (ret < 0 || ret >= end - pos)
 			return pos - buf;
 		pos += ret;
-		if (res->wpa_ie_len) {
+		ie = wpa_scan_get_vendor_ie(res, WPA_IE_VENDOR_TYPE);
+		if (ie) {
 			pos = wpa_supplicant_ie_txt(pos, end, "WPA",
-						    res->wpa_ie,
-						    res->wpa_ie_len);
+						    ie, 2 + ie[1]);
 		}
-		if (res->rsn_ie_len) {
+		ie2 = wpa_scan_get_ie(res, WLAN_EID_RSN);
+		if (ie2) {
 			pos = wpa_supplicant_ie_txt(pos, end, "WPA2",
-						    res->rsn_ie,
-						    res->rsn_ie_len);
+						    ie2, 2 + ie2[1]);
 		}
-		if (!res->wpa_ie_len && !res->rsn_ie_len &&
-		    res->caps & IEEE80211_CAP_PRIVACY) {
+		if (!ie && !ie2 && res->caps & IEEE80211_CAP_PRIVACY) {
 			ret = os_snprintf(pos, end - pos, "[WEP]");
 			if (ret < 0 || ret >= end - pos)
 				return pos - buf;
@@ -561,8 +560,9 @@
 			pos += ret;
 		}
 
+		ie = wpa_scan_get_ie(res, WLAN_EID_SSID);
 		ret = os_snprintf(pos, end - pos, "\t%s",
-				  wpa_ssid_txt(res->ssid, res->ssid_len));
+				  ie ? wpa_ssid_txt(ie + 2, ie[1]) : "");
 		if (ret < 0 || ret >= end - pos)
 			return pos - buf;
 		pos += ret;

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c Fri Dec 28 01:54:44 2007
@@ -424,19 +424,19 @@
 {
 	DBusMessage *reply = NULL;
 	const char *method = dbus_message_get_member(message);
-	struct wpa_scan_result * res = NULL;
-	int i;
+	struct wpa_scan_res *res = NULL;
+	size_t i;
 
 	/* Ensure we actually have scan data */
-	if (wpa_s->scan_results == NULL &&
+	if (wpa_s->scan_res == NULL &&
 	    wpa_supplicant_get_scan_results(wpa_s) < 0) {
 		reply = wpas_dbus_new_invalid_bssid_error(message);
 		goto out;
 	}
 
 	/* Find the bssid's scan data */
-	for (i = 0; i < wpa_s->num_scan_results; i++) {
-		struct wpa_scan_result * search_res = &wpa_s->scan_results[i];
+	for (i = 0; i < wpa_s->scan_res->num; i++) {
+		struct wpa_scan_res *search_res = wpa_s->scan_res->res[i];
 		char mac_str[18];
 
 		memset(mac_str, 0, sizeof(mac_str));
@@ -444,6 +444,7 @@
 			 MAC2STR(search_res->bssid));
 		if (!strcmp(bssid, mac_str)) {
 			res = search_res;
+			break;
 		}
 	}
 

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c Fri Dec 28 01:54:44 2007
@@ -312,10 +312,10 @@
 	DBusMessage *reply = NULL;
 	DBusMessageIter iter;
 	DBusMessageIter sub_iter;
-	int i;
+	size_t i;
 
 	/* Ensure we've actually got scan results to return */
-	if (wpa_s->scan_results == NULL &&
+	if (wpa_s->scan_res == NULL &&
 	    wpa_supplicant_get_scan_results(wpa_s) < 0) {
 		reply = dbus_message_new_error(message, WPAS_ERROR_SCAN_ERROR,
 					       "An error ocurred getting scan "
@@ -331,8 +331,8 @@
 					 &sub_iter);
 
 	/* Loop through scan results and append each result's object path */
-	for (i = 0; i < wpa_s->num_scan_results; i++) {
-		struct wpa_scan_result *res = &wpa_s->scan_results[i];
+	for (i = 0; i < wpa_s->scan_res->num; i++) {
+		struct wpa_scan_res *res = wpa_s->scan_res->res[i];
 		char *path;
 
 		path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
@@ -376,19 +376,18 @@
  */
 DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
 					 struct wpa_supplicant *wpa_s,
-					 struct wpa_scan_result *res)
+					 struct wpa_scan_res *res)
 {
 	DBusMessage *reply = NULL;
 	char *bssid_data, *ssid_data, *wpa_ie_data, *rsn_ie_data;
 	DBusMessageIter iter, iter_dict;
+	u8 *ie;
+	size_t len;
 
 	/* dbus needs the address of a pointer to the actual value
 	 * for array types, not the address of the value itself.
 	 */
 	bssid_data = (char *) &res->bssid;
-	ssid_data = (char *) &res->ssid;
-	wpa_ie_data = (char *) &res->wpa_ie;
-	rsn_ie_data = (char *) &res->rsn_ie;
 
 	/* Dump the properties into a dbus message */
 	reply = dbus_message_new_method_return(message);
@@ -400,23 +399,35 @@
 	if (!wpa_dbus_dict_append_byte_array(&iter_dict, "bssid",
 					     bssid_data, ETH_ALEN))
 		goto error;
-	if (!wpa_dbus_dict_append_byte_array(&iter_dict, "ssid",
-					     ssid_data, res->ssid_len))
+
+	ie = wpa_scan_get_ie(res, WLAN_EID_SSID);
+	if (ie) {
+		len = ie[1];
+		ie += 2;
+		ssid_data = (char *) &ie;
+		if (!wpa_dbus_dict_append_byte_array(&iter_dict, "ssid",
+						     ssid_data, len))
 		goto error;
-	if (res->wpa_ie_len) {
+	}
+
+	ie = wpa_scan_get_vendor_ie(res, WPA_IE_VENDOR_TYPE);
+	if (ie) {
+		len = 2 + ie[1];
+		wpa_ie_data = (char *) &ie;
 		if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpaie",
-						     wpa_ie_data,
-						     res->wpa_ie_len)) {
-			goto error;
-		}
-	}
-	if (res->rsn_ie_len) {
+						     wpa_ie_data, len))
+			goto error;
+	}
+
+	ie = wpa_scan_get_ie(res, WLAN_EID_RSN);
+	if (ie) {
+		len = 2 + ie[1];
+		rsn_ie_data = (char *) &ie;
 		if (!wpa_dbus_dict_append_byte_array(&iter_dict, "rsnie",
-						     rsn_ie_data,
-						     res->rsn_ie_len)) {
-			goto error;
-		}
-	}
+						     rsn_ie_data, len))
+			goto error;
+	}
+
 	if (res->freq) {
 		if (!wpa_dbus_dict_append_int32(&iter_dict, "frequency",
 						res->freq))
@@ -431,7 +442,8 @@
 		goto error;
 	if (!wpa_dbus_dict_append_int32(&iter_dict, "level", res->level))
 		goto error;
-	if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate", res->maxrate))
+	if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate",
+					wpa_scan_get_max_rate(res)))
 		goto error;
 
 	if (!wpa_dbus_dict_close_write(&iter, &iter_dict))

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h Fri Dec 28 01:54:44 2007
@@ -36,7 +36,7 @@
 
 DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
 					 struct wpa_supplicant *wpa_s,
-					 struct wpa_scan_result *res);
+					 struct wpa_scan_res *res);
 
 DBusMessage * wpas_dbus_iface_capabilities(DBusMessage *message,
 					   struct wpa_supplicant *wpa_s);

Modified: wpasupplicant/trunk/wpa_supplicant/dbus-wpa_supplicant.conf
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/dbus-wpa_supplicant.conf?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/dbus-wpa_supplicant.conf (original)
+++ wpasupplicant/trunk/wpa_supplicant/dbus-wpa_supplicant.conf Fri Dec 28 01:54:44 2007
@@ -8,10 +8,6 @@
                 <allow send_destination="fi.epitest.hostap.WPASupplicant"/>
                 <allow send_interface="fi.epitest.hostap.WPASupplicant"/>
         </policy>
-        <policy at_console="true">
-                <allow send_destination="fi.epitest.hostap.WPASupplicant"/>
-                <allow send_interface="fi.epitest.hostap.WPASupplicant"/>
-        </policy>
         <policy context="default">
                 <deny own="fi.epitest.hostap.WPASupplicant"/>
                 <deny send_destination="fi.epitest.hostap.WPASupplicant"/>

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/Makefile?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/Makefile (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/Makefile Fri Dec 28 01:54:44 2007
@@ -4,6 +4,7 @@
 FILES += wpa_cli
 FILES += wpa_gui
 FILES += wpa_passphrase
+FILES += wpa_priv
 FILES += wpa_supplicant.conf
 FILES += wpa_supplicant
 
@@ -19,7 +20,7 @@
 
 
 clean:
-	rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_supplicant.8
+	rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_priv.8 wpa_supplicant.8
 	rm -f wpa_supplicant.conf.5
 	rm -f manpage.links manpage.refs
 	rm -f $(FILES:%=%.pdf)

Modified: wpasupplicant/trunk/wpa_supplicant/events.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/events.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/events.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/events.c Fri Dec 28 01:54:44 2007
@@ -238,7 +238,7 @@
 
 
 #ifndef CONFIG_NO_SCAN_PROCESSING
-static int wpa_supplicant_match_privacy(struct wpa_scan_result *bss,
+static int wpa_supplicant_match_privacy(struct wpa_scan_res *bss,
 					struct wpa_ssid *ssid)
 {
 	int i, privacy = 0;
@@ -266,15 +266,17 @@
 
 
 static int wpa_supplicant_ssid_bss_match(struct wpa_ssid *ssid,
-					 struct wpa_scan_result *bss)
+					 struct wpa_scan_res *bss)
 {
 	struct wpa_ie_data ie;
 	int proto_match = 0;
-
-	while ((ssid->proto & WPA_PROTO_RSN) && bss->rsn_ie_len > 0) {
+	u8 *rsn_ie, *wpa_ie;
+
+	rsn_ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+	while ((ssid->proto & WPA_PROTO_RSN) && rsn_ie) {
 		proto_match++;
 
-		if (wpa_parse_wpa_ie(bss->rsn_ie, bss->rsn_ie_len, &ie)) {
+		if (wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) {
 			wpa_printf(MSG_DEBUG, "   skip RSN IE - parse failed");
 			break;
 		}
@@ -315,10 +317,11 @@
 		return 1;
 	}
 
-	while ((ssid->proto & WPA_PROTO_WPA) && bss->wpa_ie_len > 0) {
+	wpa_ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+	while ((ssid->proto & WPA_PROTO_WPA) && wpa_ie) {
 		proto_match++;
 
-		if (wpa_parse_wpa_ie(bss->wpa_ie, bss->wpa_ie_len, &ie)) {
+		if (wpa_parse_wpa_ie(wpa_ie, 2 + wpa_ie[1], &ie)) {
 			wpa_printf(MSG_DEBUG, "   skip WPA IE - parse failed");
 			break;
 		}
@@ -357,15 +360,15 @@
 }
 
 
-static struct wpa_scan_result *
+static struct wpa_scan_res *
 wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
-			  struct wpa_scan_result *results, int num,
 			  struct wpa_ssid **selected_ssid)
 {
 	struct wpa_ssid *ssid;
-	struct wpa_scan_result *bss, *selected = NULL;
-	int i;
+	struct wpa_scan_res *bss, *selected = NULL;
+	size_t i;
 	struct wpa_blacklist *e;
+	u8 *ie;
 
 	wpa_printf(MSG_DEBUG, "Selecting BSS from priority group %d",
 		   group->priority);
@@ -374,21 +377,33 @@
 	ssid = NULL;
 	/* First, try to find WPA-enabled AP */
 	wpa_printf(MSG_DEBUG, "Try to find WPA-enabled AP");
-	for (i = 0; i < num && !selected; i++) {
-		bss = &results[i];
+	for (i = 0; i < wpa_s->scan_res->num && !selected; i++) {
+		u8 *ssid_;
+		u8 wpa_ie_len, rsn_ie_len, ssid_len;
+		bss = wpa_s->scan_res->res[i];
+
+		ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
+		ssid_ = ie ? ie + 2 : (u8 *) "";
+		ssid_len = ie ? ie[1] : 0;
+
+		ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+		wpa_ie_len = ie ? ie[1] : 0;
+
+		ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+		rsn_ie_len = ie ? ie[1] : 0;
+
 		wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
-			   "wpa_ie_len=%lu rsn_ie_len=%lu caps=0x%x",
+			   "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
 			   i, MAC2STR(bss->bssid),
-			   wpa_ssid_txt(bss->ssid, bss->ssid_len),
-			   (unsigned long) bss->wpa_ie_len,
-			   (unsigned long) bss->rsn_ie_len, bss->caps);
+			   wpa_ssid_txt(ssid_, ssid_len),
+			   wpa_ie_len, rsn_ie_len, bss->caps);
 		e = wpa_blacklist_get(wpa_s, bss->bssid);
 		if (e && e->count > 1) {
 			wpa_printf(MSG_DEBUG, "   skip - blacklisted");
 			continue;
 		}
 
-		if (bss->wpa_ie_len == 0 && bss->rsn_ie_len == 0) {
+		if (wpa_ie_len == 0 && rsn_ie_len == 0) {
 			wpa_printf(MSG_DEBUG, "   skip - no WPA/RSN IE");
 			continue;
 		}
@@ -398,9 +413,8 @@
 				wpa_printf(MSG_DEBUG, "   skip - disabled");
 				continue;
 			}
-			if (bss->ssid_len != ssid->ssid_len ||
-			    os_memcmp(bss->ssid, ssid->ssid,
-				      bss->ssid_len) != 0) {
+			if (ssid_len != ssid->ssid_len ||
+			    os_memcmp(ssid_, ssid->ssid, ssid_len) != 0) {
 				wpa_printf(MSG_DEBUG, "   skip - "
 					   "SSID mismatch");
 				continue;
@@ -418,8 +432,7 @@
 				wpa_printf(MSG_DEBUG, "   selected WPA AP "
 					   MACSTR " ssid='%s'",
 					   MAC2STR(bss->bssid),
-					   wpa_ssid_txt(bss->ssid,
-							bss->ssid_len));
+					   wpa_ssid_txt(ssid_, ssid_len));
 				break;
 			}
 		}
@@ -428,14 +441,26 @@
 	/* If no WPA-enabled AP found, try to find non-WPA AP, if configuration
 	 * allows this. */
 	wpa_printf(MSG_DEBUG, "Try to find non-WPA AP");
-	for (i = 0; i < num && !selected; i++) {
-		bss = &results[i];
+	for (i = 0; i < wpa_s->scan_res->num && !selected; i++) {
+		u8 *ssid_;
+		u8 wpa_ie_len, rsn_ie_len, ssid_len;
+		bss = wpa_s->scan_res->res[i];
+
+		ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
+		ssid_ = ie ? ie + 2 : (u8 *) "";
+		ssid_len = ie ? ie[1] : 0;
+
+		ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+		wpa_ie_len = ie ? ie[1] : 0;
+
+		ie = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+		rsn_ie_len = ie ? ie[1] : 0;
+
 		wpa_printf(MSG_DEBUG, "%d: " MACSTR " ssid='%s' "
-			   "wpa_ie_len=%lu rsn_ie_len=%lu caps=0x%x",
+			   "wpa_ie_len=%u rsn_ie_len=%u caps=0x%x",
 			   i, MAC2STR(bss->bssid),
-			   wpa_ssid_txt(bss->ssid, bss->ssid_len),
-			   (unsigned long) bss->wpa_ie_len,
-			   (unsigned long) bss->rsn_ie_len, bss->caps);
+			   wpa_ssid_txt(ssid_, ssid_len),
+			   wpa_ie_len, rsn_ie_len, bss->caps);
 		e = wpa_blacklist_get(wpa_s, bss->bssid);
 		if (e && e->count > 1) {
 			wpa_printf(MSG_DEBUG, "   skip - blacklisted");
@@ -447,9 +472,8 @@
 				continue;
 			}
 			if (ssid->ssid_len != 0 &&
-			    (bss->ssid_len != ssid->ssid_len ||
-			     os_memcmp(bss->ssid, ssid->ssid,
-				       bss->ssid_len) != 0)) {
+			    (ssid_len != ssid->ssid_len ||
+			     os_memcmp(ssid_, ssid->ssid, ssid_len) != 0)) {
 				wpa_printf(MSG_DEBUG, "   skip - "
 					   "SSID mismatch");
 				continue;
@@ -473,7 +497,7 @@
 
 			if ((ssid->key_mgmt & 
 			     (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK)) &&
-			    (bss->wpa_ie_len != 0 || bss->rsn_ie_len != 0)) {
+			    (wpa_ie_len != 0 || rsn_ie_len != 0)) {
 				wpa_printf(MSG_DEBUG, "   skip - "
 					   "WPA network");
 				continue;
@@ -496,7 +520,7 @@
 			wpa_printf(MSG_DEBUG, "   selected non-WPA AP "
 				   MACSTR " ssid='%s'",
 				   MAC2STR(bss->bssid),
-				   wpa_ssid_txt(bss->ssid, bss->ssid_len));
+				   wpa_ssid_txt(ssid_, ssid_len));
 			break;
 		}
 	}
@@ -507,10 +531,9 @@
 
 static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
 {
-	int num, prio, timeout;
-	struct wpa_scan_result *selected = NULL;
+	int prio, timeout;
+	struct wpa_scan_res *selected = NULL;
 	struct wpa_ssid *ssid = NULL;
-	struct wpa_scan_result *results;
 
 	if (wpa_supplicant_get_scan_results(wpa_s) < 0) {
 		if (wpa_s->conf->ap_scan == 2)
@@ -525,14 +548,11 @@
 
 	if (wpa_s->conf->ap_scan == 2 || wpa_s->disconnected)
 		return;
-	results = wpa_s->scan_results;
-	num = wpa_s->num_scan_results;
 
 	while (selected == NULL) {
 		for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
 			selected = wpa_supplicant_select_bss(
-				wpa_s, wpa_s->conf->pssid[prio], results, num,
-				&ssid);
+				wpa_s, wpa_s->conf->pssid[prio], &ssid);
 			if (selected)
 				break;
 		}
@@ -565,7 +585,7 @@
 			wpa_printf(MSG_DEBUG, "Already associated with the "
 				   "selected AP.");
 		}
-		rsn_preauth_scan_results(wpa_s->wpa, results, num);
+		rsn_preauth_scan_results(wpa_s->wpa, wpa_s->scan_res);
 	} else {
 		wpa_printf(MSG_DEBUG, "No suitable AP found.");
 		timeout = 5;

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp Fri Dec 28 01:54:44 2007
@@ -85,6 +85,8 @@
 
 	connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 
+	eventListView->setItemsExpandable(FALSE);
+	eventListView->setRootIsDecorated(FALSE);
 	elm = new EventListModel(parent);
 	eventListView->setModel(elm);
 }
@@ -115,8 +117,4 @@
 {
 	elm->addEvent(msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"),
 		      msg.getMsg());
-#if QT_VERSION >= 0x040100
-	eventListView->resizeColumnsToContents();
-	eventListView->resizeRowsToContents();
-#endif
 }

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.ui?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/eventhistory.ui Fri Dec 28 01:54:44 2007
@@ -17,7 +17,7 @@
     </property>
     <layout class="QVBoxLayout" >
       <item>
-        <widget class="QTableView" name="eventListView" >
+        <widget class="QTreeView" name="eventListView" >
           <property name="sizePolicy" >
             <sizepolicy>
               <hsizetype>7</hsizetype>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp Fri Dec 28 01:54:44 2007
@@ -58,39 +58,39 @@
 }
 
 
-void NetworkConfig::paramsFromScanResults(Q3ListViewItem *sel)
+void NetworkConfig::paramsFromScanResults(QTreeWidgetItem *sel)
 {
 	new_network = true;
 
 	/* SSID BSSID frequency signal flags */
-	setCaption(sel->text(0));
+	setWindowTitle(sel->text(0));
 	ssidEdit->setText(sel->text(0));
 
 	QString flags = sel->text(4);
 	int auth, encr = 0;
-	if (flags.find("[WPA2-EAP") >= 0)
+	if (flags.indexOf("[WPA2-EAP") >= 0)
 		auth = AUTH_WPA2_EAP;
-	else if (flags.find("[WPA-EAP") >= 0)
+	else if (flags.indexOf("[WPA-EAP") >= 0)
 		auth = AUTH_WPA_EAP;
-	else if (flags.find("[WPA2-PSK") >= 0)
+	else if (flags.indexOf("[WPA2-PSK") >= 0)
 		auth = AUTH_WPA2_PSK;
-	else if (flags.find("[WPA-PSK") >= 0)
+	else if (flags.indexOf("[WPA-PSK") >= 0)
 		auth = AUTH_WPA_PSK;
 	else
 		auth = AUTH_NONE;
 
-	if (flags.find("-CCMP") >= 0)
+	if (flags.indexOf("-CCMP") >= 0)
 		encr = 1;
-	else if (flags.find("-TKIP") >= 0)
+	else if (flags.indexOf("-TKIP") >= 0)
 		encr = 0;
-	else if (flags.find("WEP") >= 0)
+	else if (flags.indexOf("WEP") >= 0)
 		encr = 1;
 	else
 		encr = 0;
 
-	authSelect->setCurrentItem(auth);
+	authSelect->setCurrentIndex(auth);
 	authChanged(auth);
-	encrSelect->setCurrentItem(encr);
+	encrSelect->setCurrentIndex(encr);
 
 	getEapCapa();
 }
@@ -110,14 +110,14 @@
 		encrSelect->removeItem(0);
 
 	if (sel == AUTH_NONE || sel == AUTH_IEEE8021X) {
-		encrSelect->insertItem("None");
-		encrSelect->insertItem("WEP");
-		encrSelect->setCurrentItem(sel == AUTH_NONE ? 0 : 1);
+		encrSelect->insertItem(-1, "None");
+		encrSelect->insertItem(-1, "WEP");
+		encrSelect->setCurrentIndex(sel == AUTH_NONE ? 0 : 1);
 	} else {
-		encrSelect->insertItem("TKIP");
-		encrSelect->insertItem("CCMP");
-		encrSelect->setCurrentItem((sel == AUTH_WPA2_PSK ||
-					    sel == AUTH_WPA2_EAP) ? 1 : 0);
+		encrSelect->insertItem(-1, "TKIP");
+		encrSelect->insertItem(-1, "CCMP");
+		encrSelect->setCurrentIndex((sel == AUTH_WPA2_PSK ||
+					     sel == AUTH_WPA2_EAP) ? 1 : 0);
 	}
 
 	wepEnabled(sel == AUTH_IEEE8021X);
@@ -130,7 +130,7 @@
 	size_t reply_len;
 	int id;
 	int psklen = pskEdit->text().length();
-	int auth = authSelect->currentItem();
+	int auth = authSelect->currentIndex();
 
 	if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
 		if (psklen < 8 || psklen > 64) {
@@ -160,7 +160,13 @@
 	} else
 		id = edit_network_id;
 
-	setNetworkParam(id, "ssid", ssidEdit->text().ascii(), true);
+	setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(),
+			true);
+
+	if (idstrEdit->isEnabled())
+		setNetworkParam(id, "id_str",
+				idstrEdit->text().toAscii().constData(),
+				true);
 
 	const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
 	switch (auth) {
@@ -190,7 +196,7 @@
 
 	if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP ||
 	    auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) {
-		int encr = encrSelect->currentItem();
+		int encr = encrSelect->currentIndex();
 		if (encr == 0)
 			pairwise = "TKIP";
 		else
@@ -206,21 +212,28 @@
 		setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false);
 	}
 	if (pskEdit->isEnabled() &&
-	    strcmp(passwordEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
-		setNetworkParam(id, "psk", pskEdit->text().ascii(),
+	    strcmp(passwordEdit->text().toAscii().constData(),
+		   WPA_GUI_KEY_DATA) != 0)
+		setNetworkParam(id, "psk",
+				pskEdit->text().toAscii().constData(),
 				psklen != 64);
 	if (eapSelect->isEnabled())
-		setNetworkParam(id, "eap", eapSelect->currentText().ascii(),
+		setNetworkParam(id, "eap",
+				eapSelect->currentText().toAscii().constData(),
 				false);
 	if (identityEdit->isEnabled())
-		setNetworkParam(id, "identity", identityEdit->text().ascii(),
+		setNetworkParam(id, "identity",
+				identityEdit->text().toAscii().constData(),
 				true);
 	if (passwordEdit->isEnabled() &&
-	    strcmp(passwordEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
-		setNetworkParam(id, "password", passwordEdit->text().ascii(),
+	    strcmp(passwordEdit->text().toAscii().constData(),
+		   WPA_GUI_KEY_DATA) != 0)
+		setNetworkParam(id, "password",
+				passwordEdit->text().toAscii().constData(),
 				true);
 	if (cacertEdit->isEnabled())
-		setNetworkParam(id, "ca_cert", cacertEdit->text().ascii(),
+		setNetworkParam(id, "ca_cert",
+				cacertEdit->text().toAscii().constData(),
 				true);
 	writeWepKey(id, wep0Edit, 0);
 	writeWepKey(id, wep1Edit, 1);
@@ -273,7 +286,7 @@
 
 void NetworkConfig::encrChanged(const QString &sel)
 {
-	wepEnabled(sel.find("WEP") == 0);
+	wepEnabled(sel.indexOf("WEP") == 0);
 }
 
 
@@ -304,7 +317,7 @@
 	 * Assume hex key if only hex characters are present and length matches
 	 * with 40, 104, or 128-bit key
 	 */
-	txt = edit->text().ascii();
+	txt = edit->text().toAscii().constData();
 	if (strcmp(txt, WPA_GUI_KEY_DATA) == 0)
 		return;
 	len = strlen(txt);
@@ -355,6 +368,17 @@
 		ssidEdit->setText(reply + 1);
 	}
 
+	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
+	reply_len = sizeof(reply) - 1;
+	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 &&
+	    reply_len >= 2 && reply[0] == '"') {
+		reply[reply_len] = '\0';
+		pos = strchr(reply + 1, '"');
+		if (pos)
+			*pos = '\0';
+		idstrEdit->setText(reply + 1);
+	}
+
 	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
 	reply_len = sizeof(reply) - 1;
 	int wpa = 0;
@@ -449,8 +473,8 @@
 	    reply_len >= 1) {
 		reply[reply_len] = '\0';
 		for (i = 0; i < eapSelect->count(); i++) {
-			if (eapSelect->text(i).compare(reply) == 0) {
-				eapSelect->setCurrentItem(i);
+			if (eapSelect->itemText(i).compare(reply) == 0) {
+				eapSelect->setCurrentIndex(i);
 				break;
 			}
 		}
@@ -514,9 +538,9 @@
 		}
 	}
 
-	authSelect->setCurrentItem(auth);
+	authSelect->setCurrentIndex(auth);
 	authChanged(auth);
-	encrSelect->setCurrentItem(encr);
+	encrSelect->setCurrentIndex(encr);
 	if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
 		wepEnabled(encr == 1);
 
@@ -577,6 +601,6 @@
 	reply[reply_len] = '\0';
 
 	QString res(reply);
-	QStringList types = QStringList::split(QChar(' '), res);
-	eapSelect->insertStringList(types);
-}
+	QStringList types = res.split(QChar(' '));
+	eapSelect->insertItems(-1, types);
+}

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.h Fri Dec 28 01:54:44 2007
@@ -29,7 +29,7 @@
 		      bool modal = false, Qt::WFlags fl = 0);
 	~NetworkConfig();
 
-	virtual void paramsFromScanResults(Q3ListViewItem *sel);
+	virtual void paramsFromScanResults(QTreeWidgetItem *sel);
 	virtual void setWpaGui(WpaGui *_wpagui);
 	virtual int setNetworkParam(int id, const char *field,
 				    const char *value, bool quote);

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui Fri Dec 28 01:54:44 2007
@@ -9,7 +9,7 @@
         <x>0</x>
         <y>0</y>
         <width>380</width>
-        <height>413</height>
+        <height>430</height>
       </rect>
     </property>
     <property name="windowTitle" >
@@ -33,7 +33,7 @@
           </property>
           <layout class="QGridLayout" >
             <item row="0" column="0" >
-              <widget class="QLabel" name="textLabel1" >
+              <widget class="QLabel" name="textLabel0" >
                 <property name="text" >
                   <string>SSID</string>
                 </property>
@@ -50,13 +50,30 @@
               </widget>
             </item>
             <item row="1" column="0" >
+              <widget class="QLabel" name="textLabel1" >
+                <property name="text" >
+                  <string>Network ID</string>
+                </property>
+              </widget>
+            </item>
+            <item row="1" column="1" >
+              <widget class="QLineEdit" name="idstrEdit" >
+                <property name="text" >
+                  <string/>
+                </property>
+                <property name="toolTip" stdset="0" >
+                  <string>Network Identification String</string>
+                </property>
+              </widget>
+            </item>
+            <item row="2" column="0" >
               <widget class="QLabel" name="textLabel2" >
                 <property name="text" >
                   <string>Authentication</string>
                 </property>
               </widget>
             </item>
-            <item row="1" column="1" >
+            <item row="2" column="1" >
               <widget class="QComboBox" name="authSelect" >
                 <item>
                   <property name="text" >
@@ -90,14 +107,14 @@
                 </item>
               </widget>
             </item>
-            <item row="2" column="0" >
+            <item row="3" column="0" >
               <widget class="QLabel" name="textLabel3" >
                 <property name="text" >
                   <string>Encryption</string>
                 </property>
               </widget>
             </item>
-            <item row="2" column="1" >
+            <item row="3" column="1" >
               <widget class="QComboBox" name="encrSelect" >
                 <item>
                   <property name="text" >
@@ -121,14 +138,14 @@
                 </item>
               </widget>
             </item>
-            <item row="3" column="0" >
+            <item row="4" column="0" >
               <widget class="QLabel" name="textLabel4" >
                 <property name="text" >
                   <string>PSK</string>
                 </property>
               </widget>
             </item>
-            <item row="3" column="1" >
+            <item row="4" column="1" >
               <widget class="QLineEdit" name="pskEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -144,28 +161,28 @@
                 </property>
               </widget>
             </item>
-            <item row="4" column="0" >
+            <item row="5" column="0" >
               <widget class="QLabel" name="textLabel5" >
                 <property name="text" >
                   <string>EAP method</string>
                 </property>
               </widget>
             </item>
-            <item row="4" column="1" >
+            <item row="5" column="1" >
               <widget class="QComboBox" name="eapSelect" >
                 <property name="enabled" >
                   <bool>false</bool>
                 </property>
               </widget>
             </item>
-            <item row="5" column="0" >
+            <item row="6" column="0" >
               <widget class="QLabel" name="textLabel6" >
                 <property name="text" >
                   <string>Identity</string>
                 </property>
               </widget>
             </item>
-            <item row="5" column="1" >
+            <item row="6" column="1" >
               <widget class="QLineEdit" name="identityEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -175,14 +192,14 @@
                 </property>
               </widget>
             </item>
-            <item row="6" column="0" >
+            <item row="7" column="0" >
               <widget class="QLabel" name="textLabel7" >
                 <property name="text" >
                   <string>Password</string>
                 </property>
               </widget>
             </item>
-            <item row="6" column="1" >
+            <item row="7" column="1" >
               <widget class="QLineEdit" name="passwordEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -195,21 +212,21 @@
                 </property>
               </widget>
             </item>
-            <item row="7" column="0" >
+            <item row="8" column="0" >
               <widget class="QLabel" name="textLabel1_2" >
                 <property name="text" >
                   <string>CA certificate</string>
                 </property>
               </widget>
             </item>
-            <item row="7" column="1" >
+            <item row="8" column="1" >
               <widget class="QLineEdit" name="cacertEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
                 </property>
               </widget>
             </item>
-            <item rowspan="1" row="8" column="0" colspan="2" >
+            <item rowspan="1" row="9" column="0" colspan="2" >
               <widget class="QGroupBox" name="buttonGroup1" >
                 <property name="enabled" >
                   <bool>true</bool>
@@ -331,6 +348,7 @@
   <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
   <tabstops>
     <tabstop>ssidEdit</tabstop>
+    <tabstop>idstrEdit</tabstop>
     <tabstop>authSelect</tabstop>
     <tabstop>encrSelect</tabstop>
     <tabstop>pskEdit</tabstop>
@@ -351,6 +369,6 @@
     <tabstop>cancelButton</tabstop>
   </tabstops>
   <includes>
-    <include location="global" >q3listview.h</include>
+    <include location="global" >qtreewidget.h</include>
   </includes>
 </ui>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp Fri Dec 28 01:54:44 2007
@@ -26,10 +26,13 @@
 
 	connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 	connect(scanButton, SIGNAL(clicked()), this, SLOT(scanRequest()));
-	connect(scanResultsView, SIGNAL(doubleClicked(Q3ListViewItem *)), this,
-		SLOT(bssSelected(Q3ListViewItem *)));
+	connect(scanResultsWidget,
+		SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
+		SLOT(bssSelected(QTreeWidgetItem *)));
 
 	wpagui = NULL;
+	scanResultsWidget->setItemsExpandable(FALSE);
+	scanResultsWidget->setRootIsDecorated(FALSE);
 }
 
 
@@ -52,7 +55,8 @@
     
 	timer = new QTimer(this);
 	connect(timer, SIGNAL(timeout()), SLOT(getResults()));
-	timer->start(10000, FALSE);
+	timer->setSingleShot(FALSE);
+	timer->start(10000);
 }
 
 
@@ -69,10 +73,10 @@
 		return;
 	reply[reply_len] = '\0';
 
-	scanResultsView->clear();
-    
+	scanResultsWidget->clear();
+
 	QString res(reply);
-	QStringList lines = QStringList::split(QChar('\n'), res);
+	QStringList lines = res.split(QChar('\n'));
 	bool first = true;
 	for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++)
 	{
@@ -80,16 +84,23 @@
 			first = false;
 			continue;
 		}
-	
-		QStringList cols = QStringList::split(QChar('\t'), *it, true);
+
+		QStringList cols = (*it).split(QChar('\t'));
 		QString ssid, bssid, freq, signal, flags;
 		bssid = cols.count() > 0 ? cols[0] : "";
 		freq = cols.count() > 1 ? cols[1] : "";
 		signal = cols.count() > 2 ? cols[2] : "";
 		flags = cols.count() > 3 ? cols[3] : "";
 		ssid = cols.count() > 4 ? cols[4] : "";
-		new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal,
-				   flags);
+
+		QTreeWidgetItem *item = new QTreeWidgetItem(scanResultsWidget);
+		if (item) {
+			item->setText(0, ssid);
+			item->setText(1, bssid);
+			item->setText(2, freq);
+			item->setText(3, signal);
+			item->setText(4, flags);
+		}
 	}
 }
 
@@ -112,7 +123,7 @@
 }
 
 
-void ScanResults::bssSelected( Q3ListViewItem * sel )
+void ScanResults::bssSelected(QTreeWidgetItem *sel)
 {
 	NetworkConfig *nc = new NetworkConfig();
 	if (nc == NULL)

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h Fri Dec 28 01:54:44 2007
@@ -34,7 +34,7 @@
 	virtual void updateResults();
 	virtual void scanRequest();
 	virtual void getResults();
-	virtual void bssSelected(Q3ListViewItem *sel);
+	virtual void bssSelected(QTreeWidgetItem *sel);
 
 protected slots:
 	virtual void languageChange();

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.ui?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.ui Fri Dec 28 01:54:44 2007
@@ -1,125 +1,94 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>ScanResults</class>
-  <widget class="QDialog" name="ScanResults" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>452</width>
-        <height>225</height>
-      </rect>
-    </property>
-    <property name="windowTitle" >
-      <string>Scan results</string>
-    </property>
-    <layout class="QVBoxLayout" >
-      <item>
-        <widget class="Q3ListView" name="scanResultsView" >
-          <property name="frameShape" >
-            <enum>QFrame::StyledPanel</enum>
-          </property>
-          <property name="frameShadow" >
-            <enum>QFrame::Sunken</enum>
-          </property>
-          <column>
-            <property name="text" >
-              <string>SSID</string>
-            </property>
-            <property name="clickable" >
-              <bool>true</bool>
-            </property>
-            <property name="resizable" >
-              <bool>true</bool>
-            </property>
-          </column>
-          <column>
-            <property name="text" >
-              <string>BSSID</string>
-            </property>
-            <property name="clickable" >
-              <bool>true</bool>
-            </property>
-            <property name="resizable" >
-              <bool>true</bool>
-            </property>
-          </column>
-          <column>
-            <property name="text" >
-              <string>frequency</string>
-            </property>
-            <property name="clickable" >
-              <bool>true</bool>
-            </property>
-            <property name="resizable" >
-              <bool>true</bool>
-            </property>
-          </column>
-          <column>
-            <property name="text" >
-              <string>signal</string>
-            </property>
-            <property name="clickable" >
-              <bool>true</bool>
-            </property>
-            <property name="resizable" >
-              <bool>true</bool>
-            </property>
-          </column>
-          <column>
-            <property name="text" >
-              <string>flags</string>
-            </property>
-            <property name="clickable" >
-              <bool>true</bool>
-            </property>
-            <property name="resizable" >
-              <bool>true</bool>
-            </property>
-          </column>
-        </widget>
-      </item>
-      <item>
-        <layout class="QHBoxLayout" >
-          <property name="margin" >
-            <number>0</number>
-          </property>
-          <item>
-            <spacer name="spacer6" >
-              <property name="sizeHint" >
-                <size>
-                  <width>50</width>
-                  <height>20</height>
-                </size>
-              </property>
-              <property name="sizeType" >
-                <enum>Expanding</enum>
-              </property>
-              <property name="orientation" >
-                <enum>Horizontal</enum>
-              </property>
-            </spacer>
-          </item>
-          <item>
-            <widget class="QPushButton" name="scanButton" >
-              <property name="text" >
-                <string>Scan</string>
-              </property>
-            </widget>
-          </item>
-          <item>
-            <widget class="QPushButton" name="closeButton" >
-              <property name="text" >
-                <string>Close</string>
-              </property>
-            </widget>
-          </item>
-        </layout>
-      </item>
+<ui version="4.0" >
+ <class>ScanResults</class>
+ <widget class="QDialog" name="ScanResults" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>452</width>
+    <height>244</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Scan results</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <item>
+    <widget class="QTreeWidget" name="scanResultsWidget" >
+     <property name="editTriggers" >
+      <set>QAbstractItemView::NoEditTriggers</set>
+     </property>
+     <property name="uniformRowHeights" >
+      <bool>true</bool>
+     </property>
+     <property name="sortingEnabled" >
+      <bool>true</bool>
+     </property>
+     <property name="columnCount" >
+      <number>5</number>
+     </property>
+     <column>
+      <property name="text" >
+       <string>SSID</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>BSSID</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>frequency</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>signal</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>flags</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="scanButton" >
+       <property name="text" >
+        <string>Scan</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closeButton" >
+       <property name="text" >
+        <string>Close</string>
+       </property>
+      </widget>
+     </item>
     </layout>
-  </widget>
-  <layoutdefault spacing="6" margin="11" />
-  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
 </ui>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp Fri Dec 28 01:54:44 2007
@@ -95,6 +95,6 @@
 	QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
 		QString::number(networkid) + ':' +
 		queryEdit->text();
-	wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
+	wpagui->ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
 	accept();
 }

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro Fri Dec 28 01:54:44 2007
@@ -48,6 +48,3 @@
   MOC_DIR = .moc
   OBJECTS_DIR = .obj
 }
-
-# TODO: remove need for Qt3 support code
-QT += qt3support

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp Fri Dec 28 01:54:44 2007
@@ -36,7 +36,7 @@
 	connect(helpContentsAction, SIGNAL(activated()), this,
 		SLOT(helpContents()));
 	connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout()));
-	connect(fileExitAction, SIGNAL(activated()), this, SLOT(close()));
+	connect(fileExitAction, SIGNAL(activated()), this, SLOT(exitApp()));
 	connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect()));
 	connect(scanButton, SIGNAL(clicked()), this, SLOT(scan()));
 	connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB()));
@@ -65,7 +65,8 @@
 	textStatus->setText("connecting to wpa_supplicant");
 	timer = new QTimer(this);
 	connect(timer, SIGNAL(timeout()), SLOT(ping()));
-	timer->start(1000, FALSE);
+	timer->setSingleShot(FALSE);
+	timer->start(1000);
 
 	if (openCtrlConnection(ctrl_iface) < 0) {
 		printf("Failed to open control connection to "
@@ -272,8 +273,8 @@
 #endif
 
 	adapterSelect->clear();
-	adapterSelect->insertItem(ctrl_iface);
-	adapterSelect->setCurrentItem(0);
+	adapterSelect->insertItem(-1, ctrl_iface);
+	adapterSelect->setCurrentIndex(0);
 
 	len = sizeof(buf) - 1;
 	if (wpa_ctrl_request(ctrl_conn, "INTERFACES", 10, buf, &len, NULL) >=
@@ -285,7 +286,7 @@
 			if (pos2)
 				*pos2 = '\0';
 			if (strcmp(pos, ctrl_iface) != 0)
-				adapterSelect->insertItem(pos);
+				adapterSelect->insertItem(-1, pos);
 			if (pos2)
 				pos = pos2 + 1;
 			else
@@ -474,10 +475,10 @@
 		QString network(id);
 		network.append(": ");
 		network.append(ssid);
-		networkSelect->insertItem(network);
+		networkSelect->insertItem(-1, network);
 
 		if (strstr(flags, "[CURRENT]")) {
-			networkSelect->setCurrentItem(networkSelect->count() -
+			networkSelect->setCurrentIndex(networkSelect->count() -
 						      1);
 			selected = true;
 		} else if (first_active < 0 &&
@@ -490,7 +491,7 @@
 	}
 
 	if (!selected && first_active >= 0)
-		networkSelect->setCurrentItem(first_active);
+		networkSelect->setCurrentIndex(first_active);
 
 	networkMayHaveChanged = false;
 }
@@ -715,23 +716,25 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	int pos = cmd.find(':');
+	int pos = cmd.indexOf(':');
 	if (pos < 0) {
-		printf("Invalid selectNetwork '%s'\n", cmd.ascii());
+		printf("Invalid selectNetwork '%s'\n",
+		       cmd.toAscii().constData());
 		return;
 	}
 	cmd.truncate(pos);
 	cmd.prepend("SELECT_NETWORK ");
-	ctrlRequest(cmd.ascii(), reply, &reply_len);
+	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
 }
 
 
 void WpaGui::editNetwork()
 {
 	QString sel(networkSelect->currentText());
-	int pos = sel.find(':');
+	int pos = sel.indexOf(':');
 	if (pos < 0) {
-		printf("Invalid selectNetwork '%s'\n", sel.ascii());
+		printf("Invalid selectNetwork '%s'\n",
+		       sel.toAscii().constData());
 		return;
 	}
 	sel.truncate(pos);
@@ -769,9 +772,33 @@
 
 void WpaGui::selectAdapter( const QString & sel )
 {
-	if (openCtrlConnection(sel.ascii()) < 0)
+	if (openCtrlConnection(sel.toAscii().constData()) < 0)
 		printf("Failed to open control connection to "
 		       "wpa_supplicant.\n");
 	updateStatus();
 	updateNetworks();
 }
+
+
+void WpaGui::exitApp()
+{
+	if (eh) {
+		eh->close();
+		delete eh;
+		eh = NULL;
+	}
+
+	if (scanres) {
+		scanres->close();
+		delete scanres;
+		scanres = NULL;
+	}
+
+	if (udr) {
+		udr->close();
+		delete udr;
+		udr = NULL;
+	}
+
+	close();
+}

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h Fri Dec 28 01:54:44 2007
@@ -27,7 +27,7 @@
 
 public:
 	WpaGui(QWidget *parent = 0, const char *name = 0,
-	       Qt::WFlags fl = Qt::WType_TopLevel);
+	       Qt::WFlags fl = 0);
 	~WpaGui();
 
 	virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
@@ -52,6 +52,7 @@
 	virtual void editNetwork();
 	virtual void addNetwork();
 	virtual void selectAdapter(const QString &sel);
+	virtual void exitApp();
 
 protected slots:
 	virtual void languageChange();

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui Fri Dec 28 01:54:44 2007
@@ -211,8 +211,8 @@
       <addaction name="helpMenu" />
     </widget>
     <action name="fileExitAction" >
-      <property name="name" >
-        <cstring>fileExitAction</cstring>
+      <property name="name" stdset="0" >
+        <string>fileExitAction</string>
       </property>
       <property name="iconText" >
         <string>Exit</string>
@@ -225,8 +225,8 @@
       </property>
     </action>
     <action name="helpContentsAction" >
-      <property name="name" >
-        <cstring>helpContentsAction</cstring>
+      <property name="name" stdset="0" >
+        <string>helpContentsAction</string>
       </property>
       <property name="enabled" >
         <bool>false</bool>
@@ -242,8 +242,8 @@
       </property>
     </action>
     <action name="helpIndexAction" >
-      <property name="name" >
-        <cstring>helpIndexAction</cstring>
+      <property name="name" stdset="0" >
+        <string>helpIndexAction</string>
       </property>
       <property name="enabled" >
         <bool>false</bool>
@@ -259,8 +259,8 @@
       </property>
     </action>
     <action name="helpAboutAction" >
-      <property name="name" >
-        <cstring>helpAboutAction</cstring>
+      <property name="name" stdset="0" >
+        <string>helpAboutAction</string>
       </property>
       <property name="iconText" >
         <string>About</string>
@@ -273,8 +273,8 @@
       </property>
     </action>
     <action name="fileEventHistoryAction" >
-      <property name="name" >
-        <cstring>fileEventHistoryAction</cstring>
+      <property name="name" stdset="0" >
+        <string>fileEventHistoryAction</string>
       </property>
       <property name="iconText" >
         <string>Event History</string>
@@ -284,8 +284,8 @@
       </property>
     </action>
     <action name="fileAdd_NetworkAction" >
-      <property name="name" >
-        <cstring>fileAdd_NetworkAction</cstring>
+      <property name="name" stdset="0" >
+        <string>fileAdd_NetworkAction</string>
       </property>
       <property name="iconText" >
         <string>Add Network</string>
@@ -295,8 +295,8 @@
       </property>
     </action>
     <action name="fileEdit_networkAction" >
-      <property name="name" >
-        <cstring>fileEdit_networkAction</cstring>
+      <property name="name" stdset="0" >
+        <string>fileEdit_networkAction</string>
       </property>
       <property name="iconText" >
         <string>Edit Network</string>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui Fri Dec 28 01:54:44 2007
@@ -9,7 +9,7 @@
             <x>0</x>
             <y>0</y>
             <width>380</width>
-            <height>413</height>
+            <height>430</height>
         </rect>
     </property>
     <property name="caption">
@@ -43,7 +43,7 @@
                 </property>
                 <widget class="QLabel" row="0" column="0">
                     <property name="name">
-                        <cstring>textLabel1</cstring>
+                        <cstring>textLabel0</cstring>
                     </property>
                     <property name="text">
                         <string>SSID</string>
@@ -62,13 +62,32 @@
                 </widget>
                 <widget class="QLabel" row="1" column="0">
                     <property name="name">
+                        <cstring>textLabel1</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Network ID</string>
+                    </property>
+                </widget>
+                <widget class="QLineEdit" row="1" column="1">
+                    <property name="name">
+                        <cstring>idstrEdit</cstring>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                    <property name="toolTip" stdset="0">
+                        <string>Network Identification String</string>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="2" column="0">
+                    <property name="name">
                         <cstring>textLabel2</cstring>
                     </property>
                     <property name="text">
                         <string>Authentication</string>
                     </property>
                 </widget>
-                <widget class="QComboBox" row="1" column="1">
+                <widget class="QComboBox" row="2" column="1">
                     <item>
                         <property name="text">
                             <string>Plaintext or static WEP</string>
@@ -103,7 +122,7 @@
                         <cstring>authSelect</cstring>
                     </property>
                 </widget>
-                <widget class="QLabel" row="2" column="0">
+                <widget class="QLabel" row="3" column="0">
                     <property name="name">
                         <cstring>textLabel3</cstring>
                     </property>
@@ -111,7 +130,7 @@
                         <string>Encryption</string>
                     </property>
                 </widget>
-                <widget class="QComboBox" row="2" column="1">
+                <widget class="QComboBox" row="3" column="1">
                     <item>
                         <property name="text">
                             <string>None</string>
@@ -136,7 +155,7 @@
                         <cstring>encrSelect</cstring>
                     </property>
                 </widget>
-                <widget class="QLabel" row="3" column="0">
+                <widget class="QLabel" row="4" column="0">
                     <property name="name">
                         <cstring>textLabel4</cstring>
                     </property>
@@ -144,7 +163,7 @@
                         <string>PSK</string>
                     </property>
                 </widget>
-                <widget class="QLineEdit" row="3" column="1">
+                <widget class="QLineEdit" row="4" column="1">
                     <property name="name">
                         <cstring>pskEdit</cstring>
                     </property>
@@ -161,7 +180,7 @@
                         <string></string>
                     </property>
                 </widget>
-                <widget class="QLabel" row="4" column="0">
+                <widget class="QLabel" row="5" column="0">
                     <property name="name">
                         <cstring>textLabel5</cstring>
                     </property>
@@ -169,7 +188,7 @@
                         <string>EAP method</string>
                     </property>
                 </widget>
-                <widget class="QComboBox" row="4" column="1">
+                <widget class="QComboBox" row="5" column="1">
                     <property name="name">
                         <cstring>eapSelect</cstring>
                     </property>
@@ -177,7 +196,7 @@
                         <bool>false</bool>
                     </property>
                 </widget>
-                <widget class="QLabel" row="5" column="0">
+                <widget class="QLabel" row="6" column="0">
                     <property name="name">
                         <cstring>textLabel6</cstring>
                     </property>
@@ -185,7 +204,7 @@
                         <string>Identity</string>
                     </property>
                 </widget>
-                <widget class="QLineEdit" row="5" column="1">
+                <widget class="QLineEdit" row="6" column="1">
                     <property name="name">
                         <cstring>identityEdit</cstring>
                     </property>
@@ -196,7 +215,7 @@
                         <string>Username/Identity for EAP methods</string>
                     </property>
                 </widget>
-                <widget class="QLabel" row="6" column="0">
+                <widget class="QLabel" row="7" column="0">
                     <property name="name">
                         <cstring>textLabel7</cstring>
                     </property>
@@ -204,7 +223,7 @@
                         <string>Password</string>
                     </property>
                 </widget>
-                <widget class="QLineEdit" row="6" column="1">
+                <widget class="QLineEdit" row="7" column="1">
                     <property name="name">
                         <cstring>passwordEdit</cstring>
                     </property>
@@ -218,7 +237,7 @@
                         <string>Password for EAP methods</string>
                     </property>
                 </widget>
-                <widget class="QLabel" row="7" column="0">
+                <widget class="QLabel" row="8" column="0">
                     <property name="name">
                         <cstring>textLabel1_2</cstring>
                     </property>
@@ -226,7 +245,7 @@
                         <string>CA certificate</string>
                     </property>
                 </widget>
-                <widget class="QLineEdit" row="7" column="1">
+                <widget class="QLineEdit" row="8" column="1">
                     <property name="name">
                         <cstring>cacertEdit</cstring>
                     </property>
@@ -234,7 +253,7 @@
                         <bool>false</bool>
                     </property>
                 </widget>
-                <widget class="QButtonGroup" row="8" column="0" rowspan="1" colspan="2">
+                <widget class="QButtonGroup" row="9" column="0" rowspan="1" colspan="2">
                     <property name="name">
                         <cstring>buttonGroup1</cstring>
                     </property>
@@ -400,6 +419,7 @@
 </connections>
 <tabstops>
     <tabstop>ssidEdit</tabstop>
+    <tabstop>idstrEdit</tabstop>
     <tabstop>authSelect</tabstop>
     <tabstop>encrSelect</tabstop>
     <tabstop>pskEdit</tabstop>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h Fri Dec 28 01:54:44 2007
@@ -131,6 +131,9 @@
 
     setNetworkParam(id, "ssid", ssidEdit->text().ascii(), true);
     
+    if (idstrEdit->isEnabled())
+	setNetworkParam(id, "id_str", idstrEdit->text().ascii(), true);
+
     const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
     switch (auth) {
     case AUTH_NONE:
@@ -315,6 +318,17 @@
 	    *pos = '\0';
 	ssidEdit->setText(reply + 1);
     }
+
+    snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
+    reply_len = sizeof(reply) - 1;
+    if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 2 &&
+	reply[0] == '"') {
+	reply[reply_len] = '\0';
+	pos = strchr(reply + 1, '"');
+	if (pos)
+	    *pos = '\0';
+	idstrEdit->setText(reply + 1);
+    }
     
     snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
     reply_len = sizeof(reply) - 1;

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_priv.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_priv.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_priv.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_priv.c Fri Dec 28 01:54:44 2007
@@ -25,6 +25,7 @@
 #include "drivers/driver.h"
 #include "l2_packet/l2_packet.h"
 #include "privsep_commands.h"
+#include "ieee802_11_defs.h"
 
 #ifndef ETH_P_EAPOL
 #define ETH_P_EAPOL 0x888e
@@ -135,45 +136,163 @@
 }
 
 
-static void wpa_priv_cmd_get_scan_results(struct wpa_priv_interface *iface,
-					  struct sockaddr_un *from,
-					  char *buf, size_t len)
+static void wpa_priv_get_scan_results2(struct wpa_priv_interface *iface,
+				       struct sockaddr_un *from)
+{
+	struct wpa_scan_results *res;
+	u8 *buf = NULL, *pos, *end;
+	int val;
+	size_t i;
+
+	res = iface->driver->get_scan_results2(iface->drv_priv);
+	if (res == NULL)
+		goto fail;
+
+	buf = os_malloc(60000);
+	if (buf == NULL)
+		goto fail;
+	pos = buf;
+	end = buf + 60000;
+	val = res->num;
+	os_memcpy(pos, &val, sizeof(int));
+	pos += sizeof(int);
+
+	for (i = 0; i < res->num; i++) {
+		struct wpa_scan_res *r = res->res[i];
+		val = sizeof(*r) + r->ie_len;
+		if (end - pos < (int) sizeof(int) + val)
+			break;
+		os_memcpy(pos, &val, sizeof(int));
+		pos += sizeof(int);
+		os_memcpy(pos, r, val);
+		pos += val;
+	}
+
+	sendto(iface->fd, buf, pos - buf, 0, (struct sockaddr *) from,
+	       sizeof(*from));
+
+	os_free(buf);
+	os_free(res);
+	return;
+
+fail:
+	os_free(buf);
+	os_free(res);
+	sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
+}
+
+
+static void wpa_priv_send_old_scan_results(struct wpa_priv_interface *iface,
+					   struct sockaddr_un *from)
 {
 #define SCAN_AP_LIMIT 128
-	int max_results, res;
-	struct wpa_scan_result *results;
-
-	if (iface->drv_priv == NULL)
-		goto fail;
-
-	if (iface->driver->get_scan_results == NULL || len != sizeof(int))
-		goto fail;
-
-	os_memcpy(&max_results, buf, sizeof(int));
-	if (max_results < 0)
-		goto fail;
-	if (max_results > SCAN_AP_LIMIT)
-		max_results = SCAN_AP_LIMIT;
-
-	results = os_malloc(max_results * sizeof(*results));
+	int i, res, val;
+	struct wpa_scan_result *results = NULL;
+	u8 *buf = NULL, *pos, *end;
+	struct wpa_scan_res nres;
+
+	results = os_malloc(SCAN_AP_LIMIT * sizeof(*results));
 	if (results == NULL)
 		goto fail;
 
 	res = iface->driver->get_scan_results(iface->drv_priv, results,
-					      max_results);
-	if (res < 0 || res > max_results) {
-		os_free(results);
-		goto fail;
-	}
-
-	sendto(iface->fd, results, res * sizeof(*results), 0,
-	       (struct sockaddr *) from, sizeof(*from));
-
+					      SCAN_AP_LIMIT);
+	if (res < 0 || res > SCAN_AP_LIMIT)
+		goto fail;
+
+	buf = os_malloc(60000);
+	if (buf == NULL)
+		goto fail;
+	pos = buf;
+	end = buf + 60000;
+	os_memcpy(pos, &res, sizeof(int));
+	pos += sizeof(int);
+
+	os_memset(&nres, 0, sizeof(nres));
+	for (i = 0; i < res; i++) {
+		struct wpa_scan_result *r = &results[i];
+		size_t ie_len;
+
+		ie_len = 2 + r->ssid_len + r->rsn_ie_len + r->wpa_ie_len;
+		if (r->maxrate)
+			ie_len += 3;
+		if (r->mdie_present)
+			ie_len += 5;
+
+		val = sizeof(nres) + ie_len;
+		if (end - pos < (int) sizeof(int) + val)
+			break;
+		os_memcpy(pos, &val, sizeof(int));
+		pos += sizeof(int);
+
+		os_memcpy(nres.bssid, r->bssid, ETH_ALEN);
+		nres.freq = r->freq;
+		nres.caps = r->caps;
+		nres.qual = r->qual;
+		nres.noise = r->noise;
+		nres.level = r->level;
+		nres.tsf = r->tsf;
+		nres.ie_len = ie_len;
+
+		os_memcpy(pos, &nres, sizeof(nres));
+		pos += sizeof(nres);
+
+		/* SSID IE */
+		*pos++ = WLAN_EID_SSID;
+		*pos++ = r->ssid_len;
+		os_memcpy(pos, r->ssid, r->ssid_len);
+		pos += r->ssid_len;
+
+		if (r->maxrate) {
+			/* Fake Supported Rate IE to include max rate */
+			*pos++ = WLAN_EID_SUPP_RATES;
+			*pos++ = 1;
+			*pos++ = r->maxrate;
+		}
+
+		if (r->rsn_ie_len) {
+			os_memcpy(pos, r->rsn_ie, r->rsn_ie_len);
+			pos += r->rsn_ie_len;
+		}
+
+		if (r->mdie_present) {
+			os_memcpy(pos, r->mdie, 5);
+			pos += 5;
+		}
+
+		if (r->wpa_ie_len) {
+			os_memcpy(pos, r->wpa_ie, r->wpa_ie_len);
+			pos += r->wpa_ie_len;
+		}
+	}
+
+	sendto(iface->fd, buf, pos - buf, 0, (struct sockaddr *) from,
+	       sizeof(*from));
+
+	os_free(buf);
 	os_free(results);
 	return;
 
 fail:
+	os_free(buf);
+	os_free(results);
 	sendto(iface->fd, "", 0, 0, (struct sockaddr *) from, sizeof(*from));
+}
+
+
+static void wpa_priv_cmd_get_scan_results(struct wpa_priv_interface *iface,
+					  struct sockaddr_un *from)
+{
+	if (iface->drv_priv == NULL)
+		return;
+
+	if (iface->driver->get_scan_results2)
+		wpa_priv_get_scan_results2(iface, from);
+	else if (iface->driver->get_scan_results)
+		wpa_priv_send_old_scan_results(iface, from);
+	else
+		sendto(iface->fd, "", 0, 0, (struct sockaddr *) from,
+		       sizeof(*from));
 }
 
 
@@ -487,7 +606,7 @@
 		wpa_priv_cmd_scan(iface, cmd_buf, cmd_len);
 		break;
 	case PRIVSEP_CMD_GET_SCAN_RESULTS:
-		wpa_priv_cmd_get_scan_results(iface, &from, cmd_buf, cmd_len);
+		wpa_priv_cmd_get_scan_results(iface, &from);
 		break;
 	case PRIVSEP_CMD_ASSOCIATE:
 		wpa_priv_cmd_associate(iface, cmd_buf, cmd_len);

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c Fri Dec 28 01:54:44 2007
@@ -377,9 +377,8 @@
 	wpa_s->wpa = NULL;
 	wpa_blacklist_clear(wpa_s);
 
-	os_free(wpa_s->scan_results);
-	wpa_s->scan_results = NULL;
-	wpa_s->num_scan_results = 0;
+	wpa_scan_results_free(wpa_s->scan_res);
+	wpa_s->scan_res = NULL;
 
 	wpa_supplicant_cancel_scan(wpa_s);
 	wpa_supplicant_cancel_auth_timeout(wpa_s);
@@ -705,22 +704,29 @@
  * available).
  */
 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
-			      struct wpa_scan_result *bss,
+			      struct wpa_scan_res *bss,
 			      struct wpa_ssid *ssid,
 			      u8 *wpa_ie, size_t *wpa_ie_len)
 {
 	struct wpa_ie_data ie;
 	int sel, proto;
-
-	if (bss && bss->rsn_ie_len && (ssid->proto & WPA_PROTO_RSN) &&
-	    wpa_parse_wpa_ie(bss->rsn_ie, bss->rsn_ie_len, &ie) == 0 &&
+	u8 *bss_wpa, *bss_rsn;
+
+	if (bss) {
+		bss_wpa = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+		bss_rsn = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+	} else
+		bss_wpa = bss_rsn = NULL;
+
+	if (bss_rsn && (ssid->proto & WPA_PROTO_RSN) &&
+	    wpa_parse_wpa_ie(bss_rsn, 2 + bss_rsn[1], &ie) == 0 &&
 	    (ie.group_cipher & ssid->group_cipher) &&
 	    (ie.pairwise_cipher & ssid->pairwise_cipher) &&
 	    (ie.key_mgmt & ssid->key_mgmt)) {
 		wpa_msg(wpa_s, MSG_DEBUG, "RSN: using IEEE 802.11i/D9.0");
 		proto = WPA_PROTO_RSN;
-	} else if (bss && bss->wpa_ie_len && (ssid->proto & WPA_PROTO_WPA) &&
-		   wpa_parse_wpa_ie(bss->wpa_ie, bss->wpa_ie_len, &ie) == 0 &&
+	} else if (bss_wpa && (ssid->proto & WPA_PROTO_WPA) &&
+		   wpa_parse_wpa_ie(bss_wpa, 2 +bss_wpa[1], &ie) == 0 &&
 		   (ie.group_cipher & ssid->group_cipher) &&
 		   (ie.pairwise_cipher & ssid->pairwise_cipher) &&
 		   (ie.key_mgmt & ssid->key_mgmt)) {
@@ -764,10 +770,10 @@
 	wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_RSN_ENABLED,
 			 !!(ssid->proto & WPA_PROTO_RSN));
 
-	if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss ? bss->wpa_ie : NULL,
-				 bss ? bss->wpa_ie_len : 0) ||
-	    wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss ? bss->rsn_ie : NULL,
-				 bss ? bss->rsn_ie_len : 0))
+	if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, bss_wpa,
+				 bss_wpa ? 2 + bss_wpa[1] : 0) ||
+	    wpa_sm_set_ap_rsn_ie(wpa_s->wpa, bss_rsn,
+				 bss_rsn ? 2 + bss_rsn[1] : 0))
 		return -1;
 
 	sel = ie.group_cipher & ssid->group_cipher;
@@ -874,8 +880,7 @@
  * This function is used to request %wpa_supplicant to associate with a BSS.
  */
 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
-			      struct wpa_scan_result *bss,
-			      struct wpa_ssid *ssid)
+			      struct wpa_scan_res *bss, struct wpa_ssid *ssid)
 {
 	u8 wpa_ie[80];
 	size_t wpa_ie_len;
@@ -892,15 +897,16 @@
 #ifdef CONFIG_IEEE80211R
 		const u8 *md = NULL;
 #endif /* CONFIG_IEEE80211R */
+		u8 *ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
 		wpa_msg(wpa_s, MSG_INFO, "Trying to associate with " MACSTR
 			" (SSID='%s' freq=%d MHz)", MAC2STR(bss->bssid),
-			wpa_ssid_txt(bss->ssid, bss->ssid_len), bss->freq);
+			ie ? wpa_ssid_txt(ie + 2, ie[1]) : "", bss->freq);
 		os_memset(wpa_s->bssid, 0, ETH_ALEN);
 		os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
 #ifdef CONFIG_IEEE80211R
-		if (bss->mdie_present &&
-		    bss->mdie[1] >= MOBILITY_DOMAIN_ID_LEN)
-			md = bss->mdie + 2;
+		ie = wpa_scan_get_ie(bss, WLAN_EID_MOBILITY_DOMAIN);
+		if (ie && ie[1] >= MOBILITY_DOMAIN_ID_LEN)
+			md = ie + 2;
 		wpa_sm_set_ft_params(wpa_s->wpa, md, NULL, 0, NULL);
 #endif /* CONFIG_IEEE80211R */
 	} else {
@@ -938,7 +944,8 @@
 	}
 	wpa_drv_set_auth_alg(wpa_s, algs);
 
-	if (bss && (bss->wpa_ie_len || bss->rsn_ie_len) &&
+	if (bss && (wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
+		    wpa_scan_get_ie(bss, WLAN_EID_RSN)) &&
 	    (ssid->key_mgmt & (WPA_KEY_MGMT_IEEE8021X | WPA_KEY_MGMT_PSK |
 			       WPA_KEY_MGMT_FT_IEEE8021X |
 			       WPA_KEY_MGMT_FT_PSK))) {
@@ -1012,9 +1019,10 @@
 	wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);
 	os_memset(&params, 0, sizeof(params));
 	if (bss) {
+		u8 *ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
 		params.bssid = bss->bssid;
-		params.ssid = bss->ssid;
-		params.ssid_len = bss->ssid_len;
+		params.ssid = ie ? ie + 2 : (u8 *) "";
+		params.ssid_len = ie ? ie[1] : 0;
 		params.freq = bss->freq;
 	} else {
 		params.ssid = ssid->ssid;
@@ -1168,19 +1176,12 @@
 }
 
 
-/**
- * wpa_supplicant_get_scan_results - Get scan results
- * @wpa_s: Pointer to wpa_supplicant data
- * Returns: 0 on success, -1 on failure
- *
- * This function is request the current scan results from the driver and stores
- * a local copy of the results in wpa_s->scan_results.
- */
-int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s)
+static int wpa_supplicant_get_scan_results_old(struct wpa_supplicant *wpa_s)
 {
 #define SCAN_AP_LIMIT 128
-	struct wpa_scan_result *results, *tmp;
-	int num;
+	struct wpa_scan_result *results;
+	int num, i;
+	struct wpa_scan_results *res;
 
 	results = os_malloc(SCAN_AP_LIMIT * sizeof(struct wpa_scan_result));
 	if (results == NULL) {
@@ -1206,15 +1207,106 @@
 		num = SCAN_AP_LIMIT;
 	}
 
-	/* Free unneeded memory for unused scan result entries */
-	tmp = os_realloc(results, num * sizeof(struct wpa_scan_result));
-	if (tmp || num == 0) {
-		results = tmp;
-	}
-
-	os_free(wpa_s->scan_results);
-	wpa_s->scan_results = results;
-	wpa_s->num_scan_results = num;
+	wpa_scan_results_free(wpa_s->scan_res);
+	wpa_s->scan_res = NULL;
+
+	/* Convert old scan result data structure to the new one */
+	res = os_zalloc(sizeof(*res));
+	if (res == NULL) {
+		os_free(results);
+		return -1;
+	}
+	res->res = os_zalloc(num * sizeof(struct wpa_scan_res *));
+	if (res->res == NULL) {
+		os_free(results);
+		os_free(res);
+		return -1;
+	}
+
+	for (i = 0; i < num; i++) {
+		struct wpa_scan_result *bss = &results[i];
+		struct wpa_scan_res *r;
+		size_t ie_len;
+		u8 *pos;
+
+		ie_len = 2 + bss->ssid_len + bss->rsn_ie_len + bss->wpa_ie_len;
+		if (bss->maxrate)
+			ie_len += 3;
+		if (bss->mdie_present)
+			ie_len += 5;
+
+		r = os_zalloc(sizeof(*r) + ie_len);
+		if (r == NULL)
+			break;
+
+		os_memcpy(r->bssid, bss->bssid, ETH_ALEN);
+		r->freq = bss->freq;
+		r->caps = bss->caps;
+		r->qual = bss->qual;
+		r->noise = bss->noise;
+		r->level = bss->level;
+		r->tsf = bss->tsf;
+		r->ie_len = ie_len;
+
+		pos = (u8 *) (r + 1);
+
+		/* SSID IE */
+		*pos++ = WLAN_EID_SSID;
+		*pos++ = bss->ssid_len;
+		os_memcpy(pos, bss->ssid, bss->ssid_len);
+		pos += bss->ssid_len;
+
+		if (bss->maxrate) {
+			/* Fake Supported Rate IE to include max rate */
+			*pos++ = WLAN_EID_SUPP_RATES;
+			*pos++ = 1;
+			*pos++ = bss->maxrate;
+		}
+
+		if (bss->rsn_ie_len) {
+			os_memcpy(pos, bss->rsn_ie, bss->rsn_ie_len);
+			pos += bss->rsn_ie_len;
+		}
+
+		if (bss->mdie_present) {
+			os_memcpy(pos, bss->mdie, 5);
+			pos += 5;
+		}
+
+		if (bss->wpa_ie_len) {
+			os_memcpy(pos, bss->wpa_ie, bss->wpa_ie_len);
+			pos += bss->wpa_ie_len;
+		}
+
+		res->res[res->num++] = r;
+	}
+
+	os_free(results);
+	wpa_s->scan_res = res;
+
+	return 0;
+}
+
+
+/**
+ * wpa_supplicant_get_scan_results - Get scan results
+ * @wpa_s: Pointer to wpa_supplicant data
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function is request the current scan results from the driver and stores
+ * a local copy of the results in wpa_s->scan_res.
+ */
+int wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->use_client_mlme || wpa_s->driver->get_scan_results2 == NULL)
+		return wpa_supplicant_get_scan_results_old(wpa_s);
+
+	wpa_scan_results_free(wpa_s->scan_res);
+	wpa_s->scan_res = wpa_drv_get_scan_results2(wpa_s);
+	if (wpa_s->scan_res == NULL) {
+		wpa_printf(MSG_DEBUG, "Failed to get scan results");
+		return -1;
+	}
 
 	return 0;
 }

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h Fri Dec 28 01:54:44 2007
@@ -307,8 +307,7 @@
 					  */
 #define BROADCAST_SSID_SCAN ((struct wpa_ssid *) 1)
 
-	struct wpa_scan_result *scan_results;
-	int num_scan_results;
+	struct wpa_scan_results *scan_res;
 
 	struct wpa_driver_ops *driver;
 	int interface_removed; /* whether the network interface has been
@@ -353,11 +352,11 @@
 int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
 			       int wait_for_interface);
 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
-			      struct wpa_scan_result *bss,
+			      struct wpa_scan_res *bss,
 			      struct wpa_ssid *ssid,
 			      u8 *wpa_ie, size_t *wpa_ie_len);
 void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
-			      struct wpa_scan_result *bss,
+			      struct wpa_scan_res *bss,
 			      struct wpa_ssid *ssid);
 void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
 				       struct wpa_ssid *ssid);
@@ -487,6 +486,14 @@
 	return -1;
 }
 
+static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
+	struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->get_scan_results2)
+		return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
+	return NULL;
+}
+
 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
 {
 	if (wpa_s->driver->get_bssid) {

Modified: wpasupplicant/trunk/wpa_supplicant/wpas_glue.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpas_glue.c?rev=963&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpas_glue.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpas_glue.c Fri Dec 28 01:54:44 2007
@@ -24,6 +24,7 @@
 #include "wpa_supplicant_i.h"
 #include "pmksa_cache.h"
 #include "mlme.h"
+#include "ieee802_11_defs.h"
 #include "wpas_glue.h"
 
 
@@ -282,33 +283,36 @@
 
 static int wpa_get_beacon_ie(struct wpa_supplicant *wpa_s)
 {
-	int i, ret = 0;
-	struct wpa_scan_result *results, *curr = NULL;
-
-	results = wpa_s->scan_results;
-	if (results == NULL) {
-		return -1;
-	}
-
-	for (i = 0; i < wpa_s->num_scan_results; i++) {
-		struct wpa_ssid *ssid = wpa_s->current_ssid;
-		if (os_memcmp(results[i].bssid, wpa_s->bssid, ETH_ALEN) != 0)
+	size_t i;
+	int ret = 0;
+	struct wpa_scan_res *curr = NULL;
+	struct wpa_ssid *ssid = wpa_s->current_ssid;
+	u8 *ie;
+
+	if (wpa_s->scan_res == NULL)
+		return -1;
+
+	for (i = 0; i < wpa_s->scan_res->num; i++) {
+		struct wpa_scan_res *r = wpa_s->scan_res->res[i];
+		if (os_memcmp(r->bssid, wpa_s->bssid, ETH_ALEN) != 0)
 			continue;
+		ie = wpa_scan_get_ie(r, WLAN_EID_SSID);
 		if (ssid == NULL ||
-		    ((results[i].ssid_len == ssid->ssid_len &&
-		      os_memcmp(results[i].ssid, ssid->ssid, ssid->ssid_len)
-		      == 0) ||
+		    ((ie && ie[1] == ssid->ssid_len &&
+		      os_memcmp(ie + 2, ssid->ssid, ssid->ssid_len) == 0) ||
 		     ssid->ssid_len == 0)) {
-			curr = &results[i];
+			curr = r;
 			break;
 		}
 	}
 
 	if (curr) {
-		if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, curr->wpa_ie,
-					 curr->wpa_ie_len) ||
-		    wpa_sm_set_ap_rsn_ie(wpa_s->wpa, curr->rsn_ie,
-					 curr->rsn_ie_len))
+		ie = wpa_scan_get_vendor_ie(curr, WPA_IE_VENDOR_TYPE);
+		if (wpa_sm_set_ap_wpa_ie(wpa_s->wpa, ie, ie ? 2 + ie[1] : 0))
+			ret = -1;
+
+		ie = wpa_scan_get_ie(curr, WLAN_EID_RSN);
+		if (wpa_sm_set_ap_rsn_ie(wpa_s->wpa, ie, ie ? 2 + ie[1] : 0))
 			ret = -1;
 	} else {
 		ret = -1;




More information about the Pkg-wpa-devel mailing list