[pkg-wpa-devel] r1554 - in /wpasupplicant/trunk: debian/ debian/patches/ src/ap/ src/common/ src/crypto/ src/drivers/ src/eap_peer/ src/eap_server/ src/l2_packet/ src/rsn_supp/ src/tls/ src/utils/ src/wps/ wpa_supplicant/ wpa_supplicant/dbus/ wpa_supplicant/doc/docbook/ wpa_supplicant/wpa_gui-qt4/

slh-guest at users.alioth.debian.org slh-guest at users.alioth.debian.org
Wed Sep 8 01:19:48 UTC 2010


Author: slh-guest
Date: Wed Sep  8 01:19:36 2010
New Revision: 1554

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1554
Log:
* Add myself to uploaders.
* Bump policy version to 3.9.1, no changes necessary
* Bump compat level to 8 and debhelper build-depends to >= 7.9.3~ 
  accordingly, retaining backportability for squeeze (plain lenny isn't an
  option due to simplified dh7 usage).
* Refresh patch series and merge with new upstream (0.7.3).
* Drop patches applied upstream:
  - patches/10_wpa_gui_qt4_network_id_qregexp.patch
  - patches/11_wpa_supplicant_enable_network_tweak.patch

Removed:
    wpasupplicant/trunk/debian/patches/10_wpa_gui_qt4_network_id_qregexp.patch
    wpasupplicant/trunk/debian/patches/11_wpa_supplicant_enable_network_tweak.patch
Modified:
    wpasupplicant/trunk/debian/changelog
    wpasupplicant/trunk/debian/compat
    wpasupplicant/trunk/debian/control
    wpasupplicant/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch
    wpasupplicant/trunk/debian/patches/series
    wpasupplicant/trunk/src/ap/ap_config.c
    wpasupplicant/trunk/src/ap/beacon.c
    wpasupplicant/trunk/src/ap/hostapd.c
    wpasupplicant/trunk/src/ap/hostapd.h
    wpasupplicant/trunk/src/ap/ieee802_11.c
    wpasupplicant/trunk/src/ap/ieee802_11.h
    wpasupplicant/trunk/src/ap/ieee802_11_ht.c
    wpasupplicant/trunk/src/ap/ieee802_1x.c
    wpasupplicant/trunk/src/ap/wpa_auth.c
    wpasupplicant/trunk/src/ap/wpa_auth_ft.c
    wpasupplicant/trunk/src/ap/wpa_auth_glue.c
    wpasupplicant/trunk/src/ap/wps_hostapd.c
    wpasupplicant/trunk/src/ap/wps_hostapd.h
    wpasupplicant/trunk/src/common/version.h
    wpasupplicant/trunk/src/common/wpa_ctrl.h
    wpasupplicant/trunk/src/crypto/crypto_openssl.c
    wpasupplicant/trunk/src/drivers/driver_atheros.c
    wpasupplicant/trunk/src/drivers/driver_nl80211.c
    wpasupplicant/trunk/src/eap_peer/eap_wsc.c
    wpasupplicant/trunk/src/eap_server/eap_server_fast.c
    wpasupplicant/trunk/src/eap_server/eap_server_wsc.c
    wpasupplicant/trunk/src/l2_packet/l2_packet_ndis.c
    wpasupplicant/trunk/src/rsn_supp/preauth.c
    wpasupplicant/trunk/src/rsn_supp/wpa.c
    wpasupplicant/trunk/src/tls/x509v3.c
    wpasupplicant/trunk/src/tls/x509v3.h
    wpasupplicant/trunk/src/utils/eloop.c
    wpasupplicant/trunk/src/utils/os_unix.c
    wpasupplicant/trunk/src/wps/wps.c
    wpasupplicant/trunk/src/wps/wps.h
    wpasupplicant/trunk/src/wps/wps_attr_build.c
    wpasupplicant/trunk/src/wps/wps_attr_parse.c
    wpasupplicant/trunk/src/wps/wps_attr_process.c
    wpasupplicant/trunk/src/wps/wps_defs.h
    wpasupplicant/trunk/src/wps/wps_enrollee.c
    wpasupplicant/trunk/src/wps/wps_er.c
    wpasupplicant/trunk/src/wps/wps_er.h
    wpasupplicant/trunk/src/wps/wps_i.h
    wpasupplicant/trunk/src/wps/wps_registrar.c
    wpasupplicant/trunk/src/wps/wps_upnp.c
    wpasupplicant/trunk/src/wps/wps_upnp.h
    wpasupplicant/trunk/src/wps/wps_upnp_web.c
    wpasupplicant/trunk/wpa_supplicant/ChangeLog
    wpasupplicant/trunk/wpa_supplicant/Makefile
    wpasupplicant/trunk/wpa_supplicant/bgscan_simple.c
    wpasupplicant/trunk/wpa_supplicant/config_winreg.c
    wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new.c
    wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new_handlers.c
    wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old.c
    wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old_handlers.c
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_background.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_cli.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_gui.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_passphrase.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.8
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5
    wpasupplicant/trunk/wpa_supplicant/events.c
    wpasupplicant/trunk/wpa_supplicant/scan.c
    wpasupplicant/trunk/wpa_supplicant/sme.c
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.nsi
    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=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Wed Sep  8 01:19:36 2010
@@ -1,5 +1,6 @@
-wpasupplicant (0.7.2-1) UNRELEASED; urgency=low
-
+wpasupplicant (0.7.3-1) UNRELEASED; urgency=low
+
+  [ Kel Modderman ]
   * New upstream release.
     - nl80211 driver interface doesn't use WEXT compat layer
       (Closes: #570688)
@@ -20,22 +21,27 @@
   * Set default driver type to nl80211,wext in ifupdown glue.
   * Remove duplicate handling of wpa-mode in ifupdown/functions.sh.
   * Add support for scan_freq and freq_list in ifupdown/functions.sh.
-  * Add 10_wpa_gui_qt4_network_id_qregexp.patch which replaces wpa_gui-
-    qt4's string comparison of 'Select any network' with regular
-    expression matching of '^\d+:' for functions which need to get the
-    network id number.
   * Install pm-utils action script to notify wpa_supplicant of susepnd
     and resume events.
   * Remove pm-utils stuff from debian/ifupdown/action_wpa.sh.
-  * Add 11_wpa_supplicant_enable_network_tweak.patch to fix semantics of
-    enable_network command.
   * Remove sleep loops which wait for creation of interface specific
     control sockets, these are now created before the process is
     backgrounded (http://w1.fi/bugz/show_bug.cgi?id=283).
   * After a disconnected event, attempt to reassociate to a network
     when using wpa-roam.
 
- -- Kel Modderman <kel at otaku42.de>  Sun, 02 May 2010 18:40:49 +1000
+  [ Stefan Lippers-Hollmann ]
+  * Add myself to uploaders.
+  * Bump policy version to 3.9.1, no changes necessary
+  * Bump compat level to 8 and debhelper build-depends to >= 7.9.3~ 
+    accordingly, retaining backportability for squeeze (plain lenny isn't an
+    option due to simplified dh7 usage).
+  * Refresh patch series and merge with new upstream (0.7.3).
+  * Drop patches applied upstream:
+    - patches/10_wpa_gui_qt4_network_id_qregexp.patch
+    - patches/11_wpa_supplicant_enable_network_tweak.patch
+
+ -- Stefan Lippers-Hollmann <s.l-h at gmx.de>  Wed, 08 Sep 2010 03:17:44 +0200
 
 wpasupplicant (0.6.10-2) unstable; urgency=low
 

Modified: wpasupplicant/trunk/debian/compat
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/compat?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/compat (original)
+++ wpasupplicant/trunk/debian/compat Wed Sep  8 01:19:36 2010
@@ -1,1 +1,1 @@
-6
+8

Modified: wpasupplicant/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/control?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/control (original)
+++ wpasupplicant/trunk/debian/control Wed Sep  8 01:19:36 2010
@@ -2,8 +2,9 @@
 Section: net
 Priority: optional
 Maintainer: Debian/Ubuntu wpasupplicant Maintainers <pkg-wpa-devel at lists.alioth.debian.org>
-Uploaders: Kel Modderman <kel at otaku42.de>
-Build-Depends: debhelper (>= 7.4.12~),
+Uploaders: Kel Modderman <kel at otaku42.de>,
+ Stefan Lippers-Hollmann <s.l-h at gmx.de>
+Build-Depends: debhelper (>= 7.9.3~),
  libdbus-glib-1-dev,
  libssl-dev,
  libpcsclite-dev,
@@ -16,7 +17,7 @@
  pkg-config,
  qt4-qmake
 Build-Conflicts: libqt3-dev
-Standards-Version: 3.8.4
+Standards-Version: 3.9.1
 Vcs-Svn: svn://svn.debian.org/pkg-wpa/wpasupplicant/trunk
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/
 Homepage: http://w1.fi/wpa_supplicant/

Modified: wpasupplicant/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch (original)
+++ wpasupplicant/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch Wed Sep  8 01:19:36 2010
@@ -6,7 +6,7 @@
 
 --- a/wpa_supplicant/Makefile
 +++ b/wpa_supplicant/Makefile
-@@ -687,7 +687,7 @@ ifdef CONFIG_NATIVE_WINDOWS
+@@ -691,7 +691,7 @@ ifdef CONFIG_NATIVE_WINDOWS
  #dynamic symbol loading that is now used in pcsc_funcs.c
  #LIBS += -lwinscard
  else

Modified: wpasupplicant/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/patches/series?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/patches/series (original)
+++ wpasupplicant/trunk/debian/patches/series Wed Sep  8 01:19:36 2010
@@ -2,5 +2,3 @@
 02_dbus_group_policy.patch
 06_wpa_gui_menu_exec_path.patch
 07_dbus_service_syslog.patch
-10_wpa_gui_qt4_network_id_qregexp.patch
-11_wpa_supplicant_enable_network_tweak.patch

Modified: wpasupplicant/trunk/src/ap/ap_config.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/ap_config.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/ap_config.c (original)
+++ wpasupplicant/trunk/src/ap/ap_config.c Wed Sep  8 01:19:36 2010
@@ -354,6 +354,7 @@
 
 	os_free(conf->ssid.wpa_passphrase);
 	os_free(conf->ssid.wpa_psk_file);
+	hostapd_config_free_wep(&conf->ssid.wep);
 #ifdef CONFIG_FULL_DYNAMIC_VLAN
 	os_free(conf->ssid.vlan_tagged_interface);
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
@@ -566,15 +567,15 @@
 		return &wsc_enrollee;
 	}
 
-	if (conf->wps_state && conf->ap_pin &&
-	    identity_len == WSC_ID_REGISTRAR_LEN &&
+	if (conf->wps_state && identity_len == WSC_ID_REGISTRAR_LEN &&
 	    os_memcmp(identity, WSC_ID_REGISTRAR, WSC_ID_REGISTRAR_LEN) == 0) {
 		static struct hostapd_eap_user wsc_registrar;
 		os_memset(&wsc_registrar, 0, sizeof(wsc_registrar));
 		wsc_registrar.methods[0].method = eap_server_get_type(
 			"WSC", &wsc_registrar.methods[0].vendor);
 		wsc_registrar.password = (u8 *) conf->ap_pin;
-		wsc_registrar.password_len = os_strlen(conf->ap_pin);
+		wsc_registrar.password_len = conf->ap_pin ?
+			os_strlen(conf->ap_pin) : 0;
 		return &wsc_registrar;
 	}
 #endif /* CONFIG_WPS */

Modified: wpasupplicant/trunk/src/ap/beacon.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/beacon.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/beacon.c (original)
+++ wpasupplicant/trunk/src/ap/beacon.c Wed Sep  8 01:19:36 2010
@@ -57,7 +57,8 @@
 		}
 		break;
 	}
-	if (hapd->iface->num_sta_no_short_preamble > 0)
+	if (hapd->iface->num_sta_no_short_preamble > 0 ||
+	    hapd->iconf->preamble == LONG_PREAMBLE)
 		erp |= ERP_INFO_BARKER_PREAMBLE_MODE;
 
 	return erp;
@@ -308,15 +309,16 @@
 	/* Extended supported rates */
 	pos = hostapd_eid_ext_supp_rates(hapd, pos);
 
+	/* RSN, MDIE, WPA */
 	pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
-
-	/* Wi-Fi Alliance WMM */
-	pos = hostapd_eid_wmm(hapd, pos);
 
 #ifdef CONFIG_IEEE80211N
 	pos = hostapd_eid_ht_capabilities(hapd, pos);
 	pos = hostapd_eid_ht_operation(hapd, pos);
 #endif /* CONFIG_IEEE80211N */
+
+	/* Wi-Fi Alliance WMM */
+	pos = hostapd_eid_wmm(hapd, pos);
 
 #ifdef CONFIG_WPS
 	if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) {
@@ -408,16 +410,17 @@
 	/* Extended supported rates */
 	tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
 
+	/* RSN, MDIE, WPA */
 	tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
 				  tailpos, NULL);
-
-	/* Wi-Fi Alliance WMM */
-	tailpos = hostapd_eid_wmm(hapd, tailpos);
 
 #ifdef CONFIG_IEEE80211N
 	tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
 	tailpos = hostapd_eid_ht_operation(hapd, tailpos);
 #endif /* CONFIG_IEEE80211N */
+
+	/* Wi-Fi Alliance WMM */
+	tailpos = hostapd_eid_wmm(hapd, tailpos);
 
 #ifdef CONFIG_WPS
 	if (hapd->conf->wps_state && hapd->wps_beacon_ie) {

Modified: wpasupplicant/trunk/src/ap/hostapd.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/hostapd.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/hostapd.c (original)
+++ wpasupplicant/trunk/src/ap/hostapd.c Wed Sep  8 01:19:36 2010
@@ -78,6 +78,11 @@
 			   "after reloading configuration");
 	}
 
+	if (hapd->conf->ieee802_1x || hapd->conf->wpa)
+		hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
+	else
+		hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
+
 	if (hapd->conf->wpa && hapd->wpa_auth == NULL)
 		hostapd_setup_wpa(hapd);
 	else if (hapd->conf->wpa) {
@@ -97,6 +102,7 @@
 	}
 
 	ieee802_11_set_beacon(hapd);
+	hostapd_update_wps(hapd);
 
 	if (hapd->conf->ssid.ssid_set &&
 	    hostapd_set_ssid(hapd, (u8 *) hapd->conf->ssid.ssid,
@@ -104,11 +110,6 @@
 		wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
 		/* try to continue */
 	}
-
-	if (hapd->conf->ieee802_1x || hapd->conf->wpa)
-		hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
-	else
-		hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
 
 	hostapd_config_free(oldconf);
 

Modified: wpasupplicant/trunk/src/ap/hostapd.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/hostapd.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/hostapd.h (original)
+++ wpasupplicant/trunk/src/ap/hostapd.h Wed Sep  8 01:19:36 2010
@@ -167,6 +167,7 @@
 #ifdef CONFIG_WPS
 	unsigned int ap_pin_failures;
 	struct upnp_wps_device_sm *wps_upnp;
+	unsigned int ap_pin_lockout_time;
 #endif /* CONFIG_WPS */
 
 	struct hostapd_probereq_cb *probereq_cb;

Modified: wpasupplicant/trunk/src/ap/ieee802_11.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/ieee802_11.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/ieee802_11.c (original)
+++ wpasupplicant/trunk/src/ap/ieee802_11.c Wed Sep  8 01:19:36 2010
@@ -25,6 +25,7 @@
 #include "common/wpa_ctrl.h"
 #include "radius/radius.h"
 #include "radius/radius_client.h"
+#include "wps/wps.h"
 #include "hostapd.h"
 #include "beacon.h"
 #include "ieee802_11_auth.h"
@@ -187,33 +188,6 @@
 			buf[i] = '.';
 	}
 	buf[len] = '\0';
-}
-
-
-/**
- * ieee802_11_send_deauth - Send Deauthentication frame
- * @hapd: hostapd BSS data
- * @addr: Address of the destination STA
- * @reason: Reason code for Deauthentication
- */
-void ieee802_11_send_deauth(struct hostapd_data *hapd, const u8 *addr,
-			    u16 reason)
-{
-	struct ieee80211_mgmt mgmt;
-
-	hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
-		       HOSTAPD_LEVEL_DEBUG,
-		       "deauthenticate - reason %d", reason);
-	os_memset(&mgmt, 0, sizeof(mgmt));
-	mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
-					  WLAN_FC_STYPE_DEAUTH);
-	os_memcpy(mgmt.da, addr, ETH_ALEN);
-	os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
-	os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
-	mgmt.u.deauth.reason_code = host_to_le16(reason);
-	if (hapd->drv.send_mgmt_frame(hapd, &mgmt, IEEE80211_HDRLEN +
-				       sizeof(mgmt.u.deauth)) < 0)
-		perror("ieee802_11_send_deauth: send");
 }
 
 
@@ -686,8 +660,8 @@
 			   "Request - assume WPS is used");
 		sta->flags |= WLAN_STA_WPS;
 		wpabuf_free(sta->wps_ie);
-		sta->wps_ie = wpabuf_alloc_copy(elems.wps_ie + 4,
-						elems.wps_ie_len - 4);
+		sta->wps_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
+							  WPS_IE_VENDOR_TYPE);
 		wpa_ie = NULL;
 		wpa_ie_len = 0;
 	} else if (hapd->conf->wps_state && wpa_ie == NULL) {
@@ -850,13 +824,6 @@
 	p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable);
 	/* Extended supported rates */
 	p = hostapd_eid_ext_supp_rates(hapd, p);
-	if (sta->flags & WLAN_STA_WMM)
-		p = hostapd_eid_wmm(hapd, p);
-
-#ifdef CONFIG_IEEE80211N
-	p = hostapd_eid_ht_capabilities(hapd, p);
-	p = hostapd_eid_ht_operation(hapd, p);
-#endif /* CONFIG_IEEE80211N */
 
 #ifdef CONFIG_IEEE80211R
 	if (status_code == WLAN_STATUS_SUCCESS) {
@@ -872,6 +839,25 @@
 	if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY)
 		p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
 #endif /* CONFIG_IEEE80211W */
+
+#ifdef CONFIG_IEEE80211N
+	p = hostapd_eid_ht_capabilities(hapd, p);
+	p = hostapd_eid_ht_operation(hapd, p);
+#endif /* CONFIG_IEEE80211N */
+
+	if (sta->flags & WLAN_STA_WMM)
+		p = hostapd_eid_wmm(hapd, p);
+
+#ifdef CONFIG_WPS
+	if (sta->flags & WLAN_STA_WPS) {
+		struct wpabuf *wps = wps_build_assoc_resp_ie();
+		if (wps) {
+			os_memcpy(p, wpabuf_head(wps), wpabuf_len(wps));
+			p += wpabuf_len(wps);
+			wpabuf_free(wps);
+		}
+	}
+#endif /* CONFIG_WPS */
 
 	send_len += p - reply->u.assoc_resp.variable;
 

Modified: wpasupplicant/trunk/src/ap/ieee802_11.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/ieee802_11.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/ieee802_11.h (original)
+++ wpasupplicant/trunk/src/ap/ieee802_11.h Wed Sep  8 01:19:36 2010
@@ -21,8 +21,6 @@
 struct hostapd_frame_info;
 struct ieee80211_ht_capabilities;
 
-void ieee802_11_send_deauth(struct hostapd_data *hapd, const u8 *addr,
-			    u16 reason);
 void ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
 		     struct hostapd_frame_info *fi);
 void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,

Modified: wpasupplicant/trunk/src/ap/ieee802_11_ht.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/ieee802_11_ht.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/ieee802_11_ht.c (original)
+++ wpasupplicant/trunk/src/ap/ieee802_11_ht.c Wed Sep  8 01:19:36 2010
@@ -30,7 +30,7 @@
 	struct ieee80211_ht_capabilities *cap;
 	u8 *pos = eid;
 
-	if (!hapd->iconf->ieee80211n)
+	if (!hapd->iconf->ieee80211n || !hapd->iface->current_mode)
 		return eid;
 
 	*pos++ = WLAN_EID_HT_CAP;
@@ -256,7 +256,15 @@
 	cap &= hapd->iconf->ht_capab;
 	cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_DISABLED);
 
-	/* FIXME: Rx STBC needs to be handled specially */
-	cap |= (hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK);
+	/*
+	 * STBC needs to be handled specially
+	 * if we don't support RX STBC, mask out TX STBC in the STA's HT caps
+	 * if we don't support TX STBC, mask out RX STBC in the STA's HT caps
+	 */
+	if (!(hapd->iconf->ht_capab & HT_CAP_INFO_RX_STBC_MASK))
+		cap &= ~HT_CAP_INFO_TX_STBC;
+	if (!(hapd->iconf->ht_capab & HT_CAP_INFO_TX_STBC))
+		cap &= ~HT_CAP_INFO_RX_STBC_MASK;
+
 	neg_ht_cap->ht_capabilities_info = host_to_le16(cap);
 }

Modified: wpasupplicant/trunk/src/ap/ieee802_1x.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/ieee802_1x.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/ieee802_1x.c (original)
+++ wpasupplicant/trunk/src/ap/ieee802_1x.c Wed Sep  8 01:19:36 2010
@@ -23,6 +23,7 @@
 #include "radius/radius.h"
 #include "radius/radius_client.h"
 #include "eap_server/eap.h"
+#include "eap_common/eap_wsc_common.h"
 #include "eapol_auth/eapol_auth_sm.h"
 #include "eapol_auth/eapol_auth_sm_i.h"
 #include "hostapd.h"
@@ -646,8 +647,7 @@
 	if (sta->flags & WLAN_STA_PREAUTH)
 		flags |= EAPOL_SM_PREAUTH;
 	if (sta->wpa_sm) {
-		if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
-			flags |= EAPOL_SM_USES_WPA;
+		flags |= EAPOL_SM_USES_WPA;
 		if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
 			flags |= EAPOL_SM_FROM_PMKSA_CACHE;
 	}
@@ -1456,6 +1456,30 @@
 static void ieee802_1x_eapol_send(void *ctx, void *sta_ctx, u8 type,
 				  const u8 *data, size_t datalen)
 {
+#ifdef CONFIG_WPS
+	struct sta_info *sta = sta_ctx;
+
+	if ((sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS)) ==
+	    WLAN_STA_MAYBE_WPS) {
+		const u8 *identity;
+		size_t identity_len;
+		struct eapol_state_machine *sm = sta->eapol_sm;
+
+		identity = eap_get_identity(sm->eap, &identity_len);
+		if (identity &&
+		    ((identity_len == WSC_ID_ENROLLEE_LEN &&
+		      os_memcmp(identity, WSC_ID_ENROLLEE,
+				WSC_ID_ENROLLEE_LEN) == 0) ||
+		     (identity_len == WSC_ID_REGISTRAR_LEN &&
+		      os_memcmp(identity, WSC_ID_REGISTRAR,
+				WSC_ID_REGISTRAR_LEN) == 0))) {
+			wpa_printf(MSG_DEBUG, "WPS: WLAN_STA_MAYBE_WPS -> "
+				   "WLAN_STA_WPS");
+			sta->flags |= WLAN_STA_WPS;
+		}
+	}
+#endif /* CONFIG_WPS */
+
 	ieee802_1x_send(ctx, sta_ctx, type, data, datalen);
 }
 
@@ -1979,4 +2003,23 @@
 			       HOSTAPD_LEVEL_DEBUG,
 			       "Added PMKSA cache entry (IEEE 802.1X)");
 	}
-}
+
+#ifdef CONFIG_WPS
+	if (!success && (sta->flags & WLAN_STA_WPS)) {
+		/*
+		 * Many devices require deauthentication after WPS provisioning
+		 * and some may not be be able to do that themselves, so
+		 * disconnect the client here.
+		 */
+		wpa_printf(MSG_DEBUG, "WPS: Force disconnection after "
+			   "EAP-Failure");
+		/* Add a small sleep to increase likelihood of previously
+		 * requested EAP-Failure TX getting out before this should the
+		 * driver reorder operations.
+		 */
+		os_sleep(0, 10000);
+		ap_sta_disconnect(hapd, sta, sta->addr,
+				  WLAN_REASON_PREV_AUTH_NOT_VALID);
+	}
+#endif /* CONFIG_WPS */
+}

Modified: wpasupplicant/trunk/src/ap/wpa_auth.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/wpa_auth.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/wpa_auth.c (original)
+++ wpasupplicant/trunk/src/ap/wpa_auth.c Wed Sep  8 01:19:36 2010
@@ -1274,6 +1274,24 @@
 		break;
 	case WPA_REAUTH:
 	case WPA_REAUTH_EAPOL:
+		if (!sm->started) {
+			/*
+			 * When using WPS, we may end up here if the STA
+			 * manages to re-associate without the previous STA
+			 * entry getting removed. Consequently, we need to make
+			 * sure that the WPA state machines gets initialized
+			 * properly at this point.
+			 */
+			wpa_printf(MSG_DEBUG, "WPA state machine had not been "
+				   "started - initialize now");
+			sm->started = 1;
+			sm->Init = TRUE;
+			if (wpa_sm_step(sm) == 1)
+				return 1; /* should not really happen */
+			sm->Init = FALSE;
+			sm->AuthenticationRequest = TRUE;
+			break;
+		}
 		if (sm->GUpdateStationKeys) {
 			/*
 			 * Reauthentication cancels the pending group key

Modified: wpasupplicant/trunk/src/ap/wpa_auth_ft.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/wpa_auth_ft.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/wpa_auth_ft.c (original)
+++ wpasupplicant/trunk/src/ap/wpa_auth_ft.c Wed Sep  8 01:19:36 2010
@@ -55,6 +55,7 @@
 {
 	if (wpa_auth->cb.send_ether == NULL)
 		return -1;
+	wpa_printf(MSG_DEBUG, "FT: RRB send to " MACSTR, MAC2STR(dst));
 	return wpa_auth->cb.send_ether(wpa_auth->cb.ctx, dst, ETH_P_RRB,
 				       data, data_len);
 }
@@ -1431,7 +1432,7 @@
 	wpa_hexdump_key(MSG_DEBUG, "FT: PMK-R1", r.pmk_r1, PMK_LEN);
 	wpa_hexdump(MSG_DEBUG, "FT: PMKR1Name", r.pmk_r1_name,
 		    WPA_PMK_NAME_LEN);
-	r.pairwise = pairwise;
+	r.pairwise = host_to_le16(pairwise);
 
 	if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_RESP_DATA_LEN + 7) / 8,
 		     r.nonce, resp.nonce) < 0) {
@@ -1734,7 +1735,7 @@
 		    WPA_PMK_NAME_LEN);
 	os_get_time(&now);
 	WPA_PUT_LE32(f.timestamp, now.sec);
-	f.pairwise = pairwise;
+	f.pairwise = host_to_le16(pairwise);
 	if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_PUSH_DATA_LEN + 7) / 8,
 		     f.timestamp, frame.timestamp) < 0)
 		return;

Modified: wpasupplicant/trunk/src/ap/wpa_auth_glue.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/wpa_auth_glue.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/wpa_auth_glue.c (original)
+++ wpasupplicant/trunk/src/ap/wpa_auth_glue.c Wed Sep  8 01:19:36 2010
@@ -29,6 +29,12 @@
 #include "ap_drv_ops.h"
 #include "ap_config.h"
 #include "wpa_auth.h"
+
+
+#ifdef CONFIG_IEEE80211R
+static void hostapd_rrb_receive(void *ctx, const u8 *src_addr, const u8 *buf,
+				size_t len);
+#endif /* CONFIG_IEEE80211R */
 
 
 static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
@@ -294,10 +300,65 @@
 }
 
 
+#ifdef CONFIG_IEEE80211R
+
+struct wpa_auth_ft_iface_iter_data {
+	struct hostapd_data *src_hapd;
+	const u8 *dst;
+	const u8 *data;
+	size_t data_len;
+};
+
+
+static int hostapd_wpa_auth_ft_iter(struct hostapd_iface *iface, void *ctx)
+{
+	struct wpa_auth_ft_iface_iter_data *idata = ctx;
+	struct hostapd_data *hapd;
+	size_t j;
+
+	for (j = 0; j < iface->num_bss; j++) {
+		hapd = iface->bss[j];
+		if (hapd == idata->src_hapd)
+			continue;
+		if (os_memcmp(hapd->own_addr, idata->dst, ETH_ALEN) == 0) {
+			wpa_printf(MSG_DEBUG, "FT: Send RRB data directly to "
+				   "locally managed BSS " MACSTR "@%s -> "
+				   MACSTR "@%s",
+				   MAC2STR(idata->src_hapd->own_addr),
+				   idata->src_hapd->conf->iface,
+				   MAC2STR(hapd->own_addr), hapd->conf->iface);
+			hostapd_rrb_receive(hapd, idata->src_hapd->own_addr,
+					    idata->data, idata->data_len);
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
+#endif /* CONFIG_IEEE80211R */
+
+
 static int hostapd_wpa_auth_send_ether(void *ctx, const u8 *dst, u16 proto,
 				       const u8 *data, size_t data_len)
 {
 	struct hostapd_data *hapd = ctx;
+
+#ifdef CONFIG_IEEE80211R
+	if (proto == ETH_P_RRB && hapd->iface->for_each_interface) {
+		int res;
+		struct wpa_auth_ft_iface_iter_data idata;
+		idata.src_hapd = hapd;
+		idata.dst = dst;
+		idata.data = data;
+		idata.data_len = data_len;
+		res = hapd->iface->for_each_interface(hapd->iface->interfaces,
+						      hostapd_wpa_auth_ft_iter,
+						      &idata);
+		if (res == 1)
+			return data_len;
+	}
+#endif /* CONFIG_IEEE80211R */
 
 	if (hapd->driver && hapd->driver->send_ether)
 		return hapd->driver->send_ether(hapd->drv_priv, dst,

Modified: wpasupplicant/trunk/src/ap/wps_hostapd.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/wps_hostapd.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/wps_hostapd.c (original)
+++ wpasupplicant/trunk/src/ap/wps_hostapd.c Wed Sep  8 01:19:36 2010
@@ -1,6 +1,6 @@
 /*
  * hostapd / WPS integration
- * Copyright (c) 2008-2009, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2008-2010, Jouni Malinen <j at w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -42,6 +42,7 @@
 
 static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr,
 				    const u8 *ie, size_t ie_len);
+static void hostapd_wps_ap_pin_timeout(void *eloop_data, void *user_ctx);
 
 
 static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr, const u8 *psk,
@@ -421,20 +422,35 @@
 }
 
 
+static void hostapd_wps_reenable_ap_pin(void *eloop_data, void *user_ctx)
+{
+	struct hostapd_data *hapd = eloop_data;
+
+	if (hapd->conf->ap_setup_locked)
+		return;
+
+	wpa_printf(MSG_DEBUG, "WPS: Re-enable AP PIN");
+	wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_UNLOCKED);
+	hapd->wps->ap_setup_locked = 0;
+	wps_registrar_update_ie(hapd->wps->registrar);
+}
+
+
 static void hostapd_pwd_auth_fail(struct hostapd_data *hapd,
 				  struct wps_event_pwd_auth_fail *data)
 {
-	FILE *f;
-
-	if (!data->enrollee)
+	if (!data->enrollee || hapd->conf->ap_pin == NULL)
 		return;
 
 	/*
 	 * Registrar failed to prove its knowledge of the AP PIN. Lock AP setup
-	 * if this happens multiple times.
+	 * for some time if this happens multiple times to slow down brute
+	 * force attacks.
 	 */
 	hapd->ap_pin_failures++;
-	if (hapd->ap_pin_failures < 4)
+	wpa_printf(MSG_DEBUG, "WPS: AP PIN authentication failure number %u",
+		   hapd->ap_pin_failures);
+	if (hapd->ap_pin_failures < 3)
 		return;
 
 	wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_LOCKED);
@@ -442,23 +458,22 @@
 
 	wps_registrar_update_ie(hapd->wps->registrar);
 
-	if (hapd->conf->wps_cred_processing == 1)
-		return;
-
-	f = fopen(hapd->iface->config_fname, "a");
-	if (f == NULL) {
-		wpa_printf(MSG_WARNING, "WPS: Could not append to the current "
-			   "configuration file");
-		return;
-	}
-
-	fprintf(f, "# WPS AP Setup Locked based on possible attack\n");
-	fprintf(f, "ap_setup_locked=1\n");
-	fclose(f);
-
-	/* TODO: dualband AP may need to update multiple configuration files */
-
-	wpa_printf(MSG_DEBUG, "WPS: AP configuration updated");
+	if (!hapd->conf->ap_setup_locked) {
+		if (hapd->ap_pin_lockout_time == 0)
+			hapd->ap_pin_lockout_time = 60;
+		else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
+			 (hapd->ap_pin_failures % 3) == 0)
+			hapd->ap_pin_lockout_time *= 2;
+
+		wpa_printf(MSG_DEBUG, "WPS: Disable AP PIN for %u seconds",
+			   hapd->ap_pin_lockout_time);
+		eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
+		eloop_register_timeout(hapd->ap_pin_lockout_time, 0,
+				       hostapd_wps_reenable_ap_pin, hapd,
+				       NULL);
+	}
+
+	/* TODO: dualband AP may need to update other interfaces */
 }
 
 
@@ -667,6 +682,8 @@
 
 void hostapd_deinit_wps(struct hostapd_data *hapd)
 {
+	eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
+	eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
 	if (hapd->wps == NULL)
 		return;
 #ifdef CONFIG_WPS_UPNP
@@ -686,6 +703,17 @@
 }
 
 
+void hostapd_update_wps(struct hostapd_data *hapd)
+{
+	if (hapd->wps == NULL)
+		return;
+	if (hapd->conf->wps_state)
+		wps_registrar_update_ie(hapd->wps->registrar);
+	else
+		hostapd_deinit_wps(hapd);
+}
+
+
 int hostapd_wps_add_pin(struct hostapd_data *hapd, const char *uuid,
 			const char *pin, int timeout)
 {
@@ -771,9 +799,22 @@
 {
 	struct hostapd_data *hapd = ctx;
 	struct wpabuf *wps_ie;
+	struct ieee802_11_elems elems;
 
 	if (hapd->wps == NULL)
 		return 0;
+
+	if (ieee802_11_parse_elems(ie, ie_len, &elems, 0) == ParseFailed) {
+		wpa_printf(MSG_DEBUG, "WPS: Could not parse ProbeReq from "
+			   MACSTR, MAC2STR(addr));
+		return 0;
+	}
+
+	if (elems.ssid && elems.ssid_len > 0 &&
+	    (elems.ssid_len != hapd->conf->ssid.ssid_len ||
+	     os_memcmp(elems.ssid, hapd->conf->ssid.ssid, elems.ssid_len) !=
+	     0))
+		return 0; /* Not for us */
 
 	wps_ie = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA);
 	if (wps_ie == NULL)
@@ -902,3 +943,78 @@
 		return 0;
 	return wps_registrar_get_info(hapd->wps->registrar, addr, buf, buflen);
 }
+
+
+static void hostapd_wps_ap_pin_timeout(void *eloop_data, void *user_ctx)
+{
+	struct hostapd_data *hapd = eloop_data;
+	wpa_printf(MSG_DEBUG, "WPS: AP PIN timed out");
+	hostapd_wps_ap_pin_disable(hapd);
+}
+
+
+static void hostapd_wps_ap_pin_enable(struct hostapd_data *hapd, int timeout)
+{
+	wpa_printf(MSG_DEBUG, "WPS: Enabling AP PIN (timeout=%d)", timeout);
+	hapd->ap_pin_failures = 0;
+	hapd->conf->ap_setup_locked = 0;
+	if (hapd->wps->ap_setup_locked) {
+		wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_UNLOCKED);
+		hapd->wps->ap_setup_locked = 0;
+		wps_registrar_update_ie(hapd->wps->registrar);
+	}
+	eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
+	if (timeout > 0)
+		eloop_register_timeout(timeout, 0,
+				       hostapd_wps_ap_pin_timeout, hapd, NULL);
+}
+
+
+void hostapd_wps_ap_pin_disable(struct hostapd_data *hapd)
+{
+	wpa_printf(MSG_DEBUG, "WPS: Disabling AP PIN");
+	os_free(hapd->conf->ap_pin);
+	hapd->conf->ap_pin = NULL;
+#ifdef CONFIG_WPS_UPNP
+	upnp_wps_set_ap_pin(hapd->wps_upnp, NULL);
+#endif /* CONFIG_WPS_UPNP */
+	eloop_cancel_timeout(hostapd_wps_ap_pin_timeout, hapd, NULL);
+}
+
+
+const char * hostapd_wps_ap_pin_random(struct hostapd_data *hapd, int timeout)
+{
+	unsigned int pin;
+	char pin_txt[9];
+
+	pin = wps_generate_pin();
+	os_snprintf(pin_txt, sizeof(pin_txt), "%u", pin);
+	os_free(hapd->conf->ap_pin);
+	hapd->conf->ap_pin = os_strdup(pin_txt);
+#ifdef CONFIG_WPS_UPNP
+	upnp_wps_set_ap_pin(hapd->wps_upnp, pin_txt);
+#endif /* CONFIG_WPS_UPNP */
+	hostapd_wps_ap_pin_enable(hapd, timeout);
+	return hapd->conf->ap_pin;
+}
+
+
+const char * hostapd_wps_ap_pin_get(struct hostapd_data *hapd)
+{
+	return hapd->conf->ap_pin;
+}
+
+
+int hostapd_wps_ap_pin_set(struct hostapd_data *hapd, const char *pin,
+			   int timeout)
+{
+	os_free(hapd->conf->ap_pin);
+	hapd->conf->ap_pin = os_strdup(pin);
+	if (hapd->conf->ap_pin == NULL)
+		return -1;
+#ifdef CONFIG_WPS_UPNP
+	upnp_wps_set_ap_pin(hapd->wps_upnp, hapd->conf->ap_pin);
+#endif /* CONFIG_WPS_UPNP */
+	hostapd_wps_ap_pin_enable(hapd, timeout);
+	return 0;
+}

Modified: wpasupplicant/trunk/src/ap/wps_hostapd.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/ap/wps_hostapd.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/ap/wps_hostapd.h (original)
+++ wpasupplicant/trunk/src/ap/wps_hostapd.h Wed Sep  8 01:19:36 2010
@@ -1,6 +1,6 @@
 /*
  * hostapd / WPS integration
- * Copyright (c) 2008, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2008-2010, Jouni Malinen <j at w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -20,6 +20,7 @@
 int hostapd_init_wps(struct hostapd_data *hapd,
 		     struct hostapd_bss_config *conf);
 void hostapd_deinit_wps(struct hostapd_data *hapd);
+void hostapd_update_wps(struct hostapd_data *hapd);
 int hostapd_wps_add_pin(struct hostapd_data *hapd, const char *uuid,
 			const char *pin, int timeout);
 int hostapd_wps_button_pushed(struct hostapd_data *hapd);
@@ -27,6 +28,11 @@
 			  char *path, char *method, char *name);
 int hostapd_wps_get_mib_sta(struct hostapd_data *hapd, const u8 *addr,
 			    char *buf, size_t buflen);
+void hostapd_wps_ap_pin_disable(struct hostapd_data *hapd);
+const char * hostapd_wps_ap_pin_random(struct hostapd_data *hapd, int timeout);
+const char * hostapd_wps_ap_pin_get(struct hostapd_data *hapd);
+int hostapd_wps_ap_pin_set(struct hostapd_data *hapd, const char *pin,
+			   int timeout);
 
 #else /* CONFIG_WPS */
 
@@ -37,6 +43,10 @@
 }
 
 static inline void hostapd_deinit_wps(struct hostapd_data *hapd)
+{
+}
+
+static inline void hostapd_update_wps(struct hostapd_data *hapd)
 {
 }
 

Modified: wpasupplicant/trunk/src/common/version.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/version.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/version.h (original)
+++ wpasupplicant/trunk/src/common/version.h Wed Sep  8 01:19:36 2010
@@ -1,6 +1,6 @@
 #ifndef VERSION_H
 #define VERSION_H
 
-#define VERSION_STR "0.7.2"
+#define VERSION_STR "0.7.3"
 
 #endif /* VERSION_H */

Modified: wpasupplicant/trunk/src/common/wpa_ctrl.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/wpa_ctrl.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/wpa_ctrl.h (original)
+++ wpasupplicant/trunk/src/common/wpa_ctrl.h Wed Sep  8 01:19:36 2010
@@ -92,6 +92,9 @@
 #define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
 #define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
 #define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
+#define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
+#define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
+#define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
 #define AP_STA_CONNECTED "AP-STA-CONNECTED "
 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
 

Modified: wpasupplicant/trunk/src/crypto/crypto_openssl.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/crypto/crypto_openssl.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/crypto/crypto_openssl.c (original)
+++ wpasupplicant/trunk/src/crypto/crypto_openssl.c Wed Sep  8 01:19:36 2010
@@ -434,7 +434,7 @@
 	if (DH_generate_key(dh) != 1)
 		goto err;
 
-	publen = BN_num_bytes(dh->p);
+	publen = BN_num_bytes(dh->pub_key);
 	pubkey = wpabuf_alloc(publen);
 	if (pubkey == NULL)
 		goto err;

Modified: wpasupplicant/trunk/src/drivers/driver_atheros.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_atheros.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_atheros.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_atheros.c Wed Sep  8 01:19:36 2010
@@ -74,6 +74,7 @@
 
 static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
 			      int reason_code);
+static int madwifi_set_privacy(void *priv, int enabled);
 
 static const char * athr_get_ioctl_name(int op)
 {
@@ -343,8 +344,11 @@
 
 	if (!params->enabled) {
 		/* XXX restore state */
-		return set80211param(priv, IEEE80211_PARAM_AUTHMODE,
-			IEEE80211_AUTH_AUTO);
+		if (set80211param(priv, IEEE80211_PARAM_AUTHMODE,
+				  IEEE80211_AUTH_AUTO) < 0)
+			return -1;
+		/* IEEE80211_AUTH_AUTO ends up enabling Privacy; clear that */
+		return madwifi_set_privacy(drv, 0);
 	}
 	if (!params->wpa && !params->ieee802_1x) {
 		hostapd_logger(drv->hapd, NULL, HOSTAPD_MODULE_DRIVER,
@@ -1184,6 +1188,8 @@
 
 	return drv;
 bad:
+	if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit)
+		l2_packet_deinit(drv->sock_recv);
 	if (drv->sock_xmit != NULL)
 		l2_packet_deinit(drv->sock_xmit);
 	if (drv->ioctl_sock >= 0)
@@ -1271,7 +1277,7 @@
 const struct wpa_driver_ops wpa_driver_atheros_ops = {
 	.name			= "atheros",
 	.hapd_init		= madwifi_init,
-	.deinit			= madwifi_deinit,
+	.hapd_deinit		= madwifi_deinit,
 	.set_ieee8021x		= madwifi_set_ieee8021x,
 	.set_privacy		= madwifi_set_privacy,
 	.set_key		= madwifi_set_key,

Modified: wpasupplicant/trunk/src/drivers/driver_nl80211.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_nl80211.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_nl80211.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_nl80211.c Wed Sep  8 01:19:36 2010
@@ -101,7 +101,6 @@
 	int disable_11b_rates;
 
 	unsigned int pending_remain_on_chan:1;
-	unsigned int pending_send_action:1;
 	unsigned int added_bridge:1;
 	unsigned int added_if_into_bridge:1;
 
@@ -702,12 +701,28 @@
 	const u8 *bssid = NULL;
 	u16 reason_code = 0;
 
+	mgmt = (const struct ieee80211_mgmt *) frame;
+	if (len >= 24) {
+		bssid = mgmt->bssid;
+
+		if (drv->associated != 0 &&
+		    os_memcmp(bssid, drv->bssid, ETH_ALEN) != 0 &&
+		    os_memcmp(bssid, drv->auth_bssid, ETH_ALEN) != 0) {
+			/*
+			 * We have presumably received this deauth as a
+			 * response to a clear_state_mismatch() outgoing
+			 * deauth.  Don't let it take us offline!
+			 */
+			wpa_printf(MSG_DEBUG, "nl80211: Deauth received "
+				   "from Unknown BSSID " MACSTR " -- ignoring",
+				   MAC2STR(bssid));
+			return;
+		}
+	}
+
 	drv->associated = 0;
 	os_memset(&event, 0, sizeof(event));
 
-	mgmt = (const struct ieee80211_mgmt *) frame;
-	if (len >= 24)
-		bssid = mgmt->bssid;
 	/* Note: Same offset for Reason Code in both frame subtypes */
 	if (len >= 24 + sizeof(mgmt->u.deauth))
 		reason_code = le_to_host16(mgmt->u.deauth.reason_code);
@@ -2422,10 +2437,6 @@
 	wpa_hexdump(MSG_DEBUG, "  * IEs", params->ie, params->ie_len);
 	if (params->ie)
 		NLA_PUT(msg, NL80211_ATTR_IE, params->ie_len, params->ie);
-	/*
-	 * TODO: if multiple auth_alg options enabled, try them one by one if
-	 * the AP rejects authentication due to unknown auth alg
-	 */
 	if (params->auth_alg & WPA_AUTH_ALG_OPEN)
 		type = NL80211_AUTHTYPE_OPEN_SYSTEM;
 	else if (params->auth_alg & WPA_AUTH_ALG_SHARED)
@@ -5002,7 +5013,6 @@
 	wpa_printf(MSG_DEBUG, "nl80211: Action TX command accepted; "
 		   "cookie 0x%llx", (long long unsigned int) cookie);
 	drv->send_action_cookie = cookie;
-	drv->pending_send_action = 1;
 	ret = 0;
 
 nla_put_failure:

Modified: wpasupplicant/trunk/src/eap_peer/eap_wsc.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_wsc.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_wsc.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_wsc.c Wed Sep  8 01:19:36 2010
@@ -225,6 +225,10 @@
 		wps_registrar_add_pin(data->wps_ctx->registrar, NULL,
 				      cfg.pin, cfg.pin_len, 0);
 	}
+
+	/* Use reduced client timeout for WPS to avoid long wait */
+	if (sm->ClientTimeout > 30)
+		sm->ClientTimeout = 30;
 
 	return data;
 }
@@ -381,6 +385,7 @@
 	u16 message_length = 0;
 	enum wps_process_res res;
 	struct wpabuf tmpbuf;
+	struct wpabuf *r;
 
 	pos = eap_hdr_validate(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, reqData,
 			       &len);
@@ -506,7 +511,13 @@
 	}
 
 	eap_wsc_state(data, MESG);
-	return eap_wsc_build_msg(data, ret, id);
+	r = eap_wsc_build_msg(data, ret, id);
+	if (data->state == FAIL && ret->methodState == METHOD_DONE) {
+		/* Use reduced client timeout for WPS to avoid long wait */
+		if (sm->ClientTimeout > 2)
+			sm->ClientTimeout = 2;
+	}
+	return r;
 }
 
 

Modified: wpasupplicant/trunk/src/eap_server/eap_server_fast.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap_server_fast.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap_server_fast.c (original)
+++ wpasupplicant/trunk/src/eap_server/eap_server_fast.c Wed Sep  8 01:19:36 2010
@@ -791,6 +791,11 @@
 	
 	/* Note: headers may be misaligned after A-ID */
 
+	if (sm->identity) {
+		eap_fast_put_tlv(buf, PAC_TYPE_I_ID, sm->identity,
+				 sm->identity_len);
+	}
+
 	/* A-ID-Info (inside PAC-Info) */
 	eap_fast_put_tlv(buf, PAC_TYPE_A_ID_INFO, data->srv_id_info,
 			 srv_id_info_len);

Modified: wpasupplicant/trunk/src/eap_server/eap_server_wsc.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap_server_wsc.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap_server_wsc.c (original)
+++ wpasupplicant/trunk/src/eap_server/eap_server_wsc.c Wed Sep  8 01:19:36 2010
@@ -119,13 +119,19 @@
 		}
 	} else {
 		if (sm->user == NULL || sm->user->password == NULL) {
-			wpa_printf(MSG_INFO, "EAP-WSC: No AP PIN (password) "
-				   "configured for Enrollee functionality");
-			os_free(data);
-			return NULL;
-		}
-		cfg.pin = sm->user->password;
-		cfg.pin_len = sm->user->password_len;
+			/*
+			 * In theory, this should not really be needed, but
+			 * Windows 7 uses Registrar mode to probe AP's WPS
+			 * capabilities before trying to use Enrollee and fails
+			 * if the AP does not allow that probing to happen..
+			 */
+			wpa_printf(MSG_DEBUG, "EAP-WSC: No AP PIN (password) "
+				   "configured for Enrollee functionality - "
+				   "allow for probing capabilities (M1)");
+		} else {
+			cfg.pin = sm->user->password;
+			cfg.pin_len = sm->user->password_len;
+		}
 	}
 	cfg.assoc_wps_ie = sm->assoc_wps_ie;
 	cfg.peer_addr = sm->peer_addr;

Modified: wpasupplicant/trunk/src/l2_packet/l2_packet_ndis.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/l2_packet/l2_packet_ndis.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/l2_packet/l2_packet_ndis.c (original)
+++ wpasupplicant/trunk/src/l2_packet/l2_packet_ndis.c Wed Sep  8 01:19:36 2010
@@ -137,11 +137,17 @@
 		DWORD err = GetLastError();
 #ifndef _WIN32_WCE
 		if (err == ERROR_IO_PENDING) {
-			/* For now, just assume that the packet will be sent in
-			 * time before the next write happens. This could be
-			 * cleaned up at some point to actually wait for
-			 * completion before starting new writes.
-			 */
+			wpa_printf(MSG_DEBUG, "L2(NDISUIO): Wait for pending "
+				   "write to complete");
+			res = GetOverlappedResult(
+				driver_ndis_get_ndisuio_handle(), &overlapped,
+				&written, TRUE);
+			if (!res) {
+				wpa_printf(MSG_DEBUG, "L2(NDISUIO): "
+					   "GetOverlappedResult failed: %d",
+					   (int) GetLastError());
+				return -1;
+			}
 			return 0;
 		}
 #endif /* _WIN32_WCE */

Modified: wpasupplicant/trunk/src/rsn_supp/preauth.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/preauth.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/preauth.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/preauth.c Wed Sep  8 01:19:36 2010
@@ -49,8 +49,10 @@
 		return;
 
 	dl_list_for_each_safe(entry, n, &sm->pmksa_candidates,
-			      struct rsn_pmksa_candidate, list)
+			      struct rsn_pmksa_candidate, list) {
+		dl_list_del(&entry->list);
 		os_free(entry);
+	}
 }
 
 
@@ -378,6 +380,7 @@
 	}
 
 	if (cand) {
+		dl_list_del(&cand->list);
 		if (prio < PMKID_CANDIDATE_PRIO_SCAN)
 			cand->priority = prio;
 	} else {

Modified: wpasupplicant/trunk/src/rsn_supp/wpa.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa.c Wed Sep  8 01:19:36 2010
@@ -231,6 +231,7 @@
 			wpa_sm_ether_send(sm, sm->bssid, ETH_P_EAPOL,
 					  buf, buflen);
 			os_free(buf);
+			return -2;
 		}
 
 		return -1;
@@ -361,6 +362,7 @@
 	struct wpa_eapol_ie_parse ie;
 	struct wpa_ptk *ptk;
 	u8 buf[8];
+	int res;
 
 	if (wpa_sm_get_network_ctx(sm) == NULL) {
 		wpa_printf(MSG_WARNING, "WPA: No SSID info found (msg 1 of "
@@ -388,7 +390,13 @@
 	}
 #endif /* CONFIG_NO_WPA2 */
 
-	if (wpa_supplicant_get_pmk(sm, src_addr, ie.pmkid))
+	res = wpa_supplicant_get_pmk(sm, src_addr, ie.pmkid);
+	if (res == -2) {
+		wpa_printf(MSG_DEBUG, "RSN: Do not reply to msg 1/4 - "
+			   "requesting full EAP authentication");
+		return;
+	}
+	if (res)
 		goto failed;
 
 	if (sm->renew_snonce) {

Modified: wpasupplicant/trunk/src/tls/x509v3.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/tls/x509v3.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/tls/x509v3.c (original)
+++ wpasupplicant/trunk/src/tls/x509v3.c Wed Sep  8 01:19:36 2010
@@ -22,14 +22,15 @@
 
 static void x509_free_name(struct x509_name *name)
 {
-	os_free(name->cn);
-	os_free(name->c);
-	os_free(name->l);
-	os_free(name->st);
-	os_free(name->o);
-	os_free(name->ou);
+	size_t i;
+
+	for (i = 0; i < name->num_attr; i++) {
+		os_free(name->attr[i].value);
+		name->attr[i].value = NULL;
+		name->attr[i].type = X509_NAME_ATTR_NOT_USED;
+	}
+	name->num_attr = 0;
 	os_free(name->email);
-	name->cn = name->c = name->l = name->st = name->o = name->ou = NULL;
 	name->email = NULL;
 
 	os_free(name->alt_email);
@@ -152,6 +153,7 @@
 int x509_name_compare(struct x509_name *a, struct x509_name *b)
 {
 	int res;
+	size_t i;
 
 	if (!a && b)
 		return -1;
@@ -159,25 +161,20 @@
 		return 1;
 	if (!a && !b)
 		return 0;
-
-	res = x509_str_compare(a->cn, b->cn);
-	if (res)
-		return res;
-	res = x509_str_compare(a->c, b->c);
-	if (res)
-		return res;
-	res = x509_str_compare(a->l, b->l);
-	if (res)
-		return res;
-	res = x509_str_compare(a->st, b->st);
-	if (res)
-		return res;
-	res = x509_str_compare(a->o, b->o);
-	if (res)
-		return res;
-	res = x509_str_compare(a->ou, b->ou);
-	if (res)
-		return res;
+	if (a->num_attr < b->num_attr)
+		return -1;
+	if (a->num_attr > b->num_attr)
+		return 1;
+
+	for (i = 0; i < a->num_attr; i++) {
+		if (a->attr[i].type < b->attr[i].type)
+			return -1;
+		if (a->attr[i].type > b->attr[i].type)
+			return -1;
+		res = x509_str_compare(a->attr[i].value, b->attr[i].value);
+		if (res)
+			return res;
+	}
 	res = x509_str_compare(a->email, b->email);
 	if (res)
 		return res;
@@ -304,7 +301,7 @@
 	struct asn1_hdr hdr;
 	const u8 *pos, *end, *set_pos, *set_end, *seq_pos, *seq_end;
 	struct asn1_oid oid;
-	char **fieldp;
+	char *val;
 
 	/*
 	 * Name ::= CHOICE { RDNSequence }
@@ -334,6 +331,8 @@
 	end = *next = pos + hdr.length;
 
 	while (pos < end) {
+		enum x509_name_attr_type type;
+
 		if (asn1_get_next(pos, end - pos, &hdr) < 0 ||
 		    hdr.class != ASN1_CLASS_UNIVERSAL ||
 		    hdr.tag != ASN1_TAG_SET) {
@@ -381,34 +380,34 @@
 		 * pseudonym, generation qualifier.
 		 * MUST: domainComponent (RFC 2247).
 		 */
-		fieldp = NULL;
+		type = X509_NAME_ATTR_NOT_USED;
 		if (oid.len == 4 &&
 		    oid.oid[0] == 2 && oid.oid[1] == 5 && oid.oid[2] == 4) {
 			/* id-at ::= 2.5.4 */
 			switch (oid.oid[3]) {
 			case 3:
 				/* commonName */
-				fieldp = &name->cn;
+				type = X509_NAME_ATTR_CN;
 				break;
 			case 6:
 				/*  countryName */
-				fieldp = &name->c;
+				type = X509_NAME_ATTR_C;
 				break;
 			case 7:
 				/* localityName */
-				fieldp = &name->l;
+				type = X509_NAME_ATTR_L;
 				break;
 			case 8:
 				/* stateOrProvinceName */
-				fieldp = &name->st;
+				type = X509_NAME_ATTR_ST;
 				break;
 			case 10:
 				/* organizationName */
-				fieldp = &name->o;
+				type = X509_NAME_ATTR_O;
 				break;
 			case 11:
 				/* organizationalUnitName */
-				fieldp = &name->ou;
+				type = X509_NAME_ATTR_OU;
 				break;
 			}
 		} else if (oid.len == 7 &&
@@ -417,10 +416,25 @@
 			   oid.oid[4] == 1 && oid.oid[5] == 9 &&
 			   oid.oid[6] == 1) {
 			/* 1.2.840.113549.1.9.1 - e-mailAddress */
-			fieldp = &name->email;
-		}
-
-		if (fieldp == NULL) {
+			os_free(name->email);
+			name->email = os_malloc(hdr.length + 1);
+			if (name->email == NULL) {
+				x509_free_name(name);
+				return -1;
+			}
+			os_memcpy(name->email, hdr.payload, hdr.length);
+			name->email[hdr.length] = '\0';
+			continue;
+		} else if (oid.len == 7 &&
+			   oid.oid[0] == 0 && oid.oid[1] == 9 &&
+			   oid.oid[2] == 2342 && oid.oid[3] == 19200300 &&
+			   oid.oid[4] == 100 && oid.oid[5] == 1 &&
+			   oid.oid[6] == 25) {
+			/* 0.9.2342.19200300.100.1.25 - domainComponent */
+			type = X509_NAME_ATTR_DC;
+		}
+
+		if (type == X509_NAME_ATTR_NOT_USED) {
 			wpa_hexdump(MSG_DEBUG, "X509: Unrecognized OID",
 				    (u8 *) oid.oid,
 				    oid.len * sizeof(oid.oid[0]));
@@ -429,24 +443,57 @@
 			continue;
 		}
 
-		os_free(*fieldp);
-		*fieldp = os_malloc(hdr.length + 1);
-		if (*fieldp == NULL) {
+		if (name->num_attr == X509_MAX_NAME_ATTRIBUTES) {
+			wpa_printf(MSG_INFO, "X509: Too many Name attributes");
 			x509_free_name(name);
 			return -1;
 		}
-		os_memcpy(*fieldp, hdr.payload, hdr.length);
-		(*fieldp)[hdr.length] = '\0';
-		if (os_strlen(*fieldp) != hdr.length) {
+
+		val = os_malloc(hdr.length + 1);
+		if (val == NULL) {
+			x509_free_name(name);
+			return -1;
+		}
+		os_memcpy(val, hdr.payload, hdr.length);
+		val[hdr.length] = '\0';
+		if (os_strlen(val) != hdr.length) {
 			wpa_printf(MSG_INFO, "X509: Reject certificate with "
 				   "embedded NUL byte in a string (%s[NUL])",
-				   *fieldp);
+				   val);
 			x509_free_name(name);
 			return -1;
 		}
+
+		name->attr[name->num_attr].type = type;
+		name->attr[name->num_attr].value = val;
+		name->num_attr++;
 	}
 
 	return 0;
+}
+
+
+static char * x509_name_attr_str(enum x509_name_attr_type type)
+{
+	switch (type) {
+	case X509_NAME_ATTR_NOT_USED:
+		return "[N/A]";
+	case X509_NAME_ATTR_DC:
+		return "DC";
+	case X509_NAME_ATTR_CN:
+		return "CN";
+	case X509_NAME_ATTR_C:
+		return "C";
+	case X509_NAME_ATTR_L:
+		return "L";
+	case X509_NAME_ATTR_ST:
+		return "ST";
+	case X509_NAME_ATTR_O:
+		return "O";
+	case X509_NAME_ATTR_OU:
+		return "OU";
+	}
+	return "?";
 }
 
 
@@ -460,6 +507,7 @@
 {
 	char *pos, *end;
 	int ret;
+	size_t i;
 
 	if (len == 0)
 		return;
@@ -467,46 +515,20 @@
 	pos = buf;
 	end = buf + len;
 
-	if (name->c) {
-		ret = os_snprintf(pos, end - pos, "C=%s, ", name->c);
+	for (i = 0; i < name->num_attr; i++) {
+		ret = os_snprintf(pos, end - pos, "%s=%s, ",
+				  x509_name_attr_str(name->attr[i].type),
+				  name->attr[i].value);
 		if (ret < 0 || ret >= end - pos)
 			goto done;
 		pos += ret;
 	}
-	if (name->st) {
-		ret = os_snprintf(pos, end - pos, "ST=%s, ", name->st);
-		if (ret < 0 || ret >= end - pos)
-			goto done;
-		pos += ret;
-	}
-	if (name->l) {
-		ret = os_snprintf(pos, end - pos, "L=%s, ", name->l);
-		if (ret < 0 || ret >= end - pos)
-			goto done;
-		pos += ret;
-	}
-	if (name->o) {
-		ret = os_snprintf(pos, end - pos, "O=%s, ", name->o);
-		if (ret < 0 || ret >= end - pos)
-			goto done;
-		pos += ret;
-	}
-	if (name->ou) {
-		ret = os_snprintf(pos, end - pos, "OU=%s, ", name->ou);
-		if (ret < 0 || ret >= end - pos)
-			goto done;
-		pos += ret;
-	}
-	if (name->cn) {
-		ret = os_snprintf(pos, end - pos, "CN=%s, ", name->cn);
-		if (ret < 0 || ret >= end - pos)
-			goto done;
-		pos += ret;
-	}
 
 	if (pos > buf + 1 && pos[-1] == ' ' && pos[-2] == ',') {
-		*pos-- = '\0';
-		*pos-- = '\0';
+		pos--;
+		*pos = '\0';
+		pos--;
+		*pos = '\0';
 	}
 
 	if (name->email) {

Modified: wpasupplicant/trunk/src/tls/x509v3.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/tls/x509v3.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/tls/x509v3.h (original)
+++ wpasupplicant/trunk/src/tls/x509v3.h Wed Sep  8 01:19:36 2010
@@ -21,13 +21,25 @@
 	struct asn1_oid oid;
 };
 
+struct x509_name_attr {
+	enum x509_name_attr_type {
+		X509_NAME_ATTR_NOT_USED,
+		X509_NAME_ATTR_DC,
+		X509_NAME_ATTR_CN,
+		X509_NAME_ATTR_C,
+		X509_NAME_ATTR_L,
+		X509_NAME_ATTR_ST,
+		X509_NAME_ATTR_O,
+		X509_NAME_ATTR_OU
+	} type;
+	char *value;
+};
+
+#define X509_MAX_NAME_ATTRIBUTES 20
+
 struct x509_name {
-	char *cn; /* commonName */
-	char *c; /* countryName */
-	char *l; /* localityName */
-	char *st; /* stateOrProvinceName */
-	char *o; /* organizationName */
-	char *ou; /* organizationalUnitName */
+	struct x509_name_attr attr[X509_MAX_NAME_ATTRIBUTES];
+	size_t num_attr;
 	char *email; /* emailAddress */
 
 	/* from alternative name extension */

Modified: wpasupplicant/trunk/src/utils/eloop.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/utils/eloop.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/utils/eloop.c (original)
+++ wpasupplicant/trunk/src/utils/eloop.c Wed Sep  8 01:19:36 2010
@@ -529,6 +529,8 @@
 		eloop_process_pending_signals();
 
 		/* check if some registered timeouts have occurred */
+		timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
+					list);
 		if (timeout) {
 			os_get_time(&now);
 			if (!os_time_before(&now, &timeout->time)) {

Modified: wpasupplicant/trunk/src/utils/os_unix.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/utils/os_unix.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/utils/os_unix.c (original)
+++ wpasupplicant/trunk/src/utils/os_unix.c Wed Sep  8 01:19:36 2010
@@ -370,7 +370,7 @@
 	if (ptr == NULL)
 		return os_malloc(size);
 
-	a = ptr - sizeof(*a);
+	a = (struct os_alloc_trace *) ptr - 1;
 	if (a->magic != ALLOC_MAGIC) {
 		wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
 			   a, a->magic,
@@ -396,7 +396,7 @@
 
 	if (ptr == NULL)
 		return;
-	a = ptr - sizeof(*a);
+	a = (struct os_alloc_trace *) ptr - 1;
 	if (a->magic != ALLOC_MAGIC) {
 		wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
 			   a, a->magic,

Modified: wpasupplicant/trunk/src/wps/wps.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps.c (original)
+++ wpasupplicant/trunk/src/wps/wps.c Wed Sep  8 01:19:36 2010
@@ -289,6 +289,39 @@
 
 
 /**
+ * wps_build_assoc_resp_ie - Build WPS IE for (Re)Association Response
+ * Returns: WPS IE or %NULL on failure
+ *
+ * The caller is responsible for freeing the buffer.
+ */
+struct wpabuf * wps_build_assoc_resp_ie(void)
+{
+	struct wpabuf *ie;
+	u8 *len;
+
+	wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for (Re)Association "
+		   "Response");
+	ie = wpabuf_alloc(100);
+	if (ie == NULL)
+		return NULL;
+
+	wpabuf_put_u8(ie, WLAN_EID_VENDOR_SPECIFIC);
+	len = wpabuf_put(ie, 1);
+	wpabuf_put_be32(ie, WPS_DEV_OUI_WFA);
+
+	if (wps_build_version(ie) ||
+	    wps_build_resp_type(ie, WPS_RESP_AP)) {
+		wpabuf_free(ie);
+		return NULL;
+	}
+
+	*len = wpabuf_len(ie) - 2;
+
+	return ie;
+}
+
+
+/**
  * wps_build_probe_req_ie - Build WPS IE for Probe Request
  * @pbc: Whether searching for PBC mode APs
  * @dev: Device attributes

Modified: wpasupplicant/trunk/src/wps/wps.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps.h (original)
+++ wpasupplicant/trunk/src/wps/wps.h Wed Sep  8 01:19:36 2010
@@ -198,6 +198,7 @@
 const u8 * wps_get_uuid_e(const struct wpabuf *msg);
 
 struct wpabuf * wps_build_assoc_req_ie(enum wps_request_type req_type);
+struct wpabuf * wps_build_assoc_resp_ie(void);
 struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
 				       const u8 *uuid,
 				       enum wps_request_type req_type);

Modified: wpasupplicant/trunk/src/wps/wps_attr_build.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_attr_build.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_attr_build.c (original)
+++ wpasupplicant/trunk/src/wps/wps_attr_build.c Wed Sep  8 01:19:36 2010
@@ -74,6 +74,16 @@
 }
 
 
+int wps_build_resp_type(struct wpabuf *msg, enum wps_response_type type)
+{
+	wpa_printf(MSG_DEBUG, "WPS:  * Response Type (%d)", type);
+	wpabuf_put_be16(msg, ATTR_RESPONSE_TYPE);
+	wpabuf_put_be16(msg, 1);
+	wpabuf_put_u8(msg, type);
+	return 0;
+}
+
+
 int wps_build_config_methods(struct wpabuf *msg, u16 methods)
 {
 	wpa_printf(MSG_DEBUG, "WPS:  * Config Methods (%x)", methods);

Modified: wpasupplicant/trunk/src/wps/wps_attr_parse.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_attr_parse.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_attr_parse.c (original)
+++ wpasupplicant/trunk/src/wps/wps_attr_parse.c Wed Sep  8 01:19:36 2010
@@ -17,6 +17,8 @@
 #include "common.h"
 #include "wps_i.h"
 
+#define WPS_WORKAROUNDS
+
 
 static int wps_set_attr(struct wps_parse_attr *attr, u16 type,
 			const u8 *pos, u16 len)
@@ -332,7 +334,7 @@
 				   "length %u", len);
 			return -1;
 		}
-		attr->request_type = pos;
+		attr->response_type = pos;
 		break;
 	case ATTR_MANUFACTURER:
 		attr->manufacturer = pos;
@@ -435,6 +437,25 @@
 			return -1;
 		}
 
+#ifdef WPS_WORKAROUNDS
+		if (type == 0 && len == 0) {
+			/*
+			 * Mac OS X 10.6 seems to be adding 0x00 padding to the
+			 * end of M1. Skip those to avoid interop issues.
+			 */
+			int i;
+			for (i = 0; i < end - pos; i++) {
+				if (pos[i])
+					break;
+			}
+			if (i == end - pos) {
+				wpa_printf(MSG_DEBUG, "WPS: Workaround - skip "
+					   "unexpected message padding");
+				break;
+			}
+		}
+#endif /* WPS_WORKAROUNDS */
+
 		if (wps_set_attr(attr, type, pos, len) < 0)
 			return -1;
 

Modified: wpasupplicant/trunk/src/wps/wps_attr_process.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_attr_process.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_attr_process.c (original)
+++ wpasupplicant/trunk/src/wps/wps_attr_process.c Wed Sep  8 01:19:36 2010
@@ -177,6 +177,13 @@
 	if (key == NULL) {
 		wpa_printf(MSG_DEBUG, "WPS: Credential did not include "
 			   "Network Key");
+		if (cred->auth_type == WPS_AUTH_OPEN &&
+		    cred->encr_type == WPS_ENCR_NONE) {
+			wpa_printf(MSG_DEBUG, "WPS: Workaround - Allow "
+				   "missing mandatory Network Key attribute "
+				   "for open network");
+			return 0;
+		}
 		return -1;
 	}
 

Modified: wpasupplicant/trunk/src/wps/wps_defs.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_defs.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_defs.h (original)
+++ wpasupplicant/trunk/src/wps/wps_defs.h Wed Sep  8 01:19:36 2010
@@ -115,7 +115,7 @@
 	ATTR_PERMITTED_CFG_METHODS = 0x1052,
 	ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
 	ATTR_PRIMARY_DEV_TYPE = 0x1054,
-	ATTR_SECONDARY_DEV_TYP_ELIST = 0x1055,
+	ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
 	ATTR_PORTABLE_DEV = 0x1056,
 	ATTR_AP_SETUP_LOCKED = 0x1057,
 	ATTR_APPLICATION_EXT = 0x1058,

Modified: wpasupplicant/trunk/src/wps/wps_enrollee.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_enrollee.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_enrollee.c (original)
+++ wpasupplicant/trunk/src/wps/wps_enrollee.c Wed Sep  8 01:19:36 2010
@@ -774,18 +774,23 @@
 
 	if (wps_process_registrar_nonce(wps, attr->registrar_nonce) ||
 	    wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
-	    wps_process_uuid_r(wps, attr->uuid_r) ||
-	    wps_process_pubkey(wps, attr->public_key, attr->public_key_len) ||
-	    wps_process_authenticator(wps, attr->authenticator, msg) ||
-	    wps_process_device_attrs(&wps->peer_dev, attr)) {
-		wps->state = SEND_WSC_NACK;
-		return WPS_CONTINUE;
-	}
-
-	if (wps->wps->ap && wps->wps->ap_setup_locked) {
+	    wps_process_uuid_r(wps, attr->uuid_r)) {
+		wps->state = SEND_WSC_NACK;
+		return WPS_CONTINUE;
+	}
+
+	if (wps->wps->ap &&
+	    (wps->wps->ap_setup_locked || wps->dev_password == NULL)) {
 		wpa_printf(MSG_DEBUG, "WPS: AP Setup is locked - refuse "
 			   "registration of a new Registrar");
 		wps->config_error = WPS_CFG_SETUP_LOCKED;
+		wps->state = SEND_WSC_NACK;
+		return WPS_CONTINUE;
+	}
+
+	if (wps_process_pubkey(wps, attr->public_key, attr->public_key_len) ||
+	    wps_process_authenticator(wps, attr->authenticator, msg) ||
+	    wps_process_device_attrs(&wps->peer_dev, attr)) {
 		wps->state = SEND_WSC_NACK;
 		return WPS_CONTINUE;
 	}

Modified: wpasupplicant/trunk/src/wps/wps_er.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_er.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_er.c (original)
+++ wpasupplicant/trunk/src/wps/wps_er.c Wed Sep  8 01:19:36 2010
@@ -85,6 +85,7 @@
 	os_free(sta->dev_name);
 	http_client_free(sta->http);
 	eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
+	os_free(sta->cred);
 	os_free(sta);
 }
 
@@ -953,6 +954,17 @@
 		return;
 	sta->wps->er = 1;
 	sta->wps->use_cred = sta->ap->ap_settings;
+	if (sta->ap->ap_settings) {
+		os_free(sta->cred);
+		sta->cred = os_malloc(sizeof(*sta->cred));
+		if (sta->cred) {
+			os_memcpy(sta->cred, sta->ap->ap_settings,
+				  sizeof(*sta->cred));
+			sta->cred->cred_attr = NULL;
+			os_memcpy(sta->cred->mac_addr, sta->addr, ETH_ALEN);
+			sta->wps->use_cred = sta->cred;
+		}
+	}
 
 	wps_er_sta_process(sta, msg, WSC_MSG);
 }
@@ -1160,6 +1172,8 @@
 		wps_er_deinit(er, NULL, NULL);
 		return NULL;
 	}
+	/* Limit event_id to < 32 bits to avoid issues with atoi() */
+	er->event_id &= 0x0fffffff;
 
 	if (get_netif_info(ifname, &er->ip_addr, &er->ip_addr_text,
 			   er->mac_addr)) {

Modified: wpasupplicant/trunk/src/wps/wps_er.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_er.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_er.h (original)
+++ wpasupplicant/trunk/src/wps/wps_er.h Wed Sep  8 01:19:36 2010
@@ -33,6 +33,7 @@
 	char *dev_name;
 	struct wps_data *wps;
 	struct http_client *http;
+	struct wps_credential *cred;
 };
 
 struct wps_er_ap {

Modified: wpasupplicant/trunk/src/wps/wps_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_i.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_i.h (original)
+++ wpasupplicant/trunk/src/wps/wps_i.h Wed Sep  8 01:19:36 2010
@@ -218,6 +218,7 @@
 /* wps_attr_build.c */
 int wps_build_public_key(struct wps_data *wps, struct wpabuf *msg);
 int wps_build_req_type(struct wpabuf *msg, enum wps_request_type type);
+int wps_build_resp_type(struct wpabuf *msg, enum wps_response_type type);
 int wps_build_config_methods(struct wpabuf *msg, u16 methods);
 int wps_build_uuid_e(struct wpabuf *msg, const u8 *uuid);
 int wps_build_dev_password_id(struct wpabuf *msg, u16 id);

Modified: wpasupplicant/trunk/src/wps/wps_registrar.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_registrar.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_registrar.c (original)
+++ wpasupplicant/trunk/src/wps/wps_registrar.c Wed Sep  8 01:19:36 2010
@@ -426,17 +426,6 @@
 }
 
 
-static int wps_build_resp_type(struct wps_registrar *reg, struct wpabuf *msg)
-{
-	u8 resp = reg->wps->ap ? WPS_RESP_AP : WPS_RESP_REGISTRAR;
-	wpa_printf(MSG_DEBUG, "WPS:  * Response Type (%d)", resp);
-	wpabuf_put_be16(msg, ATTR_RESPONSE_TYPE);
-	wpabuf_put_be16(msg, 1);
-	wpabuf_put_u8(msg, resp);
-	return 0;
-}
-
-
 /**
  * wps_registrar_init - Initialize WPS Registrar data
  * @wps: Pointer to longterm WPS context
@@ -940,7 +929,8 @@
 	    wps_build_selected_registrar(reg, probe) ||
 	    wps_build_sel_reg_dev_password_id(reg, probe) ||
 	    wps_build_sel_reg_config_methods(reg, probe) ||
-	    wps_build_resp_type(reg, probe) ||
+	    wps_build_resp_type(probe, reg->wps->ap ? WPS_RESP_AP :
+				WPS_RESP_REGISTRAR) ||
 	    wps_build_uuid_e(probe, reg->wps->uuid) ||
 	    wps_build_device_attrs(&reg->wps->dev, probe) ||
 	    wps_build_probe_config_methods(reg, probe) ||
@@ -2125,6 +2115,23 @@
 		wps->pbc = 1;
 	}
 
+#ifdef WPS_WORKAROUNDS
+	/*
+	 * It looks like Mac OS X 10.6.3 and 10.6.4 do not like Network Key in
+	 * passphrase format. To avoid interop issues, force PSK format to be
+	 * used.
+	 */
+	if (!wps->use_psk_key &&
+	    wps->peer_dev.manufacturer &&
+	    os_strncmp(wps->peer_dev.manufacturer, "Apple ", 6) == 0 &&
+	    wps->peer_dev.model_name &&
+	    os_strcmp(wps->peer_dev.model_name, "AirPort") == 0) {
+		wpa_printf(MSG_DEBUG, "WPS: Workaround - Force Network Key in "
+			   "PSK format");
+		wps->use_psk_key = 1;
+	}
+#endif /* WPS_WORKAROUNDS */
+
 	wps->state = SEND_M2;
 	return WPS_CONTINUE;
 }

Modified: wpasupplicant/trunk/src/wps/wps_upnp.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_upnp.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_upnp.c (original)
+++ wpasupplicant/trunk/src/wps/wps_upnp.c Wed Sep  8 01:19:36 2010
@@ -1074,3 +1074,20 @@
 {
 	return !dl_list_empty(&sm->subscriptions);
 }
+
+
+int upnp_wps_set_ap_pin(struct upnp_wps_device_sm *sm, const char *ap_pin)
+{
+	if (sm == NULL)
+		return 0;
+
+	os_free(sm->ctx->ap_pin);
+	if (ap_pin) {
+		sm->ctx->ap_pin = os_strdup(ap_pin);
+		if (sm->ctx->ap_pin == NULL)
+			return -1;
+	} else
+		sm->ctx->ap_pin = NULL;
+
+	return 0;
+}

Modified: wpasupplicant/trunk/src/wps/wps_upnp.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_upnp.h?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_upnp.h (original)
+++ wpasupplicant/trunk/src/wps/wps_upnp.h Wed Sep  8 01:19:36 2010
@@ -46,5 +46,6 @@
 				    enum upnp_wps_wlanevent_type ev_type,
 				    const struct wpabuf *msg);
 int upnp_wps_subscribers(struct upnp_wps_device_sm *sm);
+int upnp_wps_set_ap_pin(struct upnp_wps_device_sm *sm, const char *ap_pin);
 
 #endif /* WPS_UPNP_H */

Modified: wpasupplicant/trunk/src/wps/wps_upnp_web.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/wps/wps_upnp_web.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/src/wps/wps_upnp_web.c (original)
+++ wpasupplicant/trunk/src/wps/wps_upnp_web.c Wed Sep  8 01:19:36 2010
@@ -412,6 +412,9 @@
 
 	wpa_printf(MSG_DEBUG, "WPS UPnP: GetDeviceInfo");
 
+	if (sm->ctx->ap_pin == NULL)
+		return HTTP_INTERNAL_SERVER_ERROR;
+
 	/*
 	 * Request for DeviceInfo, i.e., M1 TLVs. This is a start of WPS
 	 * registration over UPnP with the AP acting as an Enrollee. It should

Modified: wpasupplicant/trunk/wpa_supplicant/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ChangeLog?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ChangeLog (original)
+++ wpasupplicant/trunk/wpa_supplicant/ChangeLog Wed Sep  8 01:19:36 2010
@@ -1,4 +1,23 @@
 ChangeLog for wpa_supplicant
+
+2010-09-07 - v0.7.3
+	* fixed fallback from failed PMKSA caching into full EAP authentication
+	  [Bug 355]
+	* fixed issue with early D-Bus signals during initialization
+	* fixed X.509 name handling in internal TLS
+	* fixed WPS ER to use corrent Enrollee MAC Address in Credential
+	* fixed scanning routines ot improve AP selection for WPS
+	* added WPS workaround for open networks
+	* fixed WPS Diffie-Hellman derivation to use correct public key length
+	* fixed wpa_supplicant AP mode operations to ignore Supplicant and
+	  scan result events
+	* improved SME operations with nl80211
+	* fixed WPS ER event_id handling in some cases
+	* fixed some issues with bgscan simple to avoid unnecessary scans
+	* fixed issue with l2_packet_ndis overlapped writes corrupting stack
+	  [Bug 328]
+	* updated WinPcap to the latest stable version 4.1.2 in Windows
+	  installer
 
 2010-04-18 - v0.7.2
 	* nl80211: fixed number of issues with roaming

Modified: wpasupplicant/trunk/wpa_supplicant/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/Makefile?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/Makefile (original)
+++ wpasupplicant/trunk/wpa_supplicant/Makefile Wed Sep  8 01:19:36 2010
@@ -574,7 +574,9 @@
 ifdef CONFIG_IEEE8021X_EAPOL
 # IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
 CFLAGS += -DIEEE8021X_EAPOL
-OBJS += ../src/eapol_supp/eapol_supp_sm.o ../src/eap_peer/eap.o ../src/eap_common/eap_common.o ../src/eap_peer/eap_methods.o
+OBJS += ../src/eapol_supp/eapol_supp_sm.o
+OBJS += ../src/eap_peer/eap.o ../src/eap_peer/eap_methods.o
+NEED_EAP_COMMON=y
 ifdef CONFIG_DYNAMIC_EAP_METHODS
 CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
 LIBS += -ldl -rdynamic
@@ -582,6 +584,8 @@
 endif
 
 ifdef CONFIG_AP
+NEED_80211_COMMON=y
+NEED_EAP_COMMON=y
 NEED_RSN_AUTHENTICATOR=y
 CFLAGS += -DCONFIG_AP
 OBJS += ap.o
@@ -1146,6 +1150,10 @@
 OBJS += ../src/common/ieee802_11_common.o
 endif
 
+ifdef NEED_EAP_COMMON
+OBJS += ../src/eap_common/eap_common.o
+endif
+
 ifndef CONFIG_MAIN
 CONFIG_MAIN=main
 endif

Modified: wpasupplicant/trunk/wpa_supplicant/bgscan_simple.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/bgscan_simple.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/bgscan_simple.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/bgscan_simple.c Wed Sep  8 01:19:36 2010
@@ -124,6 +124,15 @@
 	data->scan_interval = data->short_interval;
 	eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout,
 			       data, NULL);
+
+	/*
+	 * This function is called immediately after an association, so it is
+	 * reasonable to assume that a scan was completed recently. This makes
+	 * us skip an immediate new scan in cases where the current signal
+	 * level is below the bgscan threshold.
+	 */
+	os_get_time(&data->last_bgscan);
+
 	return data;
 }
 
@@ -169,6 +178,8 @@
 static void bgscan_simple_notify_signal_change(void *priv, int above)
 {
 	struct bgscan_simple_data *data = priv;
+	int scan = 0;
+	struct os_time now;
 
 	if (data->short_interval == data->long_interval ||
 	    data->signal_threshold == 0)
@@ -177,12 +188,12 @@
 	wpa_printf(MSG_DEBUG, "bgscan simple: signal level changed "
 		   "(above=%d)", above);
 	if (data->scan_interval == data->long_interval && !above) {
-		wpa_printf(MSG_DEBUG, "bgscan simple: Trigger immediate scan "
-			   "and start using short bgscan interval");
+		wpa_printf(MSG_DEBUG, "bgscan simple: Start using short "
+			   "bgscan interval");
 		data->scan_interval = data->short_interval;
-		eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
-		eloop_register_timeout(0, 0, bgscan_simple_timeout, data,
-				       NULL);
+		os_get_time(&now);
+		if (now.sec > data->last_bgscan.sec + 1)
+			scan = 1;
 	} else if (data->scan_interval == data->short_interval && above) {
 		wpa_printf(MSG_DEBUG, "bgscan simple: Start using long bgscan "
 			   "interval");
@@ -191,20 +202,20 @@
 		eloop_register_timeout(data->scan_interval, 0,
 				       bgscan_simple_timeout, data, NULL);
 	} else if (!above) {
-		struct os_time now;
 		/*
 		 * Signal dropped further 4 dB. Request a new scan if we have
 		 * not yet scanned in a while.
 		 */
 		os_get_time(&now);
-		if (now.sec > data->last_bgscan.sec + 10) {
-			wpa_printf(MSG_DEBUG, "bgscan simple: Trigger "
-				   "immediate scan");
-			eloop_cancel_timeout(bgscan_simple_timeout, data,
-					     NULL);
-			eloop_register_timeout(0, 0, bgscan_simple_timeout,
-					       data, NULL);
-		}
+		if (now.sec > data->last_bgscan.sec + 10)
+			scan = 1;
+	}
+
+	if (scan) {
+		wpa_printf(MSG_DEBUG, "bgscan simple: Trigger immediate scan");
+		eloop_cancel_timeout(bgscan_simple_timeout, data, NULL);
+		eloop_register_timeout(0, 0, bgscan_simple_timeout, data,
+				       NULL);
 	}
 }
 

Modified: wpasupplicant/trunk/wpa_supplicant/config_winreg.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config_winreg.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config_winreg.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/config_winreg.c Wed Sep  8 01:19:36 2010
@@ -258,7 +258,7 @@
 #endif /* CONFIG_WPS */
 
 	wpa_config_read_reg_dword(hk, TEXT("bss_max_count"),
-				  &config->bss_max_count);
+				  (int *) &config->bss_max_count);
 	wpa_config_read_reg_dword(hk, TEXT("filter_ssids"),
 				  &config->filter_ssids);
 

Modified: wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new.c Wed Sep  8 01:19:36 2010
@@ -665,6 +665,9 @@
 	WPADBusPropertyAccessor getter;
 	char *prop;
 
+	if (wpa_s->dbus_new_path == NULL)
+		return; /* Skip signal since D-Bus setup is not yet ready */
+
 	switch (property) {
 	case WPAS_DBUS_PROP_AP_SCAN:
 		getter = (WPADBusPropertyAccessor) wpas_dbus_getter_ap_scan;

Modified: wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new_handlers.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new_handlers.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new_handlers.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/dbus/dbus_new_handlers.c Wed Sep  8 01:19:36 2010
@@ -1300,7 +1300,8 @@
 {
 	if (wpa_s->current_ssid != NULL) {
 		wpa_s->disconnected = 1;
-		wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+		wpa_supplicant_deauthenticate(wpa_s,
+					      WLAN_REASON_DEAUTH_LEAVING);
 
 		return NULL;
 	}
@@ -1433,7 +1434,8 @@
 	}
 
 	if (ssid == wpa_s->current_ssid)
-		wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+		wpa_supplicant_deauthenticate(wpa_s,
+					      WLAN_REASON_DEAUTH_LEAVING);
 
 out:
 	os_free(iface);
@@ -2724,8 +2726,11 @@
 
 	os_memset(&wpa_data, 0, sizeof(wpa_data));
 	ie = wpa_bss_get_vendor_ie(res, WPA_IE_VENDOR_TYPE);
-	if (ie)
-		wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data);
+	if (ie) {
+		if (wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data) < 0)
+			return wpas_dbus_error_unknown_error(message,
+							     "invalid WPA IE");
+	}
 
 	return wpas_dbus_get_bss_security_prop(message, &wpa_data);
 }
@@ -2754,8 +2759,11 @@
 
 	os_memset(&wpa_data, 0, sizeof(wpa_data));
 	ie = wpa_bss_get_ie(res, WLAN_EID_RSN);
-	if (ie)
-		wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data);
+	if (ie) {
+		if (wpa_parse_wpa_ie(ie, 2 + ie[1], &wpa_data) < 0)
+			return wpas_dbus_error_unknown_error(message,
+							     "invalid RSN IE");
+	}
 
 	return wpas_dbus_get_bss_security_prop(message, &wpa_data);
 }

Modified: wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old.c Wed Sep  8 01:19:36 2010
@@ -410,6 +410,9 @@
 	DBusMessage *_signal = NULL;
 	const char *new_state_str, *old_state_str;
 
+	if (wpa_s->dbus_path == NULL)
+		return; /* Skip signal since D-Bus setup is not yet ready */
+
 	/* Do nothing if the control interface is not turned on */
 	if (wpa_s->global == NULL)
 		return;

Modified: wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old_handlers.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old_handlers.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old_handlers.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/dbus/dbus_old_handlers.c Wed Sep  8 01:19:36 2010
@@ -872,7 +872,8 @@
 	}
 
 	if (ssid == wpa_s->current_ssid)
-		wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+		wpa_supplicant_deauthenticate(wpa_s,
+					      WLAN_REASON_DEAUTH_LEAVING);
 	reply = wpas_dbus_new_success_reply(message);
 
 out:
@@ -1141,7 +1142,7 @@
 					 struct wpa_supplicant *wpa_s)
 {
 	wpa_s->disconnected = 1;
-	wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+	wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
 
 	return wpas_dbus_new_success_reply(message);
 }

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_background.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_background.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_background.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_background.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_BACKGROUND" "8" "18 April 2010" "" ""
+.TH "WPA_BACKGROUND" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_background \- Background information on Wi-Fi Protected Access and IEEE 802.11i

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_cli.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_cli.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_cli.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_cli.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_CLI" "8" "18 April 2010" "" ""
+.TH "WPA_CLI" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_cli \- WPA command line client

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_gui.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_gui.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_gui.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_gui.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_GUI" "8" "18 April 2010" "" ""
+.TH "WPA_GUI" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_gui \- WPA Graphical User Interface

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_passphrase.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_passphrase.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_passphrase.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_passphrase.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_PASSPHRASE" "8" "18 April 2010" "" ""
+.TH "WPA_PASSPHRASE" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_passphrase \- Generate a WPA PSK from an ASCII passphrase for a SSID

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_priv.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_PRIV" "8" "18 April 2010" "" ""
+.TH "WPA_PRIV" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_priv \- wpa_supplicant privilege separation helper

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.8
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.8?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.8 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.8 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_SUPPLICANT" "8" "18 April 2010" "" ""
+.TH "WPA_SUPPLICANT" "8" "07 September 2010" "" ""
 
 .SH NAME
 wpa_supplicant \- Wi-Fi Protected Access client and IEEE 802.1X supplicant

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 Wed Sep  8 01:19:36 2010
@@ -3,7 +3,7 @@
 .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "WPA_SUPPLICANT.CONF" "5" "18 April 2010" "" ""
+.TH "WPA_SUPPLICANT.CONF" "5" "07 September 2010" "" ""
 
 .SH NAME
 wpa_supplicant.conf \- configuration file for wpa_supplicant

Modified: wpasupplicant/trunk/wpa_supplicant/events.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/events.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/events.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/events.c Wed Sep  8 01:19:36 2010
@@ -700,15 +700,7 @@
 static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
 					int timeout_sec, int timeout_usec)
 {
-	if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1) {
-		/*
-		 * Quick recovery if the initial scan results were not
-		 * complete when fetched before the first scan request.
-		 */
-		wpa_s->scan_res_tried++;
-		timeout_sec = 0;
-		timeout_usec = 0;
-	} else if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {
+	if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {
 		/*
 		 * No networks are enabled; short-circuit request so
 		 * we don't wait timeout seconds before transitioning
@@ -884,6 +876,12 @@
 	struct wpa_bss *selected;
 	struct wpa_ssid *ssid = NULL;
 	struct wpa_scan_results *scan_res;
+	int ap = 0;
+
+#ifdef CONFIG_AP
+	if (wpa_s->ap_iface)
+		ap = 1;
+#endif /* CONFIG_AP */
 
 	wpa_supplicant_notify_scanning(wpa_s, 0);
 
@@ -891,7 +889,7 @@
 						   data ? &data->scan_info :
 						   NULL, 1);
 	if (scan_res == NULL) {
-		if (wpa_s->conf->ap_scan == 2)
+		if (wpa_s->conf->ap_scan == 2 || ap)
 			return;
 		wpa_printf(MSG_DEBUG, "Failed to get scan results - try "
 			   "scanning again");
@@ -906,19 +904,15 @@
 		return;
 	}
 
-	/*
-	 * Don't post the results if this was the initial cached
-	 * and there were no results.
-	 */
-	if (wpa_s->scan_res_tried == 1 && wpa_s->conf->ap_scan == 1 &&
-	    scan_res->num == 0) {
-		wpa_msg(wpa_s, MSG_DEBUG, "Cached scan results are "
-			"empty - not posting");
-	} else {
-		wpa_printf(MSG_DEBUG, "New scan results available");
-		wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
-		wpas_notify_scan_results(wpa_s);
-	}
+	if (ap) {
+		wpa_printf(MSG_DEBUG, "Ignore scan results in AP mode");
+		wpa_scan_results_free(scan_res);
+		return;
+	}
+
+	wpa_printf(MSG_DEBUG, "New scan results available");
+	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
+	wpas_notify_scan_results(wpa_s);
 
 	wpas_notify_scan_done(wpa_s, 1);
 
@@ -1173,7 +1167,8 @@
 		wpa_supplicant_scard_init(wpa_s, wpa_s->current_ssid);
 	}
 	wpa_sm_notify_assoc(wpa_s->wpa, bssid);
-	l2_packet_notify_auth_start(wpa_s->l2);
+	if (wpa_s->l2)
+		l2_packet_notify_auth_start(wpa_s->l2);
 
 	/*
 	 * Set portEnabled first to FALSE in order to get EAP state machine out
@@ -1309,6 +1304,7 @@
 	}
 	wpa_supplicant_mark_disassoc(wpa_s);
 	bgscan_deinit(wpa_s);
+	wpa_s->bgscan_ssid = NULL;
 #ifdef CONFIG_SME
 	if (authenticating &&
 	    (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) {
@@ -1593,7 +1589,7 @@
 	case EVENT_DISASSOC:
 		wpa_printf(MSG_DEBUG, "Disassociation notification");
 #ifdef CONFIG_AP
-		if (wpa_s->ap_iface && data) {
+		if (wpa_s->ap_iface && data && data->disassoc_info.addr) {
 			hostapd_notif_disassoc(wpa_s->ap_iface->bss[0],
 					       data->disassoc_info.addr);
 			break;
@@ -1611,7 +1607,7 @@
 				reason_code = data->deauth_info.reason_code;
 		}
 #ifdef CONFIG_AP
-		if (wpa_s->ap_iface && data) {
+		if (wpa_s->ap_iface && data && data->deauth_info.addr) {
 			hostapd_notif_disassoc(wpa_s->ap_iface->bss[0],
 					       data->deauth_info.addr);
 			break;

Modified: wpasupplicant/trunk/wpa_supplicant/scan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/scan.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/scan.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/scan.c Wed Sep  8 01:19:36 2010
@@ -243,8 +243,8 @@
 	struct wpa_ssid *ssid;
 	int scan_req = 0, ret;
 	struct wpabuf *wps_ie = NULL;
+#ifdef CONFIG_WPS
 	int wps = 0;
-#ifdef CONFIG_WPS
 	enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
 #endif /* CONFIG_WPS */
 	struct wpa_driver_scan_params params;
@@ -288,18 +288,6 @@
 #ifdef CONFIG_WPS
 	wps = wpas_wps_in_use(wpa_s->conf, &req_type);
 #endif /* CONFIG_WPS */
-
-	if (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
-	    !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) &&
-	    wps != 2 && !wpa_s->conf->filter_ssids &&
-	    !wpa_s->connect_without_scan) {
-		wpa_s->scan_res_tried++;
-		wpa_printf(MSG_DEBUG, "Trying to get current scan results "
-			   "first without requesting a new scan to speed up "
-			   "initial association");
-		wpa_supplicant_event(wpa_s, EVENT_SCAN_RESULTS, NULL);
-		return;
-	}
 
 	scan_req = wpa_s->scan_req;
 	wpa_s->scan_req = 0;
@@ -426,8 +414,7 @@
 		if (prev_state != wpa_s->wpa_state)
 			wpa_supplicant_set_state(wpa_s, prev_state);
 		wpa_supplicant_req_scan(wpa_s, 1, 0);
-	} else
-		wpa_s->scan_runs++;
+	}
 }
 
 

Modified: wpasupplicant/trunk/wpa_supplicant/sme.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/sme.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/sme.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/sme.c Wed Sep  8 01:19:36 2010
@@ -228,6 +228,7 @@
 	if (wpa_drv_authenticate(wpa_s, &params) < 0) {
 		wpa_msg(wpa_s, MSG_INFO, "Authentication request to the "
 			"driver failed");
+		wpa_supplicant_req_scan(wpa_s, 1, 0);
 		return;
 	}
 
@@ -273,7 +274,33 @@
 	if (data->auth.status_code != WLAN_STATUS_SUCCESS) {
 		wpa_printf(MSG_DEBUG, "SME: Authentication failed (status "
 			   "code %d)", data->auth.status_code);
-		return;
+
+		if (data->auth.status_code !=
+		    WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ||
+		    wpa_s->sme.auth_alg == data->auth.auth_type ||
+		    wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP)
+			return;
+
+		switch (data->auth.auth_type) {
+		case WLAN_AUTH_OPEN:
+			wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED;
+
+			wpa_printf(MSG_DEBUG, "SME: Trying SHARED auth");
+			wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
+						 wpa_s->current_ssid);
+			return;
+
+		case WLAN_AUTH_SHARED_KEY:
+			wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP;
+
+			wpa_printf(MSG_DEBUG, "SME: Trying LEAP auth");
+			wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
+						 wpa_s->current_ssid);
+			return;
+
+		default:
+			return;
+		}
 	}
 
 #ifdef CONFIG_IEEE80211R
@@ -447,7 +474,7 @@
 			union wpa_event_data *data)
 {
 	wpa_printf(MSG_DEBUG, "SME: Disassociation event received");
-	if (!is_zero_ether_addr(wpa_s->bssid) &&
+	if (wpa_s->sme.prev_bssid_set &&
 	    !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)) {
 		/*
 		 * cfg80211/mac80211 can get into somewhat confused state if
@@ -457,7 +484,7 @@
 		 */
 		wpa_printf(MSG_DEBUG, "SME: Deauthenticate to clear driver "
 			   "state");
-		wpa_drv_deauthenticate(wpa_s, wpa_s->bssid,
+		wpa_drv_deauthenticate(wpa_s, wpa_s->sme.prev_bssid,
 				       WLAN_REASON_DEAUTH_LEAVING);
 	}
 }

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=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp Wed Sep  8 01:19:36 2010
@@ -1,6 +1,6 @@
 /*
  * wpa_gui - WpaGui class
- * Copyright (c) 2005-2008, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2005-2010, Jouni Malinen <j at w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -712,7 +712,7 @@
 void WpaGui::helpAbout()
 {
 	QMessageBox::about(this, "wpa_gui for wpa_supplicant",
-			   "Copyright (c) 2003-2008,\n"
+			   "Copyright (c) 2003-2010,\n"
 			   "Jouni Malinen <j at w1.fi>\n"
 			   "and contributors.\n"
 			   "\n"
@@ -971,17 +971,10 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	if (cmd.compare(tr("Select any network"))) {
+	if (cmd.contains(QRegExp("^\\d+:")))
+		cmd.truncate(cmd.indexOf(':'));
+	else
 		cmd = "any";
-	} else {
-		int pos = cmd.indexOf(':');
-		if (pos < 0) {
-			printf("Invalid selectNetwork '%s'\n",
-			       cmd.toAscii().constData());
-			return;
-		}
-		cmd.truncate(pos);
-	}
 	cmd.prepend("SELECT_NETWORK ");
 	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
 	triggerUpdate();
@@ -995,14 +988,12 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	if (!cmd.startsWith("all")) {
-		int pos = cmd.indexOf(':');
-		if (pos < 0) {
-			printf("Invalid enableNetwork '%s'\n",
-			       cmd.toAscii().constData());
-			return;
-		}
-		cmd.truncate(pos);
+	if (cmd.contains(QRegExp("^\\d+:")))
+		cmd.truncate(cmd.indexOf(':'));
+	else if (!cmd.startsWith("all")) {
+		printf("Invalid editNetwork '%s'\n",
+		       cmd.toAscii().constData());
+		return;
 	}
 	cmd.prepend("ENABLE_NETWORK ");
 	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
@@ -1016,14 +1007,12 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	if (!cmd.startsWith("all")) {
-		int pos = cmd.indexOf(':');
-		if (pos < 0) {
-			printf("Invalid disableNetwork '%s'\n",
-			       cmd.toAscii().constData());
-			return;
-		}
-		cmd.truncate(pos);
+	if (cmd.contains(QRegExp("^\\d+:")))
+		cmd.truncate(cmd.indexOf(':'));
+	else if (!cmd.startsWith("all")) {
+		printf("Invalid editNetwork '%s'\n",
+		       cmd.toAscii().constData());
+		return;
 	}
 	cmd.prepend("DISABLE_NETWORK ");
 	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
@@ -1036,14 +1025,8 @@
 	QString cmd(sel);
 	int id = -1;
 
-	if (!cmd.compare(tr("Select any network"))) {
-		int pos = sel.indexOf(':');
-		if (pos < 0) {
-			printf("Invalid editNetwork '%s'\n",
-			       cmd.toAscii().constData());
-			return;
-		}
-		cmd.truncate(pos);
+	if (cmd.contains(QRegExp("^\\d+:"))) {
+		cmd.truncate(cmd.indexOf(':'));
 		id = cmd.toInt();
 	}
 
@@ -1114,17 +1097,12 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	if (cmd.compare(tr("Select any network")))
-		return;
-
-	if (!cmd.startsWith("all")) {
-		int pos = cmd.indexOf(':');
-		if (pos < 0) {
-			printf("Invalid removeNetwork '%s'\n",
-			       cmd.toAscii().constData());
-			return;
-		}
-		cmd.truncate(pos);
+	if (cmd.contains(QRegExp("^\\d+:")))
+		cmd.truncate(cmd.indexOf(':'));
+	else if (!cmd.startsWith("all")) {
+		printf("Invalid editNetwork '%s'\n",
+		       cmd.toAscii().constData());
+		return;
 	}
 	cmd.prepend("REMOVE_NETWORK ");
 	ctrlRequest(cmd.toAscii().constData(), reply, &reply_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=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c Wed Sep  8 01:19:36 2010
@@ -1323,6 +1323,7 @@
 	eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 	if (old_ssid != wpa_s->current_ssid)
 		wpas_notify_network_changed(wpa_s);
+	eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
 }
 
 
@@ -1357,6 +1358,7 @@
 	eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 	if (old_ssid != wpa_s->current_ssid)
 		wpas_notify_network_changed(wpa_s);
+	eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
 }
 
 
@@ -1392,13 +1394,15 @@
 		}
 		if (wpa_s->reassociate)
 			wpa_supplicant_req_scan(wpa_s, 0, 0);
-	} else if (wpa_s->current_ssid == NULL && ssid->disabled) {
-		/*
-		 * Try to reassociate since there is no current configuration
-		 * and a new network was made available.
-		 */
-		wpa_s->reassociate = 1;
-		wpa_supplicant_req_scan(wpa_s, 0, 0);
+	} else if (ssid->disabled) {
+		if (wpa_s->current_ssid == NULL) {
+			/*
+			 * Try to reassociate since there is no current
+			 * configuration and a new network was made available.
+			 */
+			wpa_s->reassociate = 1;
+			wpa_supplicant_req_scan(wpa_s, 0, 0);
+		}
 
 		was_disabled = ssid->disabled;
 

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.nsi
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.nsi?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.nsi (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.nsi Wed Sep  8 01:19:36 2010
@@ -13,8 +13,8 @@
 section -Prerequisites
 	SetOutPath $INSTDIR\Prerequisites
 	MessageBox MB_YESNO "Install WinPcap?" /SD IDYES IDNO endWinPcap
-		File "/opt/Qt-Win/files/WinPcap_4_0_2.exe"
-		ExecWait "$INSTDIR\Prerequisites\WinPcap_4_0_2.exe"
+		File "/opt/Qt-Win/files/WinPcap_4_1_2.exe"
+		ExecWait "$INSTDIR\Prerequisites\WinPcap_4_1_2.exe"
 		Goto endWinPcap
 	endWinPcap:
 sectionEnd
@@ -37,6 +37,7 @@
 	File wpasvc.exe
 
 	File /opt/Qt-Win/files/mingwm10.dll
+	File /opt/Qt-Win/files/libgcc_s_dw2-1.dll
 	File /opt/Qt-Win/files/QtCore4.dll
 	File /opt/Qt-Win/files/QtGui4.dll
 
@@ -96,10 +97,11 @@
 	delete "$INSTDIR\wpasvc.exe"
 
 	delete "$INSTDIR\mingwm10.dll"
+	delete "$INSTDIR\libgcc_s_dw2-1.dll"
 	delete "$INSTDIR\QtCore4.dll"
 	delete "$INSTDIR\QtGui4.dll"
 
-	delete "$INSTDIR\Prerequisites\WinPcap_4_0_2.exe"
+	delete "$INSTDIR\Prerequisites\WinPcap_4_1_2.exe"
 	rmdir "$INSTDIR\Prerequisites"
 
 	rmdir "$INSTDIR"

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=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h Wed Sep  8 01:19:36 2010
@@ -382,10 +382,6 @@
 
 	int scan_req; /* manual scan request; this forces a scan even if there
 		       * are no enabled networks in the configuration */
-	int scan_res_tried; /* whether ap_scan=1 mode has tried to fetch scan
-			     * results without a new scan request; this is used
-			     * to speed up the first association if the driver
-			     * has already available scan results. */
 	int scan_runs; /* number of scan runs since WPS was started */
 
 	struct wpa_client_mlme mlme;

Modified: wpasupplicant/trunk/wpa_supplicant/wpas_glue.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpas_glue.c?rev=1554&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpas_glue.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpas_glue.c Wed Sep  8 01:19:36 2010
@@ -560,6 +560,14 @@
 static void wpa_supplicant_port_cb(void *ctx, int authorized)
 {
 	struct wpa_supplicant *wpa_s = ctx;
+#ifdef CONFIG_AP
+	if (wpa_s->ap_iface) {
+		wpa_printf(MSG_DEBUG, "AP mode active - skip EAPOL Supplicant "
+			   "port status: %s",
+			   authorized ? "Authorized" : "Unauthorized");
+		return;
+	}
+#endif /* CONFIG_AP */
 	wpa_printf(MSG_DEBUG, "EAPOL: Supplicant port status: %s",
 		   authorized ? "Authorized" : "Unauthorized");
 	wpa_drv_set_supp_port(wpa_s, authorized);




More information about the Pkg-wpa-devel mailing list