[pkg-wpa-devel] r1678 - in /wpa/trunk/debian: ./ patches/ patches/upstream/

slh-guest at users.alioth.debian.org slh-guest at users.alioth.debian.org
Sat Apr 7 23:08:17 UTC 2012


Author: slh-guest
Date: Sat Apr  7 23:08:15 2012
New Revision: 1678

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1678
Log:
* import new upstream snapshot 1.0-rc2:
  - import git patches up to hostap_0_7_2-1504-g03de63c.
  - temporarily disable conflicting patches.

Added:
    wpa/trunk/debian/patches/upstream/
    wpa/trunk/debian/patches/upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch
    wpa/trunk/debian/patches/upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch
    wpa/trunk/debian/patches/upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch
    wpa/trunk/debian/patches/upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch
    wpa/trunk/debian/patches/upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch
    wpa/trunk/debian/patches/upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch
    wpa/trunk/debian/patches/upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch
    wpa/trunk/debian/patches/upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch
    wpa/trunk/debian/patches/upstream/0009-Install-only-the-binaries-into-BINDIR.patch
    wpa/trunk/debian/patches/upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch
    wpa/trunk/debian/patches/upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch
    wpa/trunk/debian/patches/upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch
    wpa/trunk/debian/patches/upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch
    wpa/trunk/debian/patches/upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch
    wpa/trunk/debian/patches/upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch
    wpa/trunk/debian/patches/upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch
    wpa/trunk/debian/patches/upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch
    wpa/trunk/debian/patches/upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch
    wpa/trunk/debian/patches/upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch
    wpa/trunk/debian/patches/upstream/0020-P2P-Wait-for-PD-before-join-response.patch
    wpa/trunk/debian/patches/upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch
    wpa/trunk/debian/patches/upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch
    wpa/trunk/debian/patches/upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch
    wpa/trunk/debian/patches/upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch
    wpa/trunk/debian/patches/upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch
    wpa/trunk/debian/patches/upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch
    wpa/trunk/debian/patches/upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch
    wpa/trunk/debian/patches/upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch
    wpa/trunk/debian/patches/upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch
    wpa/trunk/debian/patches/upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch
    wpa/trunk/debian/patches/upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch
    wpa/trunk/debian/patches/upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch
    wpa/trunk/debian/patches/upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch
    wpa/trunk/debian/patches/upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch
    wpa/trunk/debian/patches/upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch
    wpa/trunk/debian/patches/upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch
    wpa/trunk/debian/patches/upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch
    wpa/trunk/debian/patches/upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch
    wpa/trunk/debian/patches/upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch
    wpa/trunk/debian/patches/upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch
    wpa/trunk/debian/patches/upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch
    wpa/trunk/debian/patches/upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch
    wpa/trunk/debian/patches/upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch
    wpa/trunk/debian/patches/upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch
    wpa/trunk/debian/patches/upstream/0045-dbus-revert-changes-to-some-peer-properties.patch
    wpa/trunk/debian/patches/upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch
    wpa/trunk/debian/patches/upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch
    wpa/trunk/debian/patches/upstream/0048-Fix-processing-of-channel-list-update-events.patch
    wpa/trunk/debian/patches/upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch
    wpa/trunk/debian/patches/upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch
    wpa/trunk/debian/patches/upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch
    wpa/trunk/debian/patches/upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch
    wpa/trunk/debian/patches/upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch
    wpa/trunk/debian/patches/upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch
    wpa/trunk/debian/patches/upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch
    wpa/trunk/debian/patches/upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch
    wpa/trunk/debian/patches/upstream/0057-BSS-Fix-use-after-realloc.patch
    wpa/trunk/debian/patches/upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch
Removed:
    wpa/trunk/debian/patches/for-MS-CHAP-convert-the-password-from-UTF-8-to-UCS-2.patch
Modified:
    wpa/trunk/debian/changelog
    wpa/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch
    wpa/trunk/debian/patches/12_wpa_gui_knotify_support.patch
    wpa/trunk/debian/patches/series

Modified: wpa/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/changelog?rev=1678&op=diff
==============================================================================
--- wpa/trunk/debian/changelog (original)
+++ wpa/trunk/debian/changelog Sat Apr  7 23:08:15 2012
@@ -1,6 +1,9 @@
 wpa (1.0~rc2-1) UNRELEASED; urgency=low
 
   * NOT RELEASED YET
+  * import new upstream snapshot 1.0-rc2:
+    - import git patches up to hostap_0_7_2-1504-g03de63c.
+    - temporarily disable conflicting patches.
   * merge source packages for hostapd and wpasupplicant under the new name
     "wpa", which is also used by upstream.
   * restrict wpasupplicant to linux-any and kfreebsd-any, hurd lacks kernel
@@ -9,7 +12,7 @@
   * update dep-5 version to final 1.0, no changes necessary:
     - order licenses alphabetically.
 
- -- Stefan Lippers-Hollmann <s.l-h at gmx.de>  Sun, 08 Apr 2012 01:00:36 +0200
+ -- Stefan Lippers-Hollmann <s.l-h at gmx.de>  Sun, 08 Apr 2012 01:06:52 +0200
 
 wpasupplicant (0.7.3-6) unstable; urgency=low
 

Modified: wpa/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch?rev=1678&op=diff
==============================================================================
--- wpa/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch (original)
+++ wpa/trunk/debian/patches/01_use_pkg-config_for_pcsc-lite_module.patch Sat Apr  7 23:08:15 2012
@@ -5,7 +5,7 @@
 ---
 --- a/wpa_supplicant/Makefile
 +++ b/wpa_supplicant/Makefile
-@@ -691,7 +691,7 @@ ifdef CONFIG_NATIVE_WINDOWS
+@@ -776,7 +776,7 @@ ifdef CONFIG_NATIVE_WINDOWS
  #dynamic symbol loading that is now used in pcsc_funcs.c
  #LIBS += -lwinscard
  else

Modified: wpa/trunk/debian/patches/12_wpa_gui_knotify_support.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/12_wpa_gui_knotify_support.patch?rev=1678&op=diff
==============================================================================
--- wpa/trunk/debian/patches/12_wpa_gui_knotify_support.patch (original)
+++ wpa/trunk/debian/patches/12_wpa_gui_knotify_support.patch Sat Apr  7 23:08:15 2012
@@ -18,7 +18,7 @@
  
  #include "wpagui.h"
  #include "dirent.h"
-@@ -1327,10 +1330,21 @@ void WpaGui::createTrayIcon(bool trayOnl
+@@ -1343,10 +1346,21 @@ void WpaGui::createTrayIcon(bool trayOnl
  void WpaGui::showTrayMessage(QSystemTrayIcon::MessageIcon type, int sec,
  			     const QString & msg)
  {

Modified: wpa/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/series?rev=1678&op=diff
==============================================================================
--- wpa/trunk/debian/patches/series (original)
+++ wpa/trunk/debian/patches/series Sat Apr  7 23:08:15 2012
@@ -1,9 +1,67 @@
+upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch
+upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch
+upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch
+upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch
+upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch
+upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch
+upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch
+upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch
+upstream/0009-Install-only-the-binaries-into-BINDIR.patch
+upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch
+upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch
+upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch
+upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch
+upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch
+upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch
+upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch
+upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch
+upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch
+upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch
+upstream/0020-P2P-Wait-for-PD-before-join-response.patch
+upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch
+upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch
+upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch
+upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch
+upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch
+upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch
+upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch
+upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch
+upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch
+upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch
+upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch
+upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch
+upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch
+upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch
+upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch
+upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch
+upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch
+upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch
+upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch
+upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch
+upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch
+upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch
+upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch
+upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch
+upstream/0045-dbus-revert-changes-to-some-peer-properties.patch
+upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch
+upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch
+upstream/0048-Fix-processing-of-channel-list-update-events.patch
+upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch
+upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch
+upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch
+upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch
+upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch
+upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch
+upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch
+upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch
+upstream/0057-BSS-Fix-use-after-realloc.patch
+upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch
+
 01_use_pkg-config_for_pcsc-lite_module.patch
 02_dbus_group_policy.patch
 06_wpa_gui_menu_exec_path.patch
-07_dbus_service_syslog.patch
-09_dbus_emit_change_events.patch
+#07_dbus_service_syslog.patch
+#09_dbus_emit_change_events.patch
 12_wpa_gui_knotify_support.patch
 13_human_readable_signal.patch
-hostap_allow-linking-with-libnl-3.2.patch
-for-MS-CHAP-convert-the-password-from-UTF-8-to-UCS-2.patch
+#hostap_allow-linking-with-libnl-3.2.patch

Added: wpa/trunk/debian/patches/upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch (added)
+++ wpa/trunk/debian/patches/upstream/0001-Fix-ap_sta_disconnect-to-clear-EAPOL-WPA-authenticat.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,35 @@
+From 22d947a783670d30e523d07e6470e840c6541bc0 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Wed, 25 Jan 2012 22:32:58 +0200
+Subject: [PATCH 01/58] Fix ap_sta_disconnect() to clear EAPOL/WPA
+ authenticator state
+
+Number of places in hostapd use ap_sta_disconnect() instead of
+ap_sta_disassociate() or ap_sta_deauthenticate(). There are some
+differences between these functions, e.g., in the area how quickly
+the EAPOL state machines get deinitialized. This can result in
+somewhat unexpected events since the EAPOL/WPA authenticator
+state machines could remain running after deauthentication.
+
+Address this by forcing EAPOL/WPA authenticator state machines
+to disabled state whenever ap_sta_disconnect() is called instead
+of waiting for the deauthentication callback or other timeout
+to clear the STA.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit ceb997f394773075c292e81c69cdd24717e7d1d5)
+---
+ src/ap/sta_info.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -806,6 +806,8 @@ void ap_sta_disconnect(struct hostapd_da
+ 	if (sta == NULL)
+ 		return;
+ 	ap_sta_set_authorized(hapd, sta, 0);
++	wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH);
++	ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
+ 	sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
+ 	eloop_cancel_timeout(ap_handle_timer, hapd, sta);
+ 	eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,

Added: wpa/trunk/debian/patches/upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch (added)
+++ wpa/trunk/debian/patches/upstream/0002-P2P-Fix-WSC-IE-inclusion-for-P2P-disabled-case.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,37 @@
+From d34000c61fc1db6f89e9a9de7b7b6d0dffd20d2c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Fri, 27 Jan 2012 21:09:34 +0200
+Subject: [PATCH 02/58] P2P: Fix WSC IE inclusion for P2P disabled case
+
+wpas_wps_in_use() was forcing WPS to be enabled unconditionally if P2P
+support was included in the build. This is not really the correct
+behavior for the case when P2P has been disabled at runtime. Change the
+code here to verify runtime configuration of P2P before forcing WPS to
+be enabled. This allows WSC IE to be left out from Probe Request frames
+when scanning for APs without P2P or WPS being in use.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit b21ff9cb20657e293db139f86b6d90a202c452c2)
+---
+ wpa_supplicant/scan.c |   10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/wpa_supplicant/scan.c
++++ b/wpa_supplicant/scan.c
+@@ -71,10 +71,12 @@ static int wpas_wps_in_use(struct wpa_su
+ 	}
+ 
+ #ifdef CONFIG_P2P
+-	wpa_s->wps->dev.p2p = 1;
+-	if (!wps) {
+-		wps = 1;
+-		*req_type = WPS_REQ_ENROLLEE_INFO;
++	if (!wpa_s->global->p2p_disabled && wpa_s->global->p2p) {
++		wpa_s->wps->dev.p2p = 1;
++		if (!wps) {
++			wps = 1;
++			*req_type = WPS_REQ_ENROLLEE_INFO;
++		}
+ 	}
+ #endif /* CONFIG_P2P */
+ 

Added: wpa/trunk/debian/patches/upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch (added)
+++ wpa/trunk/debian/patches/upstream/0003-WPS-Fix-an-interoperability-issue-with-mixed-mode-an.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,76 @@
+From cb57320c7ffdc1115e06b28e1028c9ec382b3e19 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Fri, 27 Jan 2012 22:32:15 +0200
+Subject: [PATCH 03/58] WPS: Fix an interoperability issue with mixed mode and
+ AP Settings
+
+It looks like Windows 7 WPS implementation does not like multiple
+Authentication/Encryption Type bits to be set in M7 AP Settings
+attributes, i.e., it refused to add a network profile if the AP
+was configured for WPA/WPA2 mixed mode and AP PIN was used to
+enroll the network.
+
+Leave only a single bit set in the Authentication/Encryption Type
+attributes in M7 when the AP is acting as an Enrollee to avoid this
+issue.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit ce7b56afab8e6065e886b9471fa8071c8d2bd66b)
+---
+ src/wps/wps_enrollee.c |   35 +++++++++++++++++++++++++++++++----
+ 1 file changed, 31 insertions(+), 4 deletions(-)
+
+--- a/src/wps/wps_enrollee.c
++++ b/src/wps/wps_enrollee.c
+@@ -257,20 +257,47 @@ static int wps_build_cred_ssid(struct wp
+ 
+ static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg)
+ {
+-	wpa_printf(MSG_DEBUG, "WPS:  * Authentication Type");
++	u16 auth_type = wps->wps->auth_types;
++
++	/* Select the best authentication type */
++	if (auth_type & WPS_AUTH_WPA2PSK)
++		auth_type = WPS_AUTH_WPA2PSK;
++	else if (auth_type & WPS_AUTH_WPAPSK)
++		auth_type = WPS_AUTH_WPAPSK;
++	else if (auth_type & WPS_AUTH_OPEN)
++		auth_type = WPS_AUTH_OPEN;
++	else if (auth_type & WPS_AUTH_SHARED)
++		auth_type = WPS_AUTH_SHARED;
++
++	wpa_printf(MSG_DEBUG, "WPS:  * Authentication Type (0x%x)", auth_type);
+ 	wpabuf_put_be16(msg, ATTR_AUTH_TYPE);
+ 	wpabuf_put_be16(msg, 2);
+-	wpabuf_put_be16(msg, wps->wps->auth_types);
++	wpabuf_put_be16(msg, auth_type);
+ 	return 0;
+ }
+ 
+ 
+ static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg)
+ {
+-	wpa_printf(MSG_DEBUG, "WPS:  * Encryption Type");
++	u16 encr_type = wps->wps->encr_types;
++
++	/* Select the best encryption type */
++	if (wps->wps->auth_types & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK)) {
++		if (encr_type & WPS_ENCR_AES)
++			encr_type = WPS_ENCR_AES;
++		else if (encr_type & WPS_ENCR_TKIP)
++			encr_type = WPS_ENCR_TKIP;
++	} else {
++		if (encr_type & WPS_ENCR_WEP)
++			encr_type = WPS_ENCR_WEP;
++		else if (encr_type & WPS_ENCR_NONE)
++			encr_type = WPS_ENCR_NONE;
++	}
++
++	wpa_printf(MSG_DEBUG, "WPS:  * Encryption Type (0x%x)", encr_type);
+ 	wpabuf_put_be16(msg, ATTR_ENCR_TYPE);
+ 	wpabuf_put_be16(msg, 2);
+-	wpabuf_put_be16(msg, wps->wps->encr_types);
++	wpabuf_put_be16(msg, encr_type);
+ 	return 0;
+ }
+ 

Added: wpa/trunk/debian/patches/upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch (added)
+++ wpa/trunk/debian/patches/upstream/0004-dbus-Create-DBus-getter-setter-for-FastReauth.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,104 @@
+From 5045a668201f1027dbcc91bd8d092bbcee15a2e3 Mon Sep 17 00:00:00 2001
+From: Paul Stewart <pstew at chromium.org>
+Date: Sat, 28 Jan 2012 11:21:37 +0200
+Subject: [PATCH 04/58] dbus: Create DBus getter/setter for FastReauth
+
+Provide a means over DBus to set the conf->fast_reauth
+property, which controls whether TLS session resumption
+should be attempted for EAP-TLS 802.1X networks.
+
+Signed-off-by: Paul Stewart <pstew at chromium.org>
+(cherry picked from commit a4bbb6066d044c5fcac4e291349538ad3a46e164)
+---
+ wpa_supplicant/dbus/dbus_new.c          |    4 +++
+ wpa_supplicant/dbus/dbus_new_handlers.c |   48 +++++++++++++++++++++++++++++++
+ wpa_supplicant/dbus/dbus_new_handlers.h |    8 ++++++
+ 3 files changed, 60 insertions(+)
+
+--- a/wpa_supplicant/dbus/dbus_new.c
++++ b/wpa_supplicant/dbus/dbus_new.c
+@@ -2556,6 +2556,10 @@ static const struct wpa_dbus_property_de
+ 	  wpas_dbus_getter_networks,
+ 	  NULL
+ 	},
++	{ "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
++	  wpas_dbus_getter_fast_reauth,
++	  wpas_dbus_setter_fast_reauth
++	},
+ #ifdef CONFIG_WPS
+ 	{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
+ 	  wpas_dbus_getter_process_credentials,
+--- a/wpa_supplicant/dbus/dbus_new_handlers.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers.c
+@@ -2182,6 +2182,54 @@ dbus_bool_t wpas_dbus_setter_ap_scan(DBu
+ 
+ 
+ /**
++ * wpas_dbus_getter_fast_reauth - Control fast
++ * reauthentication (TLS session resumption)
++ * @iter: Pointer to incoming dbus message iter
++ * @error: Location to store error on failure
++ * @user_data: Function specific data
++ * Returns: TRUE on success, FALSE on failure
++ *
++ * Getter function for "FastReauth" property.
++ */
++dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
++					 DBusError *error,
++					 void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	dbus_bool_t fast_reauth = wpa_s->conf->fast_reauth ? TRUE : FALSE;
++
++	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
++						&fast_reauth, error);
++}
++
++
++/**
++ * wpas_dbus_setter_fast_reauth - Control fast
++ * reauthentication (TLS session resumption)
++ * @iter: Pointer to incoming dbus message iter
++ * @error: Location to store error on failure
++ * @user_data: Function specific data
++ * Returns: TRUE on success, FALSE on failure
++ *
++ * Setter function for "FastReauth" property.
++ */
++dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
++				     DBusError *error,
++				     void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	dbus_bool_t fast_reauth;
++
++	if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_BOOLEAN,
++					      &fast_reauth))
++		return FALSE;
++
++	wpa_s->conf->fast_reauth = fast_reauth;
++	return TRUE;
++}
++
++
++/**
+  * wpas_dbus_getter_bss_expire_age - Get BSS entry expiration age
+  * @iter: Pointer to incoming dbus message iter
+  * @error: Location to store error on failure
+--- a/wpa_supplicant/dbus/dbus_new_handlers.h
++++ b/wpa_supplicant/dbus/dbus_new_handlers.h
+@@ -133,6 +133,14 @@ dbus_bool_t wpas_dbus_getter_ap_scan(DBu
+ dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
+ 				     void *user_data);
+ 
++dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
++					 DBusError *error,
++					 void *user_data);
++
++dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
++					 DBusError *error,
++					 void *user_data);
++
+ dbus_bool_t wpas_dbus_getter_bss_expire_age(DBusMessageIter *iter,
+ 					    DBusError *error, void *user_data);
+ 

Added: wpa/trunk/debian/patches/upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch (added)
+++ wpa/trunk/debian/patches/upstream/0005-dbus-Fix-endianness-bug-in-Frequency-and-Signal-prop.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,52 @@
+From 42f93a9a0f1858ba8492a1349515624965a64e34 Mon Sep 17 00:00:00 2001
+From: Sylvestre Gallon <ccna.syl at gmail.com>
+Date: Sat, 28 Jan 2012 17:57:48 +0200
+Subject: [PATCH 05/58] dbus: Fix endianness bug in Frequency and Signal
+ properties
+
+These properties did not work on big endian PowerPC (always 100% for
+Signal and 0 for Frequency) due to endianness problem (u32 to u16 data
+loss).
+
+Signed-off-by: Sylvestre Gallon <ccna.syl at gmail.com>
+(cherry picked from commit 3d0a843823a05b159eeaa47b59f9e4ec66e74a8f)
+---
+ wpa_supplicant/dbus/dbus_new_handlers.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new_handlers.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers.c
+@@ -2870,13 +2870,15 @@ dbus_bool_t wpas_dbus_getter_bss_signal(
+ {
+ 	struct bss_handler_args *args = user_data;
+ 	struct wpa_bss *res;
++	s16 level;
+ 
+ 	res = get_bss_helper(args, error, __func__);
+ 	if (!res)
+ 		return FALSE;
+ 
++	level = (s16) res->level;
+ 	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT16,
+-						&res->level, error);
++						&level, error);
+ }
+ 
+ 
+@@ -2894,13 +2896,15 @@ dbus_bool_t wpas_dbus_getter_bss_frequen
+ {
+ 	struct bss_handler_args *args = user_data;
+ 	struct wpa_bss *res;
++	u16 freq;
+ 
+ 	res = get_bss_helper(args, error, __func__);
+ 	if (!res)
+ 		return FALSE;
+ 
++	freq = (u16) res->freq;
+ 	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
+-						&res->freq, error);
++						&freq, error);
+ }
+ 
+ 

Added: wpa/trunk/debian/patches/upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch (added)
+++ wpa/trunk/debian/patches/upstream/0006-wpa_debug-Support-outputting-hexdumps-into-syslog.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,57 @@
+From f59767ce009d8a95f71807ca3d42fd61be7a8066 Mon Sep 17 00:00:00 2001
+From: Nicolas Cavallari <Nicolas.Cavallari at lri.fr>
+Date: Sun, 29 Jan 2012 12:13:43 +0200
+Subject: [PATCH 06/58] wpa_debug: Support outputting hexdumps into syslog
+
+This patch allows to log hexdumps into syslog.
+
+This is useful when testing, as syslog's network logging
+helps to collect debug outputs from several machines.
+
+Signed-hostapd: Nicolas Cavallari <cavallar at lri.fr>
+(cherry picked from commit f31e19df3a97f0610300c847f13c4e4b4656c477)
+---
+ src/utils/wpa_debug.c |   32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+--- a/src/utils/wpa_debug.c
++++ b/src/utils/wpa_debug.c
+@@ -166,6 +166,38 @@ static void _wpa_hexdump(int level, cons
+ 	size_t i;
+ 	if (level < wpa_debug_level)
+ 		return;
++#ifdef CONFIG_DEBUG_SYSLOG
++	if (wpa_debug_syslog) {
++		const char *display;
++		char *strbuf = NULL;
++
++		if (buf == NULL) {
++			display = " [NULL]";
++		} else if (len == 0) {
++			display = "";
++		} else if (show && len) {
++			strbuf = os_malloc(1 + 3 * len);
++			if (strbuf == NULL) {
++				wpa_printf(MSG_ERROR, "wpa_hexdump: Failed to "
++					   "allocate message buffer");
++				return;
++			}
++
++			for (i = 0; i < len; i++)
++				os_snprintf(&strbuf[i * 3], 4, " %02x",
++					    buf[i]);
++
++			display = strbuf;
++		} else {
++			display = " [REMOVED]";
++		}
++
++		syslog(syslog_priority(level), "%s - hexdump(len=%lu):%s",
++		       title, len, display);
++		os_free(strbuf);
++		return;
++	}
++#endif /* CONFIG_DEBUG_SYSLOG */
+ 	wpa_debug_print_timestamp();
+ #ifdef CONFIG_DEBUG_FILE
+ 	if (out_file) {

Added: wpa/trunk/debian/patches/upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch (added)
+++ wpa/trunk/debian/patches/upstream/0007-dbus-Remove-unused-D-Bus-version-defines.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,77 @@
+From 7efba08f36b18c07e06bafacf7f97b2bf98dd038 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 29 Jan 2012 12:53:12 +0200
+Subject: [PATCH 07/58] dbus: Remove unused D-Bus version defines
+
+These have not been used since commit
+8ddef94bd41747ba658ed4ed5dfa9e62b4b84cfa.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit 9013edc300bbe7b3dff552d6cbe2b7d278146f9f)
+---
+ wpa_supplicant/Android.mk    |   11 -----------
+ wpa_supplicant/Makefile      |   11 -----------
+ wpa_supplicant/dbus/Makefile |   12 ------------
+ 3 files changed, 34 deletions(-)
+
+--- a/wpa_supplicant/Android.mk
++++ b/wpa_supplicant/Android.mk
+@@ -1171,17 +1171,6 @@ endif
+ ifndef DBUS_INCLUDE
+ DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
+ endif
+-dbus_version=$(subst ., ,$(shell $(PKG_CONFIG) --modversion dbus-1))
+-DBUS_VERSION_MAJOR=$(word 1,$(dbus_version))
+-DBUS_VERSION_MINOR=$(word 2,$(dbus_version))
+-ifeq ($(DBUS_VERSION_MAJOR),)
+-DBUS_VERSION_MAJOR=0
+-endif
+-ifeq ($(DBUS_VERSION_MINOR),)
+-DBUS_VERSION_MINOR=0
+-endif
+-DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
+-DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
+ DBUS_CFLAGS += $(DBUS_INCLUDE)
+ endif
+ 
+--- a/wpa_supplicant/Makefile
++++ b/wpa_supplicant/Makefile
+@@ -1150,17 +1150,6 @@ endif
+ ifndef DBUS_INCLUDE
+ DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
+ endif
+-dbus_version=$(subst ., ,$(shell $(PKG_CONFIG) --modversion dbus-1))
+-DBUS_VERSION_MAJOR=$(word 1,$(dbus_version))
+-DBUS_VERSION_MINOR=$(word 2,$(dbus_version))
+-ifeq ($(DBUS_VERSION_MAJOR),)
+-DBUS_VERSION_MAJOR=0
+-endif
+-ifeq ($(DBUS_VERSION_MINOR),)
+-DBUS_VERSION_MINOR=0
+-endif
+-DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
+-DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
+ DBUS_CFLAGS += $(DBUS_INCLUDE)
+ endif
+ 
+--- a/wpa_supplicant/dbus/Makefile
++++ b/wpa_supplicant/dbus/Makefile
+@@ -50,18 +50,6 @@ DBUS_INCLUDE += $(shell xml2-config --cf
+ DBUS_LIBS += $(shell xml2-config --libs)
+ endif
+ 
+-dbus_version=$(subst ., ,$(shell $(PKG_CONFIG) --modversion dbus-1))
+-DBUS_VERSION_MAJOR=$(word 1,$(dbus_version))
+-DBUS_VERSION_MINOR=$(word 2,$(dbus_version))
+-ifeq ($(DBUS_VERSION_MAJOR),)
+-DBUS_VERSION_MAJOR=0
+-endif
+-ifeq ($(DBUS_VERSION_MINOR),)
+-DBUS_VERSION_MINOR=0
+-endif
+-DBUS_INCLUDE += -DDBUS_VERSION_MAJOR=$(DBUS_VERSION_MAJOR)
+-DBUS_INCLUDE += -DDBUS_VERSION_MINOR=$(DBUS_VERSION_MINOR)
+-
+ CFLAGS += $(DBUS_INCLUDE)
+ 
+ LIB_OBJS= \

Added: wpa/trunk/debian/patches/upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch (added)
+++ wpa/trunk/debian/patches/upstream/0008-build-Fix-install-target-parent-directory-prerequisi.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,32 @@
+From 2c8924e2ad63f27a677f6366054f61496fbd992d Mon Sep 17 00:00:00 2001
+From: Grant Erickson <marathon96 at gmail.com>
+Date: Sun, 29 Jan 2012 14:18:22 +0200
+Subject: [PATCH 08/58] build: Fix install target parent directory
+ prerequisites
+
+This changes the install target such that parent directories of
+installed paths area created and each path is only installed
+on a dependency basis.
+
+Signed-off-by: Grant Erickson <marathon96 at gmail.com>
+(cherry picked from commit b1117643846bdcd104e04512f84ae131e7e60eb5)
+---
+ wpa_supplicant/Makefile |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/wpa_supplicant/Makefile
++++ b/wpa_supplicant/Makefile
+@@ -48,9 +48,10 @@ mkconfig:
+ 	echo CONFIG_DRIVER_HOSTAP=y >> .config
+ 	echo CONFIG_DRIVER_WEXT=y >> .config
+ 
+-install: all
+-	mkdir -p $(DESTDIR)$(BINDIR)
+-	for i in $(ALL); do cp $$i $(DESTDIR)$(BINDIR)/$$i; done
++$(DESTDIR)$(BINDIR)/%: %
++	install -D $(<) $(@)
++
++install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
+ 	$(MAKE) -C ../src install
+ 
+ OBJS = config.o

Added: wpa/trunk/debian/patches/upstream/0009-Install-only-the-binaries-into-BINDIR.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0009-Install-only-the-binaries-into-BINDIR.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0009-Install-only-the-binaries-into-BINDIR.patch (added)
+++ wpa/trunk/debian/patches/upstream/0009-Install-only-the-binaries-into-BINDIR.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,40 @@
+From 8dee7fb2a435b2b6f5d452bd7a7bb30f3f3ccef0 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 29 Jan 2012 14:20:41 +0200
+Subject: [PATCH 09/58] Install only the binaries into BINDIR
+
+There is no point in installing *.service files into BINDIR.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit ea5cb06ef907d4453c75d700bbf0322192990cb8)
+---
+ wpa_supplicant/Makefile |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/wpa_supplicant/Makefile
++++ b/wpa_supplicant/Makefile
+@@ -15,12 +15,13 @@ CFLAGS += -I../src/utils
+ 
+ -include .config
+ 
+-ALL=wpa_supplicant wpa_cli
++BINALL=wpa_supplicant wpa_cli
+ 
+ ifndef CONFIG_NO_WPA_PASSPHRASE
+-ALL += wpa_passphrase
++BINALL += wpa_passphrase
+ endif
+ 
++ALL = $(BINALL)
+ ALL += systemd/wpa_supplicant.service
+ ALL += systemd/wpa_supplicant at .service
+ ALL += systemd/wpa_supplicant-nl80211 at .service
+@@ -51,7 +52,7 @@ mkconfig:
+ $(DESTDIR)$(BINDIR)/%: %
+ 	install -D $(<) $(@)
+ 
+-install: $(addprefix $(DESTDIR)$(BINDIR)/,$(ALL))
++install: $(addprefix $(DESTDIR)$(BINDIR)/,$(BINALL))
+ 	$(MAKE) -C ../src install
+ 
+ OBJS = config.o

Added: wpa/trunk/debian/patches/upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch (added)
+++ wpa/trunk/debian/patches/upstream/0010-SME-Fix-processing-of-Authentication-timeout-and-fai.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,38 @@
+From bcc8fb87aac9b5ffd5f9d09da606d3847ea39223 Mon Sep 17 00:00:00 2001
+From: Eyal Shapira <eyal at wizery.com>
+Date: Sun, 29 Jan 2012 17:44:31 +0200
+Subject: [PATCH 10/58] SME: Fix processing of Authentication timeout and
+ failure
+
+current_bss and pending_bssid weren't cleaned up so BSS
+kept appearing in the scan results even when it was actually gone.
+Use wpa_supplicant_mark_disassoc() to cleanup the wpa_s context
+instead of just dropping wpa_state back to DISCONNECTED.
+
+Reported-by: Vishal Mahaveer <vishalm at ti.com>
+Signed-hostap: Eyal Shapira <eyal at wizery.com>
+(cherry picked from commit 1193dc8fd7a9d67d84492141457a7a5ffc541728)
+---
+ wpa_supplicant/sme.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/wpa_supplicant/sme.c
++++ b/wpa_supplicant/sme.c
+@@ -275,8 +275,8 @@ void sme_authenticate(struct wpa_supplic
+ 	if (wpa_drv_authenticate(wpa_s, &params) < 0) {
+ 		wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
+ 			"driver failed");
+-		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ 		wpas_connection_failed(wpa_s, bss->bssid);
++		wpa_supplicant_mark_disassoc(wpa_s);
+ 		return;
+ 	}
+ 
+@@ -514,6 +514,7 @@ void sme_event_auth_timed_out(struct wpa
+ {
+ 	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out");
+ 	wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
++	wpa_supplicant_mark_disassoc(wpa_s);
+ }
+ 
+ 

Added: wpa/trunk/debian/patches/upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch (added)
+++ wpa/trunk/debian/patches/upstream/0011-WPS-Disable-AP-PIN-after-10-consecutive-failures.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,161 @@
+From 17b627e29b9f718a074781efc77323f38b52ab36 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Mon, 30 Jan 2012 17:31:06 +0200
+Subject: [PATCH 11/58] WPS: Disable AP PIN after 10 consecutive failures
+
+While the exponential increase in the lockout period provides an
+efficient mitigation mechanism against brute force attacks, this
+additional trigger to enter indefinite lockout period (cleared by
+restarting hostapd) will limit attacks even further by giving maximum of
+10 attempts (without authorized user action) even in a very long term
+attack.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 32cdcf15b2d6716d6d348262e4870b3d64289926)
+---
+ src/ap/hostapd.h                |    1 +
+ src/ap/wps_hostapd.c            |   45 ++++++++++++++++++++++++++++++++++++---
+ src/wps/wps.h                   |    7 +++++-
+ src/wps/wps_enrollee.c          |    4 ++++
+ wpa_supplicant/wps_supplicant.c |    2 ++
+ 5 files changed, 55 insertions(+), 4 deletions(-)
+
+--- a/src/ap/hostapd.h
++++ b/src/ap/hostapd.h
+@@ -124,6 +124,7 @@ struct hostapd_data {
+ 	struct wpabuf *wps_probe_resp_ie;
+ #ifdef CONFIG_WPS
+ 	unsigned int ap_pin_failures;
++	unsigned int ap_pin_failures_consecutive;
+ 	struct upnp_wps_device_sm *wps_upnp;
+ 	unsigned int ap_pin_lockout_time;
+ #endif /* CONFIG_WPS */
+--- a/src/ap/wps_hostapd.c
++++ b/src/ap/wps_hostapd.c
+@@ -512,6 +512,8 @@ static void hostapd_wps_reenable_ap_pin(
+ 
+ 	if (hapd->conf->ap_setup_locked)
+ 		return;
++	if (hapd->ap_pin_failures_consecutive >= 10)
++		return;
+ 
+ 	wpa_printf(MSG_DEBUG, "WPS: Re-enable AP PIN");
+ 	wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_SETUP_UNLOCKED);
+@@ -533,8 +535,10 @@ static int wps_pwd_auth_fail(struct host
+ 	 * force attacks.
+ 	 */
+ 	hapd->ap_pin_failures++;
+-	wpa_printf(MSG_DEBUG, "WPS: AP PIN authentication failure number %u",
+-		   hapd->ap_pin_failures);
++	hapd->ap_pin_failures_consecutive++;
++	wpa_printf(MSG_DEBUG, "WPS: AP PIN authentication failure number %u "
++		   "(%u consecutive)",
++		   hapd->ap_pin_failures, hapd->ap_pin_failures_consecutive);
+ 	if (hapd->ap_pin_failures < 3)
+ 		return 0;
+ 
+@@ -543,7 +547,15 @@ static int wps_pwd_auth_fail(struct host
+ 
+ 	wps_registrar_update_ie(hapd->wps->registrar);
+ 
+-	if (!hapd->conf->ap_setup_locked) {
++	if (!hapd->conf->ap_setup_locked &&
++	    hapd->ap_pin_failures_consecutive >= 10) {
++		/*
++		 * In indefinite lockdown - disable automatic AP PIN
++		 * reenablement.
++		 */
++		eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
++		wpa_printf(MSG_DEBUG, "WPS: AP PIN disabled indefinitely");
++	} else 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 &&
+@@ -569,6 +581,29 @@ static void hostapd_pwd_auth_fail(struct
+ }
+ 
+ 
++static int wps_ap_pin_success(struct hostapd_data *hapd, void *ctx)
++{
++	if (hapd->conf->ap_pin == NULL || hapd->wps == NULL)
++		return 0;
++
++	if (hapd->ap_pin_failures_consecutive == 0)
++		return 0;
++
++	wpa_printf(MSG_DEBUG, "WPS: Clear consecutive AP PIN failure counter "
++		   "- total validation failures %u (%u consecutive)",
++		   hapd->ap_pin_failures, hapd->ap_pin_failures_consecutive);
++	hapd->ap_pin_failures_consecutive = 0;
++
++	return 0;
++}
++
++
++static void hostapd_wps_ap_pin_success(struct hostapd_data *hapd)
++{
++	hostapd_wps_for_each(hapd, wps_ap_pin_success, NULL);
++}
++
++
+ static const char * wps_event_fail_reason[NUM_WPS_EI_VALUES] = {
+ 	"No Error", /* WPS_EI_NO_ERROR */
+ 	"TKIP Only Prohibited", /* WPS_EI_SECURITY_TKIP_ONLY_PROHIBITED */
+@@ -628,6 +663,9 @@ static void hostapd_wps_event_cb(void *c
+ 		break;
+ 	case WPS_EV_ER_SET_SELECTED_REGISTRAR:
+ 		break;
++	case WPS_EV_AP_PIN_SUCCESS:
++		hostapd_wps_ap_pin_success(hapd);
++		break;
+ 	}
+ 	if (hapd->wps_event_cb)
+ 		hapd->wps_event_cb(hapd->wps_event_cb_ctx, event, data);
+@@ -1287,6 +1325,7 @@ static void hostapd_wps_ap_pin_enable(st
+ {
+ 	wpa_printf(MSG_DEBUG, "WPS: Enabling AP PIN (timeout=%d)", timeout);
+ 	hapd->ap_pin_failures = 0;
++	hapd->ap_pin_failures_consecutive = 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);
+--- a/src/wps/wps.h
++++ b/src/wps/wps.h
+@@ -457,7 +457,12 @@ enum wps_event {
+ 	/**
+ 	 * WPS_EV_ER_SET_SELECTED_REGISTRAR - ER: SetSelectedRegistrar event
+ 	 */
+-	WPS_EV_ER_SET_SELECTED_REGISTRAR
++	WPS_EV_ER_SET_SELECTED_REGISTRAR,
++
++	/**
++	 * WPS_EV_AP_PIN_SUCCESS - External Registrar used correct AP PIN
++	 */
++	WPS_EV_AP_PIN_SUCCESS
+ };
+ 
+ /**
+--- a/src/wps/wps_enrollee.c
++++ b/src/wps/wps_enrollee.c
+@@ -1064,6 +1064,10 @@ static enum wps_process_res wps_process_
+ 	}
+ 	wpabuf_free(decrypted);
+ 
++	if (wps->wps->ap)
++		wps->wps->event_cb(wps->wps->cb_ctx, WPS_EV_AP_PIN_SUCCESS,
++				   NULL);
++
+ 	wps->state = SEND_M7;
+ 	return WPS_CONTINUE;
+ }
+--- a/wpa_supplicant/wps_supplicant.c
++++ b/wpa_supplicant/wps_supplicant.c
+@@ -663,6 +663,8 @@ static void wpa_supplicant_wps_event(voi
+ 		wpa_supplicant_wps_event_er_set_sel_reg(wpa_s,
+ 							&data->set_sel_reg);
+ 		break;
++	case WPS_EV_AP_PIN_SUCCESS:
++		break;
+ 	}
+ }
+ 

Added: wpa/trunk/debian/patches/upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch (added)
+++ wpa/trunk/debian/patches/upstream/0012-Interworking-Fix-EAP-TTLS-MSCHAP-configuration.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,27 @@
+From 4e6bdb158cb2e7d600c7e1aea8dd999f0d096016 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Tue, 31 Jan 2012 16:20:43 +0200
+Subject: [PATCH 12/58] Interworking: Fix EAP-TTLS/MSCHAP configuration
+
+Copy-paste error ended up using CHAP when MSCHAP was supposed to be
+set.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit d3f57d0ff19758377f40223b56afe5e8960fd0b8)
+---
+ wpa_supplicant/interworking.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/interworking.c
++++ b/wpa_supplicant/interworking.c
+@@ -726,8 +726,8 @@ int interworking_connect(struct wpa_supp
+ 				goto fail;
+ 			break;
+ 		case NAI_REALM_INNER_NON_EAP_MSCHAP:
+-			if (wpa_config_set(ssid, "phase2", "\"auth=CHAP\"", 0)
+-			    < 0)
++			if (wpa_config_set(ssid, "phase2", "\"auth=MSCHAP\"",
++					   0) < 0)
+ 				goto fail;
+ 			break;
+ 		case NAI_REALM_INNER_NON_EAP_MSCHAPV2:

Added: wpa/trunk/debian/patches/upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch (added)
+++ wpa/trunk/debian/patches/upstream/0013-Clear-EAPOL-authenticator-authFail-for-PMKSA-caching.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,50 @@
+From d5edac1c49e09e84fa22fa9522a988d40e7c3943 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 4 Feb 2012 12:21:42 +0200
+Subject: [PATCH 13/58] Clear EAPOL authenticator authFail for PMKSA
+ caching/FT
+
+This fixes a corner case where a STA that has PMKSA cache entry (or
+valid FT keys) could try to use full EAPOL/EAP authentication and fail.
+If the STA will then try to use the still valid PMKSA cache entry (or
+FT) before the STA entry has been cleared, authFail could have been left
+to TRUE. That will make EAPOL authenticator PAE state machine enter HELD
+state even though authSuccess was already forced to TRUE. This results
+in the STA getting disconnected even though it should be allowed to
+continue with 4-way handshake. While this is unlikely to happen in
+practice, it is better to get this fixed by clearing authFail when
+setting authSuccess.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit c7bce24dc9695ac6b0281b32b92b64dac6967e17)
+---
+ src/ap/ieee802_1x.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/src/ap/ieee802_1x.c
++++ b/src/ap/ieee802_1x.c
+@@ -1,6 +1,6 @@
+ /*
+  * hostapd / IEEE 802.1X-2004 Authenticator
+- * Copyright (c) 2002-2011, Jouni Malinen <j at w1.fi>
++ * Copyright (c) 2002-2012, 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
+@@ -940,6 +940,7 @@ void ieee802_1x_new_station(struct hosta
+ 		sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
+ 		sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
+ 		sta->eapol_sm->authSuccess = TRUE;
++		sta->eapol_sm->authFail = FALSE;
+ 		if (sta->eapol_sm->eap)
+ 			eap_sm_notify_cached(sta->eapol_sm->eap);
+ 		/* TODO: get vlan_id from R0KH using RRB message */
+@@ -961,6 +962,7 @@ void ieee802_1x_new_station(struct hosta
+ 		sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
+ 		sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
+ 		sta->eapol_sm->authSuccess = TRUE;
++		sta->eapol_sm->authFail = FALSE;
+ 		if (sta->eapol_sm->eap)
+ 			eap_sm_notify_cached(sta->eapol_sm->eap);
+ 		old_vlanid = sta->vlan_id;

Added: wpa/trunk/debian/patches/upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch (added)
+++ wpa/trunk/debian/patches/upstream/0014-Delay-scan-request-on-select_network-if-disconnectin.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,54 @@
+From 92dc94ea8a2c5bb08447c25b76c863d6483eda6d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 4 Feb 2012 12:28:16 +0200
+Subject: [PATCH 14/58] Delay scan request on select_network if disconnecting
+
+The disconnection command results in disassociation and deauthentication
+events which were previously processed during the scan in case of
+select_network command being used while associated with another network.
+While this works in most cases, it can result in confusing event
+messages in ctrl_iface and debug log. Avoid this by using a short delay
+between the disconnection and scan request to allow the disconnection
+events to be processed prior to starting the new scan.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit d93dfbd588eb3c16f4ed1b7af825c9c1c9bf7f6d)
+---
+ wpa_supplicant/wpa_supplicant.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -1,6 +1,6 @@
+ /*
+  * WPA Supplicant
+- * Copyright (c) 2003-2011, Jouni Malinen <j at w1.fi>
++ * Copyright (c) 2003-2012, 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
+@@ -1669,10 +1669,13 @@ void wpa_supplicant_select_network(struc
+ {
+ 
+ 	struct wpa_ssid *other_ssid;
++	int disconnected = 0;
+ 
+-	if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid)
++	if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid) {
+ 		wpa_supplicant_disassociate(
+ 			wpa_s, WLAN_REASON_DEAUTH_LEAVING);
++		disconnected = 1;
++	}
+ 
+ 	/*
+ 	 * Mark all other networks disabled or mark all networks enabled if no
+@@ -1700,7 +1703,7 @@ void wpa_supplicant_select_network(struc
+ 	wpa_s->connect_without_scan = NULL;
+ 	wpa_s->disconnected = 0;
+ 	wpa_s->reassociate = 1;
+-	wpa_supplicant_req_scan(wpa_s, 0, 0);
++	wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0);
+ 
+ 	if (ssid)
+ 		wpas_notify_network_selected(wpa_s, ssid);

Added: wpa/trunk/debian/patches/upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch (added)
+++ wpa/trunk/debian/patches/upstream/0015-P2P-Fix-DBus-crash-and-return-additional-P2P-group-p.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,132 @@
+From da8ca695fc5a1e38e69d5fb65e9863a0a10a4704 Mon Sep 17 00:00:00 2001
+From: Todd Previte <toddx.a.previte at intel.com>
+Date: Sat, 4 Feb 2012 13:08:12 +0200
+Subject: [PATCH 15/58] P2P: Fix DBus crash and return additional P2P group
+ properties
+
+When using DBus to get group properties, a segmentation fault is
+generated on P2P clients due to a NULL pointer for the ap_iface struct.
+The current implementation only returns vendor extensions when called on
+a P2P group owner.
+
+The code now checks the P2P role which allows for role-specific
+information to be provided. This also fixes the crash issue by only
+looking for the correct structures based on the current P2P role.
+
+Signed-hostap: Todd Previte <toddx.a.previte at intel.com>
+Signed-hostap: Angie Chinchilla <angie.v.chinchilla at intel.com>
+intended-for: hostap-1
+(cherry picked from commit aa89df56996c0da499f1cdb132893c1863b6b2fb)
+---
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |   86 ++++++++++++++++++++++-----
+ 1 file changed, 72 insertions(+), 14 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1664,14 +1664,41 @@ dbus_bool_t wpas_dbus_getter_p2p_group_p
+ {
+ 	struct wpa_supplicant *wpa_s = user_data;
+ 	DBusMessageIter variant_iter, dict_iter;
+-	struct hostapd_data *hapd = wpa_s->ap_iface->bss[0];
++	struct hostapd_data *hapd = NULL;
+ 	const struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
+ 	int num_vendor_ext = 0;
+ 	int i;
++	u8 role = wpas_get_p2p_role(wpa_s);
++	u16 op_freq = 0;
++	u8 *p_bssid = NULL;
++	char *role_name = NULL;
+ 
+-	if (!hapd) {
+-		dbus_set_error_const(error, DBUS_ERROR_FAILED,
+-				     "internal error");
++	if (!wpa_s->current_ssid)
++		return FALSE;
++
++	/* Check current role and adjust information accordingly */
++	switch (role) {
++	case WPAS_P2P_ROLE_CLIENT:
++		/* go_params is only valid for a client */
++		if (wpa_s->go_params) {
++			op_freq = wpa_s->go_params->freq;
++			p_bssid = wpa_s->current_ssid->bssid;
++			role_name = "client";
++		} else
++			return FALSE;
++		break;
++	case WPAS_P2P_ROLE_GO:
++		/* ap_iface is only valid for a GO */
++		if (wpa_s->ap_iface) {
++			hapd = wpa_s->ap_iface->bss[0];
++			p_bssid = hapd->own_addr;
++			op_freq = wpa_s->ap_iface->freq;
++			role_name = "GO";
++		} else
++			return FALSE;
++		break;
++	default:
++		/* Error condition; this should NEVER occur */
+ 		return FALSE;
+ 	}
+ 
+@@ -1679,19 +1706,50 @@ dbus_bool_t wpas_dbus_getter_p2p_group_p
+ 					      "a{sv}", &variant_iter) ||
+ 	    !wpa_dbus_dict_open_write(&variant_iter, &dict_iter))
+ 		goto err_no_mem;
++	/* Provide the SSID */
++	if (!wpa_dbus_dict_append_byte_array(
++		    &dict_iter, "SSID",
++		    (const char *) wpa_s->current_ssid->ssid,
++		    wpa_s->current_ssid->ssid_len))
++		goto err_no_mem;
++	/* Provide the BSSID */
++	if (p_bssid &&
++	    !wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID",
++					     (const char *) p_bssid, ETH_ALEN))
++		goto err_no_mem;
++	/* Provide the role within the group */
++	if (role_name &&
++	    !wpa_dbus_dict_append_string(&dict_iter, "Role", role_name))
++		goto err_no_mem;
++	/* Provide the operational frequency */
++	if (!wpa_dbus_dict_append_uint16(&dict_iter, "Frequency", op_freq))
++		goto err_no_mem;
+ 
+-	/* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
+-	for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
+-		if (hapd->conf->wps_vendor_ext[i] == NULL)
+-			continue;
+-		vendor_ext[num_vendor_ext++] = hapd->conf->wps_vendor_ext[i];
++	/* Additional information for group owners */
++	if (role == WPAS_P2P_ROLE_GO) {
++		/* Provide the passphrase */
++		if (!wpa_dbus_dict_append_string(&dict_iter, "Passphrase",
++					wpa_s->current_ssid->passphrase))
++			goto err_no_mem;
++		/* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
++		for (i = 0; hapd && i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
++			if (hapd->conf->wps_vendor_ext[i] == NULL)
++				continue;
++			vendor_ext[num_vendor_ext++] =
++				hapd->conf->wps_vendor_ext[i];
++		}
++		if (!wpa_dbus_dict_append_wpabuf_array(&dict_iter,
++					"WPSVendorExtensions",
++					vendor_ext, num_vendor_ext))
++			goto err_no_mem;
++	} else {
++		/* If not a GO, provide the PSK */
++		if (!wpa_dbus_dict_append_byte_array(
++			    &dict_iter, "PSK",
++			    (const char *) wpa_s->current_ssid->psk, 32))
++			goto err_no_mem;
+ 	}
+ 
+-	if (!wpa_dbus_dict_append_wpabuf_array(&dict_iter,
+-					       "WPSVendorExtensions",
+-					       vendor_ext, num_vendor_ext))
+-		goto err_no_mem;
+-
+ 	if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
+ 	    !dbus_message_iter_close_container(iter, &variant_iter))
+ 		goto err_no_mem;

Added: wpa/trunk/debian/patches/upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch (added)
+++ wpa/trunk/debian/patches/upstream/0016-P2P-Fix-the-setter-function-for-DBus-group-propertie.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,40 @@
+From 24f1cf70b1e063b3a92ff40013818157f8ce6d4c Mon Sep 17 00:00:00 2001
+From: Todd Previte <toddx.a.previte at intel.com>
+Date: Sat, 4 Feb 2012 13:13:59 +0200
+Subject: [PATCH 16/58] P2P: Fix the setter function for DBus group properties
+
+The setter function uses the same hostapd_data structure as the getter
+which causes it to crash if called on a P2P client. To overcome this
+issue, the role is checked to ensure it is called on a group owner and
+the pointer is examined for validity. The function will return an error
+if called on a non-GO system.
+
+Signed-hostap: Todd Previte <toddx.a.previte at intel.com>
+Signed-hostap: Angie Chinchilla <angie.v.chinchilla at intel.com>
+intended-for: hostap-1
+(cherry picked from commit 4bb70bd80d61a451b598102bd26f5348846fdef0)
+---
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1770,13 +1770,13 @@ dbus_bool_t wpas_dbus_setter_p2p_group_p
+ 	DBusMessageIter variant_iter, iter_dict;
+ 	struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
+ 	unsigned int i;
+-	struct hostapd_data *hapd = wpa_s->ap_iface->bss[0];
++	struct hostapd_data *hapd = NULL;
+ 
+-	if (!hapd) {
+-		dbus_set_error_const(error, DBUS_ERROR_FAILED,
+-				     "internal error");
++	if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO &&
++	    wpa_s->ap_iface != NULL)
++		hapd = wpa_s->ap_iface->bss[0];
++	else
+ 		return FALSE;
+-	}
+ 
+ 	dbus_message_iter_recurse(iter, &variant_iter);
+ 	if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))

Added: wpa/trunk/debian/patches/upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch (added)
+++ wpa/trunk/debian/patches/upstream/0017-Try-fallback-drivers-if-global-init-for-preferred-dr.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,41 @@
+From ba53656e8224cac7bd824673f785f66812460afa Mon Sep 17 00:00:00 2001
+From: Dan Williams <dcbw at redhat.com>
+Date: Sat, 4 Feb 2012 20:09:00 +0200
+Subject: [PATCH 17/58] Try fallback drivers if global init for preferred
+ drivers fails
+
+Driver global init was considered a hard failure. Thus if, for example,
+you used the Broadcom STA driver and didn't have nl80211 or cfg80211
+loaded into the kernel, and specified a driver value of "nl80211,wext",
+the nl80211 driver's global init would fail with the following message:
+
+nl80211: 'nl80211' generic netlink not found
+Failed to initialize driver 'nl80211'
+
+but since global init was a hard failure, creating the supplicant
+interface would fail and the WEXT driver would not be tried.
+Give other drivers a chance instead.
+
+Signed-hostap: Dan Williams <dcbw at redhat.com>
+intended-for: hostap-1
+(cherry picked from commit 0f4668ceac37e2c98ce6068bd255d0915974a706)
+---
+ wpa_supplicant/wpa_supplicant.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -1944,8 +1944,11 @@ static int wpa_supplicant_set_driver(str
+ 		for (i = 0; wpa_drivers[i]; i++) {
+ 			if (os_strlen(wpa_drivers[i]->name) == len &&
+ 			    os_strncmp(driver, wpa_drivers[i]->name, len) ==
+-			    0)
+-				return select_driver(wpa_s, i);
++			    0) {
++				/* First driver that succeeds wins */
++				if (select_driver(wpa_s, i) == 0)
++					return 0;
++			}
+ 		}
+ 
+ 		driver = pos + 1;

Added: wpa/trunk/debian/patches/upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch (added)
+++ wpa/trunk/debian/patches/upstream/0018-P2P-Remove-unneeded-go_neg_peer-check-from-PD.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,28 @@
+From 4027891cf0b6f6bc16d55d37fa87e5d309fa8fcf Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg at intel.com>
+Date: Sun, 5 Feb 2012 19:05:45 +0200
+Subject: [PATCH 18/58] P2P: Remove unneeded go_neg_peer check from PD
+
+When the GO negotiation peer is assigned, the state also cannot be IDLE,
+SEARCH, or LISTEN_ONLY.
+
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+(cherry picked from commit e12b85d324e9692443d666728b5d078d652fabeb)
+---
+ src/p2p/p2p_pd.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/src/p2p/p2p_pd.c
++++ b/src/p2p/p2p_pd.c
+@@ -362,9 +362,8 @@ int p2p_prov_disc_req(struct p2p_data *p
+ 	else
+ 		dev->flags &= ~P2P_DEV_PD_FOR_JOIN;
+ 
+-	if (p2p->go_neg_peer ||
+-	    (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH &&
+-	     p2p->state != P2P_LISTEN_ONLY)) {
++	if (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH &&
++	    p2p->state != P2P_LISTEN_ONLY) {
+ 		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Busy with other "
+ 			"operations; postpone Provision Discovery Request "
+ 			"with " MACSTR " (config methods 0x%x)",

Added: wpa/trunk/debian/patches/upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch (added)
+++ wpa/trunk/debian/patches/upstream/0019-P2P-Skip-event-notification-on-PD-Response-in-join-g.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,54 @@
+From f7356eced71a1884b510f8da642928f20fa3543d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 5 Feb 2012 20:20:36 +0200
+Subject: [PATCH 19/58] P2P: Skip event notification on PD Response in
+ join-group case
+
+Provision Discovery is used as a notification to the GO in the case we
+are about join a running group. In such case, there is not much point in
+indicating the provision discovery response events to external programs
+especially when the PIN-to-be-displayed was different from the one
+returned for the p2p_connect command. Skip this confusing event
+completely for join-a-running-group case.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit c19316354ed46e688704c1ebcf1c7efe816ddf31)
+---
+ wpa_supplicant/p2p_supplicant.c |   19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -1759,6 +1759,16 @@ void wpas_prov_disc_resp(void *ctx, cons
+ 	struct wpa_supplicant *wpa_s = ctx;
+ 	unsigned int generated_pin = 0;
+ 
++	if (wpa_s->pending_pd_before_join &&
++	    (os_memcmp(peer, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
++	     os_memcmp(peer, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
++		wpa_s->pending_pd_before_join = 0;
++		wpa_printf(MSG_DEBUG, "P2P: Starting pending "
++			   "join-existing-group operation");
++		wpas_p2p_join_start(wpa_s);
++		return;
++	}
++
+ 	if (config_methods & WPS_CONFIG_DISPLAY)
+ 		wpas_prov_disc_local_keypad(wpa_s, peer, "");
+ 	else if (config_methods & WPS_CONFIG_KEYPAD) {
+@@ -1771,15 +1781,6 @@ void wpas_prov_disc_resp(void *ctx, cons
+ 	wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
+ 					    P2P_PROV_DISC_SUCCESS,
+ 					    config_methods, generated_pin);
+-
+-	if (wpa_s->pending_pd_before_join &&
+-	    (os_memcmp(peer, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
+-	     os_memcmp(peer, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
+-		wpa_s->pending_pd_before_join = 0;
+-		wpa_printf(MSG_DEBUG, "P2P: Starting pending "
+-			   "join-existing-group operation");
+-		wpas_p2p_join_start(wpa_s);
+-	}
+ }
+ 
+ 

Added: wpa/trunk/debian/patches/upstream/0020-P2P-Wait-for-PD-before-join-response.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0020-P2P-Wait-for-PD-before-join-response.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0020-P2P-Wait-for-PD-before-join-response.patch (added)
+++ wpa/trunk/debian/patches/upstream/0020-P2P-Wait-for-PD-before-join-response.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,107 @@
+From 7d35098683fb27dd38cc842a87536b8d17009c5f Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 5 Feb 2012 20:52:24 +0200
+Subject: [PATCH 20/58] P2P: Wait for PD-before-join response
+
+Even though the Provision Discovery Response frame from PD-before-join
+does not really provide any additional information, it can be better to
+wait for it before starting the join operation. This adds a minimal
+extra latency in the most common case and cleans up the sequence of
+driver operations and debug log by avoiding potential processing of the
+Provision Discovery Response while already running a scan for the actual
+connection.
+
+If transmission of Provision Discovery Request fails, join operation is
+started without the additional wait. In addition, a new timeout is used
+to start the join if Provision Discovery Response is lost for any
+reason.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit f63b8542156496ba88ef9f161e5931122d7319b9)
+---
+ wpa_supplicant/p2p_supplicant.c |   34 +++++++++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 3 deletions(-)
+
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -62,6 +62,8 @@ static int wpas_p2p_join_start(struct wp
+ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx);
+ static int wpas_p2p_join(struct wpa_supplicant *wpa_s, const u8 *iface_addr,
+ 			 const u8 *dev_addr, enum p2p_wps_method wps_method);
++static void wpas_p2p_pd_before_join_timeout(void *eloop_ctx,
++					    void *timeout_ctx);
+ static int wpas_p2p_create_iface(struct wpa_supplicant *wpa_s);
+ static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s);
+ static void wpas_p2p_group_idle_timeout(void *eloop_ctx, void *timeout_ctx);
+@@ -592,12 +594,14 @@ static void wpas_p2p_send_action_tx_stat
+ 
+ 	p2p_send_action_cb(wpa_s->global->p2p, freq, dst, src, bssid, res);
+ 
+-	if (wpa_s->pending_pd_before_join &&
++	if (result != OFFCHANNEL_SEND_ACTION_SUCCESS &&
++	    wpa_s->pending_pd_before_join &&
+ 	    (os_memcmp(dst, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
+ 	     os_memcmp(dst, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
+ 		wpa_s->pending_pd_before_join = 0;
+ 		wpa_printf(MSG_DEBUG, "P2P: Starting pending "
+-			   "join-existing-group operation");
++			   "join-existing-group operation (no ACK for PD "
++			   "Req)");
+ 		wpas_p2p_join_start(wpa_s);
+ 	}
+ }
+@@ -2351,6 +2355,7 @@ void wpas_p2p_deinit(struct wpa_supplica
+ 	wpa_s->go_params = NULL;
+ 	eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s, NULL);
+ 	eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
++	eloop_cancel_timeout(wpas_p2p_pd_before_join_timeout, wpa_s, NULL);
+ 	wpa_s->p2p_long_listen = 0;
+ 	eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
+ 	eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
+@@ -2485,6 +2490,21 @@ static void wpas_p2p_check_join_scan_lim
+ }
+ 
+ 
++static void wpas_p2p_pd_before_join_timeout(void *eloop_ctx, void *timeout_ctx)
++{
++	struct wpa_supplicant *wpa_s = eloop_ctx;
++	if (!wpa_s->pending_pd_before_join)
++		return;
++	/*
++	 * Provision Discovery Response may have been lost - try to connect
++	 * anyway since we do not need any information from this PD.
++	 */
++	wpa_printf(MSG_DEBUG, "P2P: PD timeout for join-existing-group - "
++		   "try to connect anyway");
++	wpas_p2p_join_start(wpa_s);
++}
++
++
+ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
+ 				   struct wpa_scan_results *scan_res)
+ {
+@@ -2568,8 +2588,15 @@ static void wpas_p2p_scan_res_join(struc
+ 
+ 		/*
+ 		 * Actual join operation will be started from the Action frame
+-		 * TX status callback.
++		 * TX status callback (if no ACK is received) or when the
++		 * Provision Discovery Response is received. Use a short
++		 * timeout as a backup mechanism should the Provision Discovery
++		 * Response be lost for any reason.
+ 		 */
++		eloop_cancel_timeout(wpas_p2p_pd_before_join_timeout, wpa_s,
++				     NULL);
++		eloop_register_timeout(2, 0, wpas_p2p_pd_before_join_timeout,
++				       wpa_s, NULL);
+ 		return;
+ 	}
+ 
+@@ -2668,6 +2695,7 @@ static int wpas_p2p_join_start(struct wp
+ 	struct wpa_supplicant *group;
+ 	struct p2p_go_neg_results res;
+ 
++	eloop_cancel_timeout(wpas_p2p_pd_before_join_timeout, wpa_s, NULL);
+ 	group = wpas_p2p_get_group_iface(wpa_s, 0, 0);
+ 	if (group == NULL)
+ 		return -1;

Added: wpa/trunk/debian/patches/upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch (added)
+++ wpa/trunk/debian/patches/upstream/0021-Move-AP-events-for-STA-connected-disconnected-into-o.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,149 @@
+From b3aff8e089006a62f0bffd361def8f5008bc75e1 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Thu, 3 Nov 2011 22:17:41 +0200
+Subject: [PATCH 21/58] Move AP events for STA connected/disconnected into one
+ function
+
+Instead of trying to remember to add wpa_msg() calls for every possible
+path where a STA becomes authorized or unauthorized, use
+ap_sta_set_authorized() to send these events more consistently.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit ae055af4f7436d0ea2b29d11d23d341eefb918cf)
+---
+ src/ap/drv_callbacks.c |    3 +--
+ src/ap/ieee802_11.c    |    8 ++------
+ src/ap/ieee802_1x.c    |   21 ---------------------
+ src/ap/sta_info.c      |   23 ++++++++++++++++++-----
+ 4 files changed, 21 insertions(+), 34 deletions(-)
+
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -248,9 +248,8 @@ void hostapd_notif_disassoc(struct hosta
+ 		return;
+ 	}
+ 
++	ap_sta_set_authorized(hapd, sta, 0);
+ 	sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
+-	wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+-		MAC2STR(sta->addr));
+ 	wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
+ 	sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
+ 	ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -1112,9 +1112,8 @@ static void handle_disassoc(struct hosta
+ 		return;
+ 	}
+ 
++	ap_sta_set_authorized(hapd, sta, 0);
+ 	sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK);
+-	wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+-		MAC2STR(sta->addr));
+ 	wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
+ 	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+ 		       HOSTAPD_LEVEL_INFO, "disassociated");
+@@ -1162,10 +1161,9 @@ static void handle_deauth(struct hostapd
+ 		return;
+ 	}
+ 
++	ap_sta_set_authorized(hapd, sta, 0);
+ 	sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC |
+ 			WLAN_STA_ASSOC_REQ_OK);
+-	wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+-		MAC2STR(sta->addr));
+ 	wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH);
+ 	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+ 		       HOSTAPD_LEVEL_DEBUG, "deauthenticated");
+@@ -1525,8 +1523,6 @@ static void handle_assoc_cb(struct hosta
+ 		 * step.
+ 		 */
+ 		ap_sta_set_authorized(hapd, sta, 1);
+-		wpa_msg(hapd->msg_ctx, MSG_INFO,
+-			AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
+ 	}
+ 
+ 	if (reassoc)
+--- a/src/ap/ieee802_1x.c
++++ b/src/ap/ieee802_1x.c
+@@ -90,32 +90,11 @@ void ieee802_1x_set_sta_authorized(struc
+ 		return;
+ 
+ 	if (authorized) {
+-		if (!ap_sta_is_authorized(sta)) {
+-			const u8 *dev_addr = NULL;
+-#ifdef CONFIG_P2P
+-			dev_addr = p2p_group_get_dev_addr(hapd->p2p_group,
+-							  sta->addr);
+-#endif /* CONFIG_P2P */
+-
+-			if (dev_addr)
+-				wpa_msg(hapd->msg_ctx, MSG_INFO,
+-					AP_STA_CONNECTED MACSTR
+-					" dev_addr=" MACSTR,
+-					MAC2STR(sta->addr), MAC2STR(dev_addr));
+-			else
+-				wpa_msg(hapd->msg_ctx, MSG_INFO,
+-					AP_STA_CONNECTED MACSTR,
+-					MAC2STR(sta->addr));
+-		}
+ 		ap_sta_set_authorized(hapd, sta, 1);
+ 		res = hostapd_set_authorized(hapd, sta, 1);
+ 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+ 			       HOSTAPD_LEVEL_DEBUG, "authorizing port");
+ 	} else {
+-		if (ap_sta_is_authorized(sta) && (sta->flags & WLAN_STA_ASSOC))
+-			wpa_msg(hapd->msg_ctx, MSG_INFO,
+-				AP_STA_DISCONNECTED MACSTR,
+-				MAC2STR(sta->addr));
+ 		ap_sta_set_authorized(hapd, sta, 0);
+ 		res = hostapd_set_authorized(hapd, sta, 0);
+ 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -357,6 +357,7 @@ void ap_handle_timer(void *eloop_ctx, vo
+ 				       hapd, sta);
+ 		break;
+ 	case STA_DISASSOC:
++		ap_sta_set_authorized(hapd, sta, 0);
+ 		sta->flags &= ~WLAN_STA_ASSOC;
+ 		ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
+ 		if (!sta->acct_terminate_cause)
+@@ -384,9 +385,6 @@ void ap_handle_timer(void *eloop_ctx, vo
+ 		mlme_deauthenticate_indication(
+ 			hapd, sta,
+ 			WLAN_REASON_PREV_AUTH_NOT_VALID);
+-
+-		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+-			MAC2STR(sta->addr));
+ 		ap_free_sta(hapd, sta);
+ 		break;
+ 	}
+@@ -782,10 +780,25 @@ void ap_sta_set_authorized(struct hostap
+ 	if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED))
+ 		return;
+ 
+-	if (authorized)
++	if (authorized) {
++		const u8 *dev_addr = NULL;
++#ifdef CONFIG_P2P
++		dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
++#endif /* CONFIG_P2P */
++		if (dev_addr)
++			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
++				MACSTR " dev_addr=" MACSTR,
++				MAC2STR(sta->addr), MAC2STR(dev_addr));
++		else
++			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
++				MACSTR, MAC2STR(sta->addr));
++
+ 		sta->flags |= WLAN_STA_AUTHORIZED;
+-	else
++	} else {
++		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
++			MAC2STR(sta->addr));
+ 		sta->flags &= ~WLAN_STA_AUTHORIZED;
++	}
+ 
+ 	if (hapd->sta_authorized_cb)
+ 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,

Added: wpa/trunk/debian/patches/upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch (added)
+++ wpa/trunk/debian/patches/upstream/0022-P2P-Send-STA-connected-disconnected-events-to-parent.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,67 @@
+From 69047431ec2ea167e130d3e93b0a0bae505fdcf4 Mon Sep 17 00:00:00 2001
+From: Dmitry Shmidt <dimitrysh at google.com>
+Date: Thu, 21 Jul 2011 15:19:46 -0700
+Subject: [PATCH 22/58] P2P: Send STA connected/disconnected events to parent
+ ctrl_iface
+
+Send the connection events from P2P group to both the group interface
+and parent interface ctrl_ifaces to make it easier for external monitor
+programs to see these events without having to listen to all group
+interfaces when virtual group interfaces are used.
+
+Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
+(cherry picked from commit 8a5e75f60f7a8ae1562e0ab82c6b2a2eb57350f3)
+---
+ src/ap/hostapd.h    |    1 +
+ src/ap/sta_info.c   |   14 ++++++++++++++
+ wpa_supplicant/ap.c |    1 +
+ 3 files changed, 16 insertions(+)
+
+--- a/src/ap/hostapd.h
++++ b/src/ap/hostapd.h
+@@ -82,6 +82,7 @@ struct hostapd_data {
+ 				 struct sta_info *sta, int reassoc);
+ 
+ 	void *msg_ctx; /* ctx for wpa_msg() calls */
++	void *msg_ctx_parent; /* parent interface ctx for wpa_msg() calls */
+ 
+ 	struct radius_client_data *radius;
+ 	u32 acct_session_id_hi, acct_session_id_lo;
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -792,11 +792,25 @@ void ap_sta_set_authorized(struct hostap
+ 		else
+ 			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
+ 				MACSTR, MAC2STR(sta->addr));
++		if (hapd->msg_ctx_parent &&
++		    hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
++			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
++				AP_STA_CONNECTED MACSTR " dev_addr=" MACSTR,
++				MAC2STR(sta->addr), MAC2STR(dev_addr));
++		else if (hapd->msg_ctx_parent &&
++			 hapd->msg_ctx_parent != hapd->msg_ctx)
++			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
++				AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
+ 
+ 		sta->flags |= WLAN_STA_AUTHORIZED;
+ 	} else {
+ 		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+ 			MAC2STR(sta->addr));
++		if (hapd->msg_ctx_parent &&
++		    hapd->msg_ctx_parent != hapd->msg_ctx)
++			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
++				AP_STA_DISCONNECTED MACSTR,
++				MAC2STR(sta->addr));
+ 		sta->flags &= ~WLAN_STA_AUTHORIZED;
+ 	}
+ 
+--- a/wpa_supplicant/ap.c
++++ b/wpa_supplicant/ap.c
+@@ -499,6 +499,7 @@ int wpa_supplicant_create_ap(struct wpa_
+ 		}
+ 
+ 		hapd_iface->bss[i]->msg_ctx = wpa_s;
++		hapd_iface->bss[i]->msg_ctx_parent = wpa_s->parent;
+ 		hapd_iface->bss[i]->public_action_cb = ap_public_action_rx;
+ 		hapd_iface->bss[i]->public_action_cb_ctx = wpa_s;
+ 		hapd_iface->bss[i]->vendor_action_cb = ap_vendor_action_rx;

Added: wpa/trunk/debian/patches/upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch (added)
+++ wpa/trunk/debian/patches/upstream/0023-P2P-Append-P2P-Device-Address-to-AP-STA-DISCONNECTED.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,76 @@
+From b05861bbd526830f586cc8e86dc2ab5e8651db04 Mon Sep 17 00:00:00 2001
+From: Jithu Jance <jithu at broadcom.com>
+Date: Sat, 10 Dec 2011 12:26:00 +0200
+Subject: [PATCH 23/58] P2P: Append P2P Device Address to AP-STA-DISCONNECTED
+ event
+
+Append "p2p_dev_addr" parameter to AP-STA-DISCONNECTED event for P2P
+connections. In addition, for AP-STA-CONNECTED event during P2P
+connection, the "dev_addr=" print is replaced with "p2p_dev_addr=" to
+be more consistent with other events.
+
+Signed-hostap: Jithu Jance <jithu at broadcom.com>
+(cherry picked from commit 10cc6c883e1ecf4b6f4c6fc9430ff09ab227bafc)
+---
+ src/ap/sta_info.c |   28 ++++++++++++++++++++--------
+ 1 file changed, 20 insertions(+), 8 deletions(-)
+
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -777,17 +777,18 @@ void ap_sta_stop_sa_query(struct hostapd
+ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+ 			   int authorized)
+ {
++	const u8 *dev_addr = NULL;
+ 	if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED))
+ 		return;
+ 
+-	if (authorized) {
+-		const u8 *dev_addr = NULL;
+ #ifdef CONFIG_P2P
+-		dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
++	dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr);
+ #endif /* CONFIG_P2P */
++
++	if (authorized) {
+ 		if (dev_addr)
+ 			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
+-				MACSTR " dev_addr=" MACSTR,
++				MACSTR " p2p_dev_addr=" MACSTR,
+ 				MAC2STR(sta->addr), MAC2STR(dev_addr));
+ 		else
+ 			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED
+@@ -795,7 +796,8 @@ void ap_sta_set_authorized(struct hostap
+ 		if (hapd->msg_ctx_parent &&
+ 		    hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
+ 			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+-				AP_STA_CONNECTED MACSTR " dev_addr=" MACSTR,
++				AP_STA_CONNECTED MACSTR " p2p_dev_addr="
++				MACSTR,
+ 				MAC2STR(sta->addr), MAC2STR(dev_addr));
+ 		else if (hapd->msg_ctx_parent &&
+ 			 hapd->msg_ctx_parent != hapd->msg_ctx)
+@@ -804,10 +806,20 @@ void ap_sta_set_authorized(struct hostap
+ 
+ 		sta->flags |= WLAN_STA_AUTHORIZED;
+ 	} else {
+-		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
+-			MAC2STR(sta->addr));
++		if (dev_addr)
++			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED
++				MACSTR " p2p_dev_addr=" MACSTR,
++				MAC2STR(sta->addr), MAC2STR(dev_addr));
++		else
++			wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED
++				MACSTR, MAC2STR(sta->addr));
+ 		if (hapd->msg_ctx_parent &&
+-		    hapd->msg_ctx_parent != hapd->msg_ctx)
++		    hapd->msg_ctx_parent != hapd->msg_ctx && dev_addr)
++			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
++				AP_STA_DISCONNECTED MACSTR " p2p_dev_addr="
++				MACSTR, MAC2STR(sta->addr), MAC2STR(dev_addr));
++		else if (hapd->msg_ctx_parent &&
++			 hapd->msg_ctx_parent != hapd->msg_ctx)
+ 			wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
+ 				AP_STA_DISCONNECTED MACSTR,
+ 				MAC2STR(sta->addr));

Added: wpa/trunk/debian/patches/upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch (added)
+++ wpa/trunk/debian/patches/upstream/0024-P2P-Maintain-a-list-of-P2P-Clients-for-persistent-gr.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,370 @@
+From 2db9ac2173a89de4af2be8c01206ecd0bf26695b Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Thu, 22 Dec 2011 22:47:41 +0200
+Subject: [PATCH 24/58] P2P: Maintain a list of P2P Clients for persistent
+ group on GO
+
+Add a new persistent group network block field, p2p_client_list, to
+maintain a list of P2P Clients that have connected to a persistent
+group. This allows GO of a persistent group to figure out more easily
+whether re-invocation of a persistent group can be used with a specific
+peer device.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit fbdcfd577a3f6245c9c34e09842e766777a84ea7)
+---
+ src/ap/hostapd.h                |    2 +-
+ src/ap/sta_info.c               |    2 +-
+ wpa_supplicant/ap.c             |    4 +-
+ wpa_supplicant/config.c         |   88 +++++++++++++++++++++++++++++++++++++++
+ wpa_supplicant/config_file.c    |   15 +++++++
+ wpa_supplicant/config_ssid.h    |   14 +++++++
+ wpa_supplicant/notify.c         |   10 +++--
+ wpa_supplicant/notify.h         |    3 +-
+ wpa_supplicant/p2p_supplicant.c |   71 +++++++++++++++++++++++++++++--
+ wpa_supplicant/p2p_supplicant.h |    2 +
+ 10 files changed, 200 insertions(+), 11 deletions(-)
+
+--- a/src/ap/hostapd.h
++++ b/src/ap/hostapd.h
+@@ -150,7 +150,7 @@ struct hostapd_data {
+ 	void *wps_event_cb_ctx;
+ 
+ 	void (*sta_authorized_cb)(void *ctx, const u8 *mac_addr,
+-				  int authorized);
++				  int authorized, const u8 *p2p_dev_addr);
+ 	void *sta_authorized_cb_ctx;
+ 
+ 	void (*setup_complete_cb)(void *ctx);
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -828,7 +828,7 @@ void ap_sta_set_authorized(struct hostap
+ 
+ 	if (hapd->sta_authorized_cb)
+ 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
+-					sta->addr, authorized);
++					sta->addr, authorized, dev_addr);
+ }
+ 
+ 
+--- a/wpa_supplicant/ap.c
++++ b/wpa_supplicant/ap.c
+@@ -317,9 +317,9 @@ static void ap_wps_event_cb(void *ctx, e
+ 
+ 
+ static void ap_sta_authorized_cb(void *ctx, const u8 *mac_addr,
+-				 int authorized)
++				 int authorized, const u8 *p2p_dev_addr)
+ {
+-	wpas_notify_sta_authorized(ctx, mac_addr, authorized);
++	wpas_notify_sta_authorized(ctx, mac_addr, authorized, p2p_dev_addr);
+ }
+ 
+ 
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -1351,6 +1351,90 @@ static char * wpa_config_write_wep_key3(
+ #endif /* NO_CONFIG_WRITE */
+ 
+ 
++#ifdef CONFIG_P2P
++
++static int wpa_config_parse_p2p_client_list(const struct parse_data *data,
++					    struct wpa_ssid *ssid, int line,
++					    const char *value)
++{
++	const char *pos;
++	u8 *buf, *n, addr[ETH_ALEN];
++	size_t count;
++
++	buf = NULL;
++	count = 0;
++
++	pos = value;
++	while (pos && *pos) {
++		while (*pos == ' ')
++			pos++;
++
++		if (hwaddr_aton(pos, addr)) {
++			wpa_printf(MSG_ERROR, "Line %d: Invalid "
++				   "p2p_client_list address '%s'.",
++				   line, value);
++			/* continue anyway */
++		} else {
++			n = os_realloc(buf, (count + 1) * ETH_ALEN);
++			if (n == NULL) {
++				os_free(buf);
++				return -1;
++			}
++			buf = n;
++			os_memcpy(buf + count * ETH_ALEN, addr, ETH_ALEN);
++			count++;
++			wpa_hexdump(MSG_MSGDUMP, "p2p_client_list",
++				    addr, ETH_ALEN);
++		}
++
++		pos = os_strchr(pos, ' ');
++	}
++
++	os_free(ssid->p2p_client_list);
++	ssid->p2p_client_list = buf;
++	ssid->num_p2p_clients = count;
++
++	return 0;
++}
++
++
++#ifndef NO_CONFIG_WRITE
++static char * wpa_config_write_p2p_client_list(const struct parse_data *data,
++					       struct wpa_ssid *ssid)
++{
++	char *value, *end, *pos;
++	int res;
++	size_t i;
++
++	if (ssid->p2p_client_list == NULL || ssid->num_p2p_clients == 0)
++		return NULL;
++
++	value = os_malloc(20 * ssid->num_p2p_clients);
++	if (value == NULL)
++		return NULL;
++	pos = value;
++	end = value + 20 * ssid->num_p2p_clients;
++
++	for (i = 0; i < ssid->num_p2p_clients; i++) {
++		res = os_snprintf(pos, end - pos, MACSTR " ",
++				  MAC2STR(ssid->p2p_client_list +
++					  i * ETH_ALEN));
++		if (res < 0 || res >= end - pos) {
++			os_free(value);
++			return NULL;
++		}
++		pos += res;
++	}
++
++	if (pos > value)
++		pos[-1] = '\0';
++
++	return value;
++}
++#endif /* NO_CONFIG_WRITE */
++
++#endif /* CONFIG_P2P */
++
+ /* Helper macros for network block parser */
+ 
+ #ifdef OFFSET
+@@ -1511,6 +1595,9 @@ static const struct parse_data ssid_fiel
+ 	{ INT_RANGE(frequency, 0, 10000) },
+ 	{ INT(wpa_ptk_rekey) },
+ 	{ STR(bgscan) },
++#ifdef CONFIG_P2P
++	{ FUNC(p2p_client_list) },
++#endif /* CONFIG_P2P */
+ };
+ 
+ #undef OFFSET
+@@ -1677,6 +1764,7 @@ void wpa_config_free_ssid(struct wpa_ssi
+ 	os_free(ssid->scan_freq);
+ 	os_free(ssid->freq_list);
+ 	os_free(ssid->bgscan);
++	os_free(ssid->p2p_client_list);
+ 	os_free(ssid);
+ }
+ 
+--- a/wpa_supplicant/config_file.c
++++ b/wpa_supplicant/config_file.c
+@@ -495,6 +495,18 @@ static void write_wep_key(FILE *f, int i
+ }
+ 
+ 
++#ifdef CONFIG_P2P
++static void write_p2p_client_list(FILE *f, struct wpa_ssid *ssid)
++{
++	char *value = wpa_config_get(ssid, "p2p_client_list");
++	if (value == NULL)
++		return;
++	fprintf(f, "\tp2p_client_list=%s\n", value);
++	os_free(value);
++}
++#endif /* CONFIG_P2P */
++
++
+ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
+ {
+ 	int i;
+@@ -569,6 +581,9 @@ static void wpa_config_write_network(FIL
+ 	INT(ieee80211w);
+ #endif /* CONFIG_IEEE80211W */
+ 	STR(id_str);
++#ifdef CONFIG_P2P
++	write_p2p_client_list(f, ssid);
++#endif /* CONFIG_P2P */
+ 
+ #undef STR
+ #undef INT
+--- a/wpa_supplicant/config_ssid.h
++++ b/wpa_supplicant/config_ssid.h
+@@ -387,6 +387,20 @@ struct wpa_ssid {
+ 	int *freq_list;
+ 
+ 	/**
++	 * p2p_client_list - List of P2P Clients in a persistent group (GO)
++	 *
++	 * This is a list of P2P Clients (P2P Device Address) that have joined
++	 * the persistent group. This is maintained on the GO for persistent
++	 * group entries (disabled == 2).
++	 */
++	u8 *p2p_client_list;
++
++	/**
++	 * num_p2p_clients - Number of entries in p2p_client_list
++	 */
++	size_t num_p2p_clients;
++
++	/**
+ 	 * p2p_group - Network generated as a P2P group (used internally)
+ 	 */
+ 	int p2p_group;
+--- a/wpa_supplicant/notify.c
++++ b/wpa_supplicant/notify.c
+@@ -525,9 +525,12 @@ void wpas_notify_p2p_wps_failed(struct w
+ 
+ 
+ static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
+-					  const u8 *sta)
++					  const u8 *sta,
++					  const u8 *p2p_dev_addr)
+ {
+ #ifdef CONFIG_P2P
++	wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
++
+ 	/*
+ 	 * Register a group member object corresponding to this peer and
+ 	 * emit a PeerJoined signal. This will check if it really is a
+@@ -564,10 +567,11 @@ static void wpas_notify_ap_sta_deauthori
+ 
+ 
+ void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
+-				const u8 *mac_addr, int authorized)
++				const u8 *mac_addr, int authorized,
++				const u8 *p2p_dev_addr)
+ {
+ 	if (authorized)
+-		wpas_notify_ap_sta_authorized(wpa_s, mac_addr);
++		wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
+ 	else
+ 		wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr);
+ }
+--- a/wpa_supplicant/notify.h
++++ b/wpa_supplicant/notify.h
+@@ -86,7 +86,8 @@ void wpas_notify_suspend(struct wpa_glob
+ void wpas_notify_resume(struct wpa_global *global);
+ 
+ void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
+-				const u8 *mac_addr, int authorized);
++				const u8 *mac_addr, int authorized,
++				const u8 *p2p_dev_addr);
+ void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
+ 				  const u8 *dev_addr, int new_device);
+ void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -468,6 +468,52 @@ static int wpas_p2p_store_persistent_gro
+ }
+ 
+ 
++static void wpas_p2p_add_persistent_group_client(struct wpa_supplicant *wpa_s,
++						 const u8 *addr)
++{
++	struct wpa_ssid *ssid, *s;
++	u8 *n;
++	size_t i;
++
++	ssid = wpa_s->current_ssid;
++	if (ssid == NULL || ssid->mode != WPAS_MODE_P2P_GO ||
++	    !ssid->p2p_persistent_group)
++		return;
++
++	for (s = wpa_s->parent->conf->ssid; s; s = s->next) {
++		if (s->disabled != 2 || s->mode != WPAS_MODE_P2P_GO)
++			continue;
++
++		if (s->ssid_len == ssid->ssid_len &&
++		    os_memcmp(s->ssid, ssid->ssid, s->ssid_len) == 0)
++			break;
++	}
++
++	if (s == NULL)
++		return;
++
++	for (i = 0; s->p2p_client_list && i < s->num_p2p_clients; i++) {
++		if (os_memcmp(s->p2p_client_list + i * ETH_ALEN, addr,
++			      ETH_ALEN) == 0)
++			return; /* already in list */
++	}
++
++	n = os_realloc(s->p2p_client_list,
++		       (s->num_p2p_clients + 1) * ETH_ALEN);
++	if (n == NULL)
++		return;
++	os_memcpy(n + s->num_p2p_clients * ETH_ALEN, addr, ETH_ALEN);
++	s->p2p_client_list = n;
++	s->num_p2p_clients++;
++
++#ifndef CONFIG_NO_CONFIG_WRITE
++	if (wpa_s->parent->conf->update_config &&
++	    wpa_config_write(wpa_s->parent->confname, wpa_s->parent->conf))
++		wpa_printf(MSG_DEBUG, "P2P: Failed to update configuration");
++#endif /* CONFIG_NO_CONFIG_WRITE */
++}
++
++
+ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
+ 					   int success)
+ {
+@@ -4312,12 +4358,31 @@ struct wpa_ssid * wpas_p2p_get_persisten
+ 					  const u8 *addr)
+ {
+ 	struct wpa_ssid *s;
++	size_t i;
+ 
+ 	for (s = wpa_s->conf->ssid; s; s = s->next) {
+-		if (s->disabled == 2 &&
+-		    os_memcmp(s->bssid, addr, ETH_ALEN) == 0)
+-			return s;
++		if (s->disabled != 2)
++			continue;
++		if (os_memcmp(s->bssid, addr, ETH_ALEN) == 0)
++			return s; /* peer is GO in the persistent group */
++		if (s->mode != WPAS_MODE_P2P_GO || s->p2p_client_list == NULL)
++			continue;
++		for (i = 0; i < s->num_p2p_clients; i++) {
++			if (os_memcmp(s->p2p_client_list + i * ETH_ALEN,
++				      addr, ETH_ALEN) == 0)
++				return s; /* peer is P2P client in persistent
++					   * group */
++		}
+ 	}
+ 
+ 	return NULL;
+ }
++
++
++void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
++				       const u8 *addr)
++{
++	if (addr == NULL)
++		return;
++	wpas_p2p_add_persistent_group_client(wpa_s, addr);
++}
+--- a/wpa_supplicant/p2p_supplicant.h
++++ b/wpa_supplicant/p2p_supplicant.h
+@@ -134,5 +134,7 @@ void wpas_p2p_network_removed(struct wpa
+ 			      struct wpa_ssid *ssid);
+ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
+ 					  const u8 *addr);
++void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
++				       const u8 *addr);
+ 
+ #endif /* P2P_SUPPLICANT_H */

Added: wpa/trunk/debian/patches/upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch (added)
+++ wpa/trunk/debian/patches/upstream/0025-P2P-Set-Invitation-Type-to-1-for-GO-inviting-to-a-pe.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,103 @@
+From 61d96aecb052746ee51bb4b6d22c89ff7078cbf3 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Mon, 6 Feb 2012 21:54:36 +0200
+Subject: [PATCH 25/58] P2P: Set Invitation Type to 1 for GO inviting to a
+ persistent group
+
+When a GO is operating a persistent group and invites a peer that has
+been a P2P client in that persistent group, the Invitation Type in the
+Invitation Request frame can be set to 1 to indicate that this is a
+reinvocation of a persistent group. Do this based on the maintained
+list of P2P clients that have been provided the credentials to this
+group.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit c427ac9211745a80c33d098dc8adc26fb9acd52c)
+---
+ wpa_supplicant/ctrl_iface.c     |    2 +-
+ wpa_supplicant/p2p_supplicant.c |   16 +++++++++++++---
+ wpa_supplicant/p2p_supplicant.h |    3 ++-
+ 3 files changed, 16 insertions(+), 5 deletions(-)
+
+--- a/wpa_supplicant/ctrl_iface.c
++++ b/wpa_supplicant/ctrl_iface.c
+@@ -2961,7 +2961,7 @@ static int p2p_ctrl_peer(struct wpa_supp
+ 		return pos - buf;
+ 	pos += res;
+ 
+-	ssid = wpas_p2p_get_persistent(wpa_s, info->p2p_device_addr);
++	ssid = wpas_p2p_get_persistent(wpa_s, info->p2p_device_addr, NULL, 0);
+ 	if (ssid) {
+ 		res = os_snprintf(pos, end - pos, "persistent=%d\n", ssid->id);
+ 		if (res < 0 || res >= end - pos)
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -3709,6 +3709,7 @@ int wpas_p2p_invite_group(struct wpa_sup
+ 	enum p2p_invite_role role;
+ 	u8 *bssid = NULL;
+ 	struct wpa_ssid *ssid;
++	int persistent;
+ 
+ 	for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+ 		if (os_strcmp(wpa_s->ifname, ifname) == 0)
+@@ -3726,6 +3727,10 @@ int wpas_p2p_invite_group(struct wpa_sup
+ 		return -1;
+ 	}
+ 
++	persistent = ssid->p2p_persistent_group &&
++		wpas_p2p_get_persistent(wpa_s->parent, peer_addr,
++					ssid->ssid, ssid->ssid_len);
++
+ 	if (ssid->mode == WPAS_MODE_P2P_GO) {
+ 		role = P2P_INVITE_ROLE_ACTIVE_GO;
+ 		bssid = wpa_s->own_addr;
+@@ -3748,14 +3753,14 @@ int wpas_p2p_invite_group(struct wpa_sup
+ 	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT)
+ 		return wpa_drv_p2p_invite(wpa_s, peer_addr, role, bssid,
+ 					  ssid->ssid, ssid->ssid_len,
+-					  go_dev_addr, 0);
++					  go_dev_addr, persistent);
+ 
+ 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
+ 		return -1;
+ 
+ 	return p2p_invite(wpa_s->global->p2p, peer_addr, role, bssid,
+ 			  ssid->ssid, ssid->ssid_len, wpa_s->assoc_freq,
+-			  go_dev_addr, 0);
++			  go_dev_addr, persistent);
+ }
+ 
+ 
+@@ -4355,7 +4360,8 @@ void wpas_p2p_network_removed(struct wpa
+ 
+ 
+ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
+-					  const u8 *addr)
++					  const u8 *addr, const u8 *ssid,
++					  size_t ssid_len)
+ {
+ 	struct wpa_ssid *s;
+ 	size_t i;
+@@ -4363,6 +4369,10 @@ struct wpa_ssid * wpas_p2p_get_persisten
+ 	for (s = wpa_s->conf->ssid; s; s = s->next) {
+ 		if (s->disabled != 2)
+ 			continue;
++		if (ssid &&
++		    (ssid_len != s->ssid_len ||
++		     os_memcmp(ssid, s->ssid, ssid_len) != 0))
++			continue;
+ 		if (os_memcmp(s->bssid, addr, ETH_ALEN) == 0)
+ 			return s; /* peer is GO in the persistent group */
+ 		if (s->mode != WPAS_MODE_P2P_GO || s->p2p_client_list == NULL)
+--- a/wpa_supplicant/p2p_supplicant.h
++++ b/wpa_supplicant/p2p_supplicant.h
+@@ -133,7 +133,8 @@ int wpas_p2p_in_progress(struct wpa_supp
+ void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
+ 			      struct wpa_ssid *ssid);
+ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
+-					  const u8 *addr);
++					  const u8 *addr, const u8 *ssid,
++					  size_t ssid_len);
+ void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
+ 				       const u8 *addr);
+ 

Added: wpa/trunk/debian/patches/upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch (added)
+++ wpa/trunk/debian/patches/upstream/0026-P2P-Allow-BSS-entry-to-be-fetched-based-on-GO-P2P-De.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,128 @@
+From 0a00a7df4b75324b0b60bd08bee1580e373e029c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Tue, 7 Feb 2012 16:23:21 +0200
+Subject: [PATCH 26/58] P2P: Allow BSS entry to be fetched based on GO P2P
+ Device Address
+
+"BSS p2p_dev_addr=<P2P Device Address>" can now be used to fetch a
+specific BSS entry based on the P2P Device Address of the GO to avoid
+having to iterate through the full BSS table when an external program
+needs to figure out whether a specific peer is currently operating as
+a GO.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 0a70f34f22162331cb515ffda9f125a68be12dec)
+---
+ src/p2p/p2p.c               |   26 ++++++++++++++++++++++++++
+ src/p2p/p2p.h               |    9 +++++++++
+ wpa_supplicant/bss.c        |   17 +++++++++++++++++
+ wpa_supplicant/bss.h        |    2 ++
+ wpa_supplicant/ctrl_iface.c |    7 +++++++
+ 5 files changed, 61 insertions(+)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -2068,6 +2068,32 @@ int p2p_scan_result_text(const u8 *ies,
+ }
+ 
+ 
++int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
++{
++	struct wpabuf *p2p_ie;
++	struct p2p_message msg;
++
++	p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
++					     P2P_IE_VENDOR_TYPE);
++	if (p2p_ie == NULL)
++		return -1;
++	os_memset(&msg, 0, sizeof(msg));
++	if (p2p_parse_p2p_ie(p2p_ie, &msg)) {
++		wpabuf_free(p2p_ie);
++		return -1;
++	}
++
++	if (msg.p2p_device_addr == NULL) {
++		wpabuf_free(p2p_ie);
++		return -1;
++	}
++
++	os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
++	wpabuf_free(p2p_ie);
++	return 0;
++}
++
++
+ static void p2p_clear_go_neg(struct p2p_data *p2p)
+ {
+ 	p2p->go_neg_peer = NULL;
+--- a/src/p2p/p2p.h
++++ b/src/p2p/p2p.h
+@@ -1355,6 +1355,15 @@ int p2p_ie_text(struct wpabuf *p2p_ie, c
+ int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end);
+ 
+ /**
++ * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s)
++ * @ies: Information elements from scan results
++ * @ies_len: ies buffer length in octets
++ * @dev_addr: Buffer for returning P2P Device Address
++ * Returns: 0 on success or -1 if P2P Device Address could not be parsed
++ */
++int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr);
++
++/**
+  * p2p_assoc_req_ie - Build P2P IE for (Re)Association Request frame
+  * @p2p: P2P module context from p2p_init()
+  * @bssid: BSSID
+--- a/wpa_supplicant/bss.c
++++ b/wpa_supplicant/bss.c
+@@ -540,6 +540,23 @@ struct wpa_bss * wpa_bss_get_bssid(struc
+ }
+ 
+ 
++#ifdef CONFIG_P2P
++struct wpa_bss * wpa_bss_get_p2p_dev_addr(struct wpa_supplicant *wpa_s,
++					  const u8 *dev_addr)
++{
++	struct wpa_bss *bss;
++	dl_list_for_each_reverse(bss, &wpa_s->bss, struct wpa_bss, list) {
++		u8 addr[ETH_ALEN];
++		if (p2p_parse_dev_addr((const u8 *) (bss + 1), bss->ie_len,
++				       addr) == 0 &&
++		    os_memcmp(addr, dev_addr, ETH_ALEN) == 0)
++			return bss;
++	}
++	return NULL;
++}
++#endif /* CONFIG_P2P */
++
++
+ struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id)
+ {
+ 	struct wpa_bss *bss;
+--- a/wpa_supplicant/bss.h
++++ b/wpa_supplicant/bss.h
+@@ -94,6 +94,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_
+ 			     const u8 *ssid, size_t ssid_len);
+ struct wpa_bss * wpa_bss_get_bssid(struct wpa_supplicant *wpa_s,
+ 				   const u8 *bssid);
++struct wpa_bss * wpa_bss_get_p2p_dev_addr(struct wpa_supplicant *wpa_s,
++					  const u8 *dev_addr);
+ struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id);
+ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
+ const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
+--- a/wpa_supplicant/ctrl_iface.c
++++ b/wpa_supplicant/ctrl_iface.c
+@@ -2119,6 +2119,13 @@ static int wpa_supplicant_ctrl_iface_bss
+ 				bss = dl_list_entry(next, struct wpa_bss,
+ 						    list_id);
+ 		}
++#ifdef CONFIG_P2P
++	} else if (os_strncmp(cmd, "p2p_dev_addr=", 13) == 0) {
++		if (hwaddr_aton(cmd + 13, bssid) == 0)
++			bss = wpa_bss_get_p2p_dev_addr(wpa_s, bssid);
++		else
++			bss = NULL;
++#endif /* CONFIG_P2P */
+ 	} else if (hwaddr_aton(cmd, bssid) == 0)
+ 		bss = wpa_bss_get_bssid(wpa_s, bssid);
+ 	else {

Added: wpa/trunk/debian/patches/upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch (added)
+++ wpa/trunk/debian/patches/upstream/0027-P2P-Move-p2p_add_device-prototype-to-correct-header-.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,39 @@
+From 08b15c826f3bd3000cfb649ac14d2c76703a5224 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Tue, 7 Feb 2012 16:26:20 +0200
+Subject: [PATCH 27/58] P2P: Move p2p_add_device() prototype to correct header
+ file
+
+This was supposed to be an internal API to be used only within
+src/p2p/*.c.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 59c8500f18cd379a8c8dc788fc6f01829420fbc4)
+---
+ src/p2p/p2p.h   |    3 ---
+ src/p2p/p2p_i.h |    2 ++
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+--- a/src/p2p/p2p.h
++++ b/src/p2p/p2p.h
+@@ -1490,9 +1490,6 @@ void p2p_set_cross_connect(struct p2p_da
+ 
+ int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
+ 
+-int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
+-		   const u8 *ies, size_t ies_len);
+-
+ /**
+  * p2p_set_intra_bss_dist - Set intra BSS distribution
+  * @p2p: P2P module context from p2p_init()
+--- a/src/p2p/p2p_i.h
++++ b/src/p2p/p2p_i.h
+@@ -649,6 +649,8 @@ struct p2p_device * p2p_add_dev_from_go_
+ 						struct p2p_message *msg);
+ void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
+ 		      struct p2p_device *dev, struct p2p_message *msg);
++int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
++		   const u8 *ies, size_t ies_len);
+ struct p2p_device * p2p_get_device(struct p2p_data *p2p, const u8 *addr);
+ struct p2p_device * p2p_get_device_interface(struct p2p_data *p2p,
+ 					     const u8 *addr);

Added: wpa/trunk/debian/patches/upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch (added)
+++ wpa/trunk/debian/patches/upstream/0028-P2P-Fix-p2p_scan-error-processing-in-p2p_search.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,30 @@
+From 495cce1dd91562964d6ececcb70e0c95f76581d3 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Thu, 9 Feb 2012 12:46:44 +0200
+Subject: [PATCH 28/58] P2P: Fix p2p_scan() error processing in p2p_search()
+
+Commit 39185dfa549f076a6be114e0149a3649d302f477 changed the p2p_scan()
+callback to return 1 in some cases, but forgot to change this p2p_scan()
+call to handle that properly. Fix this by processing any non-zero value
+as an error. This regression could leave the P2P module in state where
+it believed a P2P scan was still running and refused to start some
+operations until that scan gets completed (which would never happen
+since it was not really started).
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 165ec7305392b69d4cc8d57af126159a35b2aa1b)
+---
+ src/p2p/p2p.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -796,7 +796,7 @@ static void p2p_search(struct p2p_data *
+ 
+ 	if (p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, type, freq,
+ 			       p2p->num_req_dev_types, p2p->req_dev_types,
+-			       p2p->find_dev_id) < 0) {
++			       p2p->find_dev_id)) {
+ 		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+ 			"P2P: Scan request failed");
+ 		p2p_continue_find(p2p);

Added: wpa/trunk/debian/patches/upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch (added)
+++ wpa/trunk/debian/patches/upstream/0029-P2P-Avoid-re-starting-p2p_search-in-some-corner-case.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,41 @@
+From e177415c1932604ef6d5e64ce63294f85ae49417 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Thu, 9 Feb 2012 12:49:36 +0200
+Subject: [PATCH 29/58] P2P: Avoid re-starting p2p_search in some corner cases
+
+Search (p2p_scan) could already have been started at the point
+remain-on-channel end event is being processed, e.g., if an Action frame
+TX is reported immediately aftet the end of an earlier remain-on-channel
+operation and the response frame is sent using an offchannel operation
+while p2p_find is still in progress. Avoid trying to re-run p2p_scan
+while the previous one is still running.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 59acfe87aad300ae74e0233d62fa830179d00884)
+---
+ src/p2p/p2p.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -2823,6 +2823,20 @@ int p2p_listen_end(struct p2p_data *p2p,
+ 		p2p_connect_send(p2p, p2p->go_neg_peer);
+ 		return 1;
+ 	} else if (p2p->state == P2P_SEARCH) {
++		if (p2p->p2p_scan_running) {
++			 /*
++			  * Search is already in progress. This can happen if
++			  * an Action frame RX is reported immediately after
++			  * the end of a remain-on-channel operation and the
++			  * response frame to that is sent using an offchannel
++			  * operation while in p2p_find. Avoid an attempt to
++			  * restart a scan here.
++			  */
++			wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: p2p_scan "
++				"already in progress - do not try to start a "
++				"new one");
++			return 1;
++		}
+ 		p2p_search(p2p);
+ 		return 1;
+ 	}

Added: wpa/trunk/debian/patches/upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch (added)
+++ wpa/trunk/debian/patches/upstream/0030-P2P-Do-not-expire-GO-peer-entry-during-group-rekeyin.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,24 @@
+From 9c8db36f9ff056dbc33a33ef836442e13ac8c9b3 Mon Sep 17 00:00:00 2001
+From: Piotr Nakraszewicz <Piotr.Nakraszewicz at tieto.com>
+Date: Sat, 11 Feb 2012 10:54:40 +0200
+Subject: [PATCH 30/58] P2P: Do not expire GO peer entry during group rekeying
+
+If wpas_go_connected() is called during group rekeying the P2P GO peer
+will expire. To prevent that check if group rekeying is not in progress.
+(cherry picked from commit d9a0f666960ee096fbaf21e72818772dbfa043b7)
+---
+ wpa_supplicant/p2p_supplicant.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -2219,7 +2219,8 @@ static int wpas_go_connected(void *ctx,
+ 			continue;
+ 		if (ssid->mode != WPAS_MODE_INFRA)
+ 			continue;
+-		if (wpa_s->wpa_state != WPA_COMPLETED)
++		if (wpa_s->wpa_state != WPA_COMPLETED &&
++		    wpa_s->wpa_state != WPA_GROUP_HANDSHAKE)
+ 			continue;
+ 		if (os_memcmp(wpa_s->go_dev_addr, dev_addr, ETH_ALEN) == 0)
+ 			return 1;

Added: wpa/trunk/debian/patches/upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch (added)
+++ wpa/trunk/debian/patches/upstream/0031-EAP-pwd-Describe-build-option-for-EAP-pwd.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,36 @@
+From 13f58940d587b74941c956456e500e18fffc980d Mon Sep 17 00:00:00 2001
+From: Dan Harkins <dharkins at lounge.org>
+Date: Sat, 11 Feb 2012 12:17:58 +0200
+Subject: [PATCH 31/58] EAP-pwd: Describe build option for EAP-pwd
+
+Signed-hostap: Dan Harkins <dharkins at lounge.org>
+(cherry picked from commit 27c9d333d4bfab2b3ac377e5a7920e14a0fc6fe9)
+---
+ hostapd/defconfig        |    3 +++
+ wpa_supplicant/defconfig |    3 +++
+ 2 files changed, 6 insertions(+)
+
+--- a/hostapd/defconfig
++++ b/hostapd/defconfig
+@@ -84,6 +84,9 @@ CONFIG_EAP_TTLS=y
+ # EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
+ #CONFIG_EAP_PSK=y
+ 
++# EAP-pwd for the integrated EAP server (secure authentication with a password)
++#CONFIG_EAP_PWD=y
++
+ # EAP-SAKE for the integrated EAP server
+ #CONFIG_EAP_SAKE=y
+ 
+--- a/wpa_supplicant/defconfig
++++ b/wpa_supplicant/defconfig
+@@ -165,6 +165,9 @@ CONFIG_EAP_OTP=y
+ # EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
+ #CONFIG_EAP_PSK=y
+ 
++# EAP-pwd (secure authentication using only a password)
++#CONFIG_EAP_PWD=y
++
+ # EAP-PAX
+ #CONFIG_EAP_PAX=y
+ 

Added: wpa/trunk/debian/patches/upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch (added)
+++ wpa/trunk/debian/patches/upstream/0032-WPS-Fix-regression-in-post-WPS-scan-optimization.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,45 @@
+From 4a7f260a0d2b9c9e9033063cdaa437866aedd7dd Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 12 Feb 2012 13:54:15 +0200
+Subject: [PATCH 32/58] WPS: Fix regression in post-WPS scan optimization
+
+Commit 3c85f144ce7aa3967f881a7584a5b125061ca436 fixed issues with P2P
+Action frame TX after disconnection by clearing wpa_s->assoc_freq.
+This resulted in a regression to the post-WPS scan optimization that
+used wpa_s->assoc_freq to enable fast single-channel scan. Fix this by
+copying wpa_s->assoc_freq to a local variable before calling
+wpa_supplicant_deauthenticate() that ends up calling
+wpa_supplicant_mark_disassoc() which will clear assoc_freq.
+
+Reported-by: Angie Chinchilla <angie.v.chinchilla at intel.com>
+intended-for: hostap-1
+Signed-hostap: Jouni Malinen <j at w1.fi>
+
+(manually fixed cherry pick from commit a565c23bf3783f95f67107551404093c28d371c0)
+---
+ wpa_supplicant/wps_supplicant.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/wps_supplicant.c
++++ b/wpa_supplicant/wps_supplicant.c
+@@ -77,8 +77,10 @@ int wpas_wps_eapol_cb(struct wpa_supplic
+ 	if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPS && wpa_s->current_ssid &&
+ 	    !(wpa_s->current_ssid->key_mgmt & WPA_KEY_MGMT_WPS)) {
+ 		int disabled = wpa_s->current_ssid->disabled;
++		unsigned int freq = wpa_s->assoc_freq;
+ 		wpa_printf(MSG_DEBUG, "WPS: Network configuration replaced - "
+-			   "try to associate with the received credential");
++			   "try to associate with the received credential "
++			   "(freq=%u)", freq);
+ 		wpa_supplicant_deauthenticate(wpa_s,
+ 					      WLAN_REASON_DEAUTH_LEAVING);
+ 		if (disabled) {
+@@ -87,7 +89,7 @@ int wpas_wps_eapol_cb(struct wpa_supplic
+ 			return 1;
+ 		}
+ 		wpa_s->after_wps = 5;
+-		wpa_s->wps_freq = wpa_s->assoc_freq;
++		wpa_s->wps_freq = freq;
+ 		wpa_s->reassociate = 1;
+ 		wpa_supplicant_req_scan(wpa_s, 0, 0);
+ 		return 1;

Added: wpa/trunk/debian/patches/upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch (added)
+++ wpa/trunk/debian/patches/upstream/0033-Ignore-TX-status-for-Data-frames-from-not-associated.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,36 @@
+From 962ef491651039341583877e191ef920173d3f4c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Tue, 14 Feb 2012 21:04:14 +0200
+Subject: [PATCH 33/58] Ignore TX status for Data frames from not associated
+ STA
+
+Commit d9a38716ccf90b0ab307f570a30931684a1b8730 did this for
+hostapd_eapol_tx_status() but missed the older hostapd_tx_status()
+path. Address that case, too.
+
+The TX status event may be received after a station has been
+disassociated in cases where the disassociation is following a
+transmission of a Data frame. Ignore such events if the STA is not
+associated at the moment the event is being processed. This avoids
+confusing debug entries and rescheduling of the EAPOL TX timeouts for
+STAs that are still in the STA table, but are not really in active EAPOL
+session.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit 0c01d65d6deb4b4d721d255d0e7ca24d8ea2c6b5)
+---
+ src/ap/ieee802_11.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -1725,7 +1725,7 @@ void hostapd_tx_status(struct hostapd_da
+ 				break;
+ 		}
+ 	}
+-	if (sta == NULL)
++	if (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))
+ 		return;
+ 	if (sta->flags & WLAN_STA_PENDING_POLL) {
+ 		wpa_printf(MSG_DEBUG, "STA " MACSTR " %s pending "

Added: wpa/trunk/debian/patches/upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch (added)
+++ wpa/trunk/debian/patches/upstream/0034-EAP-SIM-AKA-server-Fix-re-authentication-not-to-upda.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,80 @@
+From 1f5b37fd49a6883309b2d80ea3af5528aa9162bc Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Thu, 16 Feb 2012 23:27:01 +0200
+Subject: [PATCH 34/58] EAP-SIM/AKA server: Fix re-authentication not to
+ update pseudonym
+
+AT_NEXT_PSEUDONYM is supposed to be included only in the Challenge
+messages, not in the Re-authentication messages. This attribute was
+incorrectly included in the Re-authentication messages and could have
+been used to update the pseudonym state on the server without the peer
+updating its state.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit 0047c047fc8bae4a78f48bc687011acc093d9680)
+---
+ src/eap_server/eap_server_aka.c |   14 +++++++-------
+ src/eap_server/eap_server_sim.c |   14 +++++++-------
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+--- a/src/eap_server/eap_server_aka.c
++++ b/src/eap_server/eap_server_aka.c
+@@ -298,8 +298,13 @@ static int eap_aka_build_encr(struct eap
+ 			      const u8 *nonce_s)
+ {
+ 	os_free(data->next_pseudonym);
+-	data->next_pseudonym =
+-		eap_sim_db_get_next_pseudonym(sm->eap_sim_db_priv, 1);
++	if (nonce_s == NULL) {
++		data->next_pseudonym =
++			eap_sim_db_get_next_pseudonym(sm->eap_sim_db_priv, 1);
++	} else {
++		/* Do not update pseudonym during re-authentication */
++		data->next_pseudonym = NULL;
++	}
+ 	os_free(data->next_reauth_id);
+ 	if (data->counter <= EAP_AKA_MAX_FAST_REAUTHS) {
+ 		data->next_reauth_id =
+@@ -1023,11 +1028,6 @@ static void eap_aka_process_reauth(struc
+ 		identity_len = id2_len;
+ 	}
+ 
+-	if (data->next_pseudonym) {
+-		eap_sim_db_add_pseudonym(sm->eap_sim_db_priv, identity,
+-					 identity_len, data->next_pseudonym);
+-		data->next_pseudonym = NULL;
+-	}
+ 	if (data->next_reauth_id) {
+ 		if (data->eap_method == EAP_TYPE_AKA_PRIME) {
+ #ifdef EAP_SERVER_AKA_PRIME
+--- a/src/eap_server/eap_server_sim.c
++++ b/src/eap_server/eap_server_sim.c
+@@ -137,8 +137,13 @@ static int eap_sim_build_encr(struct eap
+ 			      const u8 *nonce_s)
+ {
+ 	os_free(data->next_pseudonym);
+-	data->next_pseudonym =
+-		eap_sim_db_get_next_pseudonym(sm->eap_sim_db_priv, 0);
++	if (nonce_s == NULL) {
++		data->next_pseudonym =
++			eap_sim_db_get_next_pseudonym(sm->eap_sim_db_priv, 0);
++	} else {
++		/* Do not update pseudonym during re-authentication */
++		data->next_pseudonym = NULL;
++	}
+ 	os_free(data->next_reauth_id);
+ 	if (data->counter <= EAP_SIM_MAX_FAST_REAUTHS) {
+ 		data->next_reauth_id =
+@@ -622,11 +627,6 @@ static void eap_sim_process_reauth(struc
+ 		identity_len = id2_len;
+ 	}
+ 
+-	if (data->next_pseudonym) {
+-		eap_sim_db_add_pseudonym(sm->eap_sim_db_priv, identity,
+-					 identity_len, data->next_pseudonym);
+-		data->next_pseudonym = NULL;
+-	}
+ 	if (data->next_reauth_id) {
+ 		eap_sim_db_add_reauth(sm->eap_sim_db_priv, identity,
+ 				      identity_len, data->next_reauth_id,

Added: wpa/trunk/debian/patches/upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch (added)
+++ wpa/trunk/debian/patches/upstream/0035-Revert-nl80211-Fix-CONFIG_TDLS-y-build.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,26 @@
+From 1d931b280127317a8b3513d380f772867eda0ca9 Mon Sep 17 00:00:00 2001
+From: Angie Chinchilla <angie.v.chinchilla at intel.com>
+Date: Tue, 21 Feb 2012 13:29:38 -0800
+Subject: [PATCH 35/58] Revert "nl80211: Fix CONFIG_TDLS=y build"
+
+This reverts commit f75709d115185c4162e29ab73c0a9420e43d3893.
+This should not have picked up due to missing dependent code in
+other patches that were not picked up in hostap-1.
+
+Reported-by: Jouni Malinen <j at w1.fi>
+Signed-hostap: Angie Chinchilla <angie.v.chinchilla at intel.com>
+---
+ src/drivers/driver_nl80211.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -2465,7 +2465,7 @@ static int nl80211_register_action_frame
+ #ifdef CONFIG_TDLS
+ 	if ((drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) {
+ 		/* TDLS Discovery Response */
+-		if (nl80211_register_action_frame(bss, (u8 *) "\x04\x0e", 2) <
++		if (nl80211_register_action_frame(drv, (u8 *) "\x04\x0e", 2) <
+ 		    0)
+ 			return -1;
+ 	}

Added: wpa/trunk/debian/patches/upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch (added)
+++ wpa/trunk/debian/patches/upstream/0036-EAP-AKA-peer-Clean-up-forgetting-id-debug-prints.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,38 @@
+From 567d14fb23e3e40561f6ce791d6e3a330eb49985 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Thu, 16 Feb 2012 23:25:53 +0200
+Subject: [PATCH 36/58] EAP-AKA peer: Clean up forgetting-id debug prints
+
+Do not show forgetting of old id values if no value was stored.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+(cherry picked from commit 05c15c897d11e15dbb42679f5483e83b73d5044a)
+---
+ src/eap_peer/eap_aka.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/src/eap_peer/eap_aka.c
++++ b/src/eap_peer/eap_aka.c
+@@ -235,19 +235,19 @@ static int eap_aka_umts_auth(struct eap_
+ 
+ static void eap_aka_clear_identities(struct eap_aka_data *data, int id)
+ {
+-	if (id & CLEAR_PSEUDONYM) {
++	if ((id & CLEAR_PSEUDONYM) && data->pseudonym) {
+ 		wpa_printf(MSG_DEBUG, "EAP-AKA: forgetting old pseudonym");
+ 		os_free(data->pseudonym);
+ 		data->pseudonym = NULL;
+ 		data->pseudonym_len = 0;
+ 	}
+-	if (id & CLEAR_REAUTH_ID) {
++	if ((id & CLEAR_REAUTH_ID) && data->reauth_id) {
+ 		wpa_printf(MSG_DEBUG, "EAP-AKA: forgetting old reauth_id");
+ 		os_free(data->reauth_id);
+ 		data->reauth_id = NULL;
+ 		data->reauth_id_len = 0;
+ 	}
+-	if (id & CLEAR_EAP_ID) {
++	if ((id & CLEAR_EAP_ID) && data->last_eap_identity) {
+ 		wpa_printf(MSG_DEBUG, "EAP-AKA: forgetting old eap_id");
+ 		os_free(data->last_eap_identity);
+ 		data->last_eap_identity = NULL;

Added: wpa/trunk/debian/patches/upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch (added)
+++ wpa/trunk/debian/patches/upstream/0037-EAP-AKA-peer-Append-realm-when-learning-the-pseudony.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,95 @@
+From 0d461293a957bd86f2b722e30541cd55cb5301f6 Mon Sep 17 00:00:00 2001
+From: Simon Baatz <gmbnomis at gmail.com>
+Date: Sat, 28 Jan 2012 19:41:19 +0200
+Subject: [PATCH 37/58] EAP-AKA peer: Append realm when learning the pseudonym
+
+The pseudonym identity should use a realm in environments where a realm is
+used. Thus, the realm of the permanent identity is added to the pseudonym
+username sent by the server.
+
+Signed-hostap: Simon Baatz <gmbnomis at gmail.com>
+(cherry picked from commit 4ac384c596657bb96c22355d1dd13b85ffbad524)
+---
+ src/eap_peer/eap_aka.c |   39 ++++++++++++++++++++++++++++++---------
+ 1 file changed, 30 insertions(+), 9 deletions(-)
+
+--- a/src/eap_peer/eap_aka.c
++++ b/src/eap_peer/eap_aka.c
+@@ -256,24 +256,44 @@ static void eap_aka_clear_identities(str
+ }
+ 
+ 
+-static int eap_aka_learn_ids(struct eap_aka_data *data,
++static int eap_aka_learn_ids(struct eap_sm *sm, struct eap_aka_data *data,
+ 			     struct eap_sim_attrs *attr)
+ {
+ 	if (attr->next_pseudonym) {
++		const u8 *identity = NULL;
++		size_t identity_len = 0;
++		const u8 *realm = NULL;
++		size_t realm_len = 0;
++
++		wpa_hexdump_ascii(MSG_DEBUG,
++				  "EAP-AKA: (encr) AT_NEXT_PSEUDONYM",
++				  attr->next_pseudonym,
++				  attr->next_pseudonym_len);
+ 		os_free(data->pseudonym);
+-		data->pseudonym = os_malloc(attr->next_pseudonym_len);
++		/* Look for the realm of the permanent identity */
++		identity = eap_get_config_identity(sm, &identity_len);
++		if (identity) {
++			for (realm = identity, realm_len = identity_len;
++			     realm_len > 0; realm_len--, realm++) {
++				if (*realm == '@')
++					break;
++			}
++		}
++		data->pseudonym = os_malloc(attr->next_pseudonym_len +
++					    realm_len);
+ 		if (data->pseudonym == NULL) {
+ 			wpa_printf(MSG_INFO, "EAP-AKA: (encr) No memory for "
+ 				   "next pseudonym");
++			data->pseudonym_len = 0;
+ 			return -1;
+ 		}
+ 		os_memcpy(data->pseudonym, attr->next_pseudonym,
+ 			  attr->next_pseudonym_len);
+-		data->pseudonym_len = attr->next_pseudonym_len;
+-		wpa_hexdump_ascii(MSG_DEBUG,
+-				  "EAP-AKA: (encr) AT_NEXT_PSEUDONYM",
+-				  data->pseudonym,
+-				  data->pseudonym_len);
++		if (realm_len) {
++			os_memcpy(data->pseudonym + attr->next_pseudonym_len,
++				  realm, realm_len);
++		}
++		data->pseudonym_len = attr->next_pseudonym_len + realm_len;
+ 	}
+ 
+ 	if (attr->next_reauth_id) {
+@@ -282,6 +302,7 @@ static int eap_aka_learn_ids(struct eap_
+ 		if (data->reauth_id == NULL) {
+ 			wpa_printf(MSG_INFO, "EAP-AKA: (encr) No memory for "
+ 				   "next reauth_id");
++			data->reauth_id_len = 0;
+ 			return -1;
+ 		}
+ 		os_memcpy(data->reauth_id, attr->next_reauth_id,
+@@ -894,7 +915,7 @@ static struct wpabuf * eap_aka_process_c
+ 			return eap_aka_client_error(
+ 				data, id, EAP_AKA_UNABLE_TO_PROCESS_PACKET);
+ 		}
+-		eap_aka_learn_ids(data, &eattr);
++		eap_aka_learn_ids(sm, data, &eattr);
+ 		os_free(decrypted);
+ 	}
+ 
+@@ -1112,7 +1133,7 @@ static struct wpabuf * eap_aka_process_r
+ 					   data->msk, data->emsk);
+ 	}
+ 	eap_aka_clear_identities(data, CLEAR_REAUTH_ID | CLEAR_EAP_ID);
+-	eap_aka_learn_ids(data, &eattr);
++	eap_aka_learn_ids(sm, data, &eattr);
+ 
+ 	if (data->result_ind && attr->result_ind)
+ 		data->use_result_ind = 1;

Added: wpa/trunk/debian/patches/upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch (added)
+++ wpa/trunk/debian/patches/upstream/0038-EAP-SIM-peer-Append-realm-when-learning-the-pseudony.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,95 @@
+From e08d4320ca88464e126b219a3a2dfc690ffdf837 Mon Sep 17 00:00:00 2001
+From: Simon Baatz <gmbnomis at gmail.com>
+Date: Sat, 28 Jan 2012 19:38:46 +0200
+Subject: [PATCH 38/58] EAP-SIM peer: Append realm when learning the pseudonym
+
+The pseudonym identity should use a realm in environments where a realm is
+used. Thus, the realm of the permanent identity is added to the pseudonym
+username sent by the server.
+
+Signed-hostap: Simon Baatz <gmbnomis at gmail.com>
+(cherry picked from commit a6689be84fdeb0caa8c5bf1a730c18d47bd12859)
+---
+ src/eap_peer/eap_sim.c |   39 ++++++++++++++++++++++++++++++---------
+ 1 file changed, 30 insertions(+), 9 deletions(-)
+
+--- a/src/eap_peer/eap_sim.c
++++ b/src/eap_peer/eap_sim.c
+@@ -287,24 +287,44 @@ static void eap_sim_clear_identities(str
+ }
+ 
+ 
+-static int eap_sim_learn_ids(struct eap_sim_data *data,
++static int eap_sim_learn_ids(struct eap_sm *sm, struct eap_sim_data *data,
+ 			     struct eap_sim_attrs *attr)
+ {
+ 	if (attr->next_pseudonym) {
++		const u8 *identity = NULL;
++		size_t identity_len = 0;
++		const u8 *realm = NULL;
++		size_t realm_len = 0;
++
++		wpa_hexdump_ascii(MSG_DEBUG,
++				  "EAP-SIM: (encr) AT_NEXT_PSEUDONYM",
++				  attr->next_pseudonym,
++				  attr->next_pseudonym_len);
+ 		os_free(data->pseudonym);
+-		data->pseudonym = os_malloc(attr->next_pseudonym_len);
++		/* Look for the realm of the permanent identity */
++		identity = eap_get_config_identity(sm, &identity_len);
++		if (identity) {
++			for (realm = identity, realm_len = identity_len;
++			     realm_len > 0; realm_len--, realm++) {
++				if (*realm == '@')
++					break;
++			}
++		}
++		data->pseudonym = os_malloc(attr->next_pseudonym_len +
++					    realm_len);
+ 		if (data->pseudonym == NULL) {
+ 			wpa_printf(MSG_INFO, "EAP-SIM: (encr) No memory for "
+ 				   "next pseudonym");
++			data->pseudonym_len = 0;
+ 			return -1;
+ 		}
+ 		os_memcpy(data->pseudonym, attr->next_pseudonym,
+ 			  attr->next_pseudonym_len);
+-		data->pseudonym_len = attr->next_pseudonym_len;
+-		wpa_hexdump_ascii(MSG_DEBUG,
+-				  "EAP-SIM: (encr) AT_NEXT_PSEUDONYM",
+-				  data->pseudonym,
+-				  data->pseudonym_len);
++		if (realm_len) {
++			os_memcpy(data->pseudonym + attr->next_pseudonym_len,
++				  realm, realm_len);
++		}
++		data->pseudonym_len = attr->next_pseudonym_len + realm_len;
+ 	}
+ 
+ 	if (attr->next_reauth_id) {
+@@ -313,6 +333,7 @@ static int eap_sim_learn_ids(struct eap_
+ 		if (data->reauth_id == NULL) {
+ 			wpa_printf(MSG_INFO, "EAP-SIM: (encr) No memory for "
+ 				   "next reauth_id");
++			data->reauth_id_len = 0;
+ 			return -1;
+ 		}
+ 		os_memcpy(data->reauth_id, attr->next_reauth_id,
+@@ -663,7 +684,7 @@ static struct wpabuf * eap_sim_process_c
+ 			return eap_sim_client_error(
+ 				data, id, EAP_SIM_UNABLE_TO_PROCESS_PACKET);
+ 		}
+-		eap_sim_learn_ids(data, &eattr);
++		eap_sim_learn_ids(sm, data, &eattr);
+ 		os_free(decrypted);
+ 	}
+ 
+@@ -861,7 +882,7 @@ static struct wpabuf * eap_sim_process_r
+ 				   data->nonce_s, data->mk, data->msk,
+ 				   data->emsk);
+ 	eap_sim_clear_identities(data, CLEAR_REAUTH_ID | CLEAR_EAP_ID);
+-	eap_sim_learn_ids(data, &eattr);
++	eap_sim_learn_ids(sm, data, &eattr);
+ 
+ 	if (data->result_ind && attr->result_ind)
+ 		data->use_result_ind = 1;

Added: wpa/trunk/debian/patches/upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch (added)
+++ wpa/trunk/debian/patches/upstream/0039-P2P-Do-not-include-P2P-IE-in-association-request-to-.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,38 @@
+From fdfee3fc154f36b6015e4aba1dbf3f886e5297c4 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Fri, 17 Feb 2012 11:34:56 +0200
+Subject: [PATCH 39/58] P2P: Do not include P2P IE in association request to
+ non-P2P AP
+
+This was previously fixed for most cases in commit
+ffad8858370e297b22ff5d9e6e36372755364ec0, but the check here for
+drivers that implement SME/MLME was missed in that commit.
+
+This removes the P2P IE from (Re)Association Request frame with
+drivers that do not use wpa_supplicant SME implementation and are
+P2P cabable when associating with a non-P2P AP (i.e., not a GO or
+P2P WLAN manager AP).
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+intended-for: hostap-1
+(cherry picked from commit b8a8d6774bf045f72d76fb4ac3dd557c4ee9f369)
+---
+ wpa_supplicant/wpa_supplicant.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -1284,11 +1284,10 @@ void wpa_supplicant_associate(struct wpa
+ 		u8 *pos;
+ 		size_t len;
+ 		int res;
+-		int p2p_group;
+-		p2p_group = wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE;
+ 		pos = wpa_ie + wpa_ie_len;
+ 		len = sizeof(wpa_ie) - wpa_ie_len;
+-		res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len, p2p_group);
++		res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len,
++					    ssid->p2p_group);
+ 		if (res >= 0)
+ 			wpa_ie_len += res;
+ 	}

Added: wpa/trunk/debian/patches/upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch (added)
+++ wpa/trunk/debian/patches/upstream/0040-nl80211-Filter-unexpected-interface-added-up-events.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,67 @@
+From f84a6203700c2600f60819ad6aad678e042d1c04 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 18 Feb 2012 13:13:23 +0200
+Subject: [PATCH 40/58] nl80211: Filter unexpected interface added/up events
+
+It looks like a RTM_NEWLINK event claiming the interface to be UP is
+delivered just before removing an interface after having first indicated
+that the interface was going down/removed. Ignore this event if the
+interface is not present anymore at the moment the event is processed.
+This fixes issues where an interface that was re-added after being
+removed did not get reconfigured properly.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit d1f4942ba18a303d275bbd955161674939d1d902)
+---
+ src/drivers/driver_nl80211.c |   30 ++++++++++++++++++++++++++++--
+ 1 file changed, 28 insertions(+), 2 deletions(-)
+
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -516,10 +516,28 @@ static void wpa_driver_nl80211_event_lin
+ 		   del ? "removed" : "added");
+ 
+ 	if (os_strcmp(drv->first_bss.ifname, event.interface_status.ifname) == 0) {
+-		if (del)
++		if (del) {
++			if (drv->if_removed) {
++				wpa_printf(MSG_DEBUG, "nl80211: if_removed "
++					   "already set - ignore event");
++				return;
++			}
+ 			drv->if_removed = 1;
+-		else
++		} else {
++			if (if_nametoindex(drv->first_bss.ifname) == 0) {
++				wpa_printf(MSG_DEBUG, "nl80211: Interface %s "
++					   "does not exist - ignore "
++					   "RTM_NEWLINK",
++					   drv->first_bss.ifname);
++				return;
++			}
++			if (!drv->if_removed) {
++				wpa_printf(MSG_DEBUG, "nl80211: if_removed "
++					   "already cleared - ignore event");
++				return;
++			}
+ 			drv->if_removed = 0;
++		}
+ 	}
+ 
+ 	wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event);
+@@ -636,6 +654,14 @@ static void wpa_driver_nl80211_event_rtm
+ 			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
+ 				   "event since interface %s is down",
+ 				   namebuf);
++		} else if (if_nametoindex(drv->first_bss.ifname) == 0) {
++			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
++				   "event since interface %s does not exist",
++				   drv->first_bss.ifname);
++		} else if (drv->if_removed) {
++			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
++				   "event since interface %s is marked "
++				   "removed", drv->first_bss.ifname);
+ 		} else {
+ 			wpa_printf(MSG_DEBUG, "nl80211: Interface up");
+ 			drv->if_disabled = 0;

Added: wpa/trunk/debian/patches/upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch (added)
+++ wpa/trunk/debian/patches/upstream/0041-Use-WPA_INTERFACE_DISABLED-with-interface-removed-ev.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,33 @@
+From dcae1bb2071378eeade704295a4488a8edd03b2a Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 18 Feb 2012 13:16:17 +0200
+Subject: [PATCH 41/58] Use WPA_INTERFACE_DISABLED with interface removed
+ events
+
+This makes WPA_INTERFACE_DISABLED more consistent in indicating that
+wpa_supplicant cannot currently control the interface regardless of
+whether the interface is disabled or completely removed.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit cb6710a4a5725c036b69ff751545c32d37f2e7de)
+---
+ wpa_supplicant/events.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -1736,11 +1736,13 @@ wpa_supplicant_event_interface_status(st
+ 			wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
+ 				"driver after interface was added");
+ 		}
++		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ 		break;
+ 	case EVENT_INTERFACE_REMOVED:
+ 		wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
+ 		wpa_s->interface_removed = 1;
+ 		wpa_supplicant_mark_disassoc(wpa_s);
++		wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
+ 		l2_packet_deinit(wpa_s->l2);
+ 		wpa_s->l2 = NULL;
+ #ifdef CONFIG_IBSS_RSN

Added: wpa/trunk/debian/patches/upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch (added)
+++ wpa/trunk/debian/patches/upstream/0042-wext-Filter-unexpected-interface-added-up-events.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,89 @@
+From 6180e2d444d1d5b81ee45a35180c9d4449237b07 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sat, 18 Feb 2012 13:28:21 +0200
+Subject: [PATCH 42/58] wext: Filter unexpected interface added/up events
+
+It looks like a RTM_NEWLINK event claiming the interface to be UP is
+delivered just before removing an interface after having first indicated
+that the interface was going down/removed. Ignore this event if the
+interface is not present anymore at the moment the event is processed.
+This fixes issues where an interface that was re-added after being
+removed did not get reconfigured properly.
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit 6d441b0da228ac1ccca51676c9a93ec4e092d23f)
+---
+ src/drivers/driver_wext.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 40 insertions(+), 5 deletions(-)
+
+--- a/src/drivers/driver_wext.c
++++ b/src/drivers/driver_wext.c
+@@ -564,10 +564,28 @@ static void wpa_driver_wext_event_link(s
+ 		   del ? "removed" : "added");
+ 
+ 	if (os_strcmp(drv->ifname, event.interface_status.ifname) == 0) {
+-		if (del)
++		if (del) {
++			if (drv->if_removed) {
++				wpa_printf(MSG_DEBUG, "WEXT: if_removed "
++					   "already set - ignore event");
++				return;
++			}
+ 			drv->if_removed = 1;
+-		else
++		} else {
++			if (if_nametoindex(drv->ifname) == 0) {
++				wpa_printf(MSG_DEBUG, "WEXT: Interface %s "
++					   "does not exist - ignore "
++					   "RTM_NEWLINK",
++					   drv->ifname);
++				return;
++			}
++			if (!drv->if_removed) {
++				wpa_printf(MSG_DEBUG, "WEXT: if_removed "
++					   "already cleared - ignore event");
++				return;
++			}
+ 			drv->if_removed = 0;
++		}
+ 	}
+ 
+ 	wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event);
+@@ -623,6 +641,7 @@ static void wpa_driver_wext_event_rtm_ne
+ 	struct wpa_driver_wext_data *drv = ctx;
+ 	int attrlen, rta_len;
+ 	struct rtattr *attr;
++	char namebuf[IFNAMSIZ];
+ 
+ 	if (!wpa_driver_wext_own_ifindex(drv, ifi->ifi_index, buf, len)) {
+ 		wpa_printf(MSG_DEBUG, "Ignore event for foreign ifindex %d",
+@@ -645,9 +664,25 @@ static void wpa_driver_wext_event_rtm_ne
+ 	}
+ 
+ 	if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) {
+-		wpa_printf(MSG_DEBUG, "WEXT: Interface up");
+-		drv->if_disabled = 0;
+-		wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL);
++		if (if_indextoname(ifi->ifi_index, namebuf) &&
++		    linux_iface_up(drv->ioctl_sock, drv->ifname) == 0) {
++			wpa_printf(MSG_DEBUG, "WEXT: Ignore interface up "
++				   "event since interface %s is down",
++				   namebuf);
++		} else if (if_nametoindex(drv->ifname) == 0) {
++			wpa_printf(MSG_DEBUG, "WEXT: Ignore interface up "
++				   "event since interface %s does not exist",
++				   drv->ifname);
++		} else if (drv->if_removed) {
++			wpa_printf(MSG_DEBUG, "WEXT: Ignore interface up "
++				   "event since interface %s is marked "
++				   "removed", drv->ifname);
++		} else {
++			wpa_printf(MSG_DEBUG, "WEXT: Interface up");
++			drv->if_disabled = 0;
++			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
++					     NULL);
++		}
+ 	}
+ 
+ 	/*

Added: wpa/trunk/debian/patches/upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch (added)
+++ wpa/trunk/debian/patches/upstream/0043-dbus-Make-the-P2P-peer-s-properties-accessible-separ.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,417 @@
+From 49b1bce614776e4d1813a41e26a94c9fbf9b84db Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fl=C3=A1vio=20Ceolin?= <flavio.ceolin at profusion.mobi>
+Date: Sat, 11 Feb 2012 11:36:50 +0200
+Subject: [PATCH 43/58] dbus: Make the P2P peer's properties accessible
+ separately
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since there is the method org.freedesktop.DBus.Properties.GetAll that
+returns all properties from a specific interface, it makes more sense to
+separate the properties to make it possible to get only a single
+property using the method org.freedesktop.DBus.Properties.Get as well.
+
+Signed-hostap: Flávio Ceolin <flavio.ceolin at profusion.mobi>
+(cherry picked from commit 3f6e50ac282bbcb4be137023316543bd232ba350)
+---
+ wpa_supplicant/dbus/dbus_new.c              |   32 +++-
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |  276 ++++++++++++++++++++-------
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.h |   33 +++-
+ 3 files changed, 267 insertions(+), 74 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new.c
++++ b/wpa_supplicant/dbus/dbus_new.c
+@@ -2898,8 +2898,36 @@ int wpas_dbus_unregister_interface(struc
+ #ifdef CONFIG_P2P
+ 
+ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
+-	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_PEER, "a{sv}",
+-	  wpas_dbus_getter_p2p_peer_properties,
++	{ "DeviceName", WPAS_DBUS_NEW_IFACE_P2P_PEER, "s",
++	  wpas_dbus_getter_p2p_peer_device_name,
++	  NULL
++	},
++	{ "PrimaryDeviceType", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
++	  wpas_dbus_getter_p2p_peer_primary_device_type,
++	  NULL
++	},
++	{ "config_method", WPAS_DBUS_NEW_IFACE_P2P_PEER, "q",
++	  wpas_dbus_getter_p2p_peer_config_method,
++	  NULL
++	},
++	{ "level", WPAS_DBUS_NEW_IFACE_P2P_PEER, "i",
++	  wpas_dbus_getter_p2p_peer_level,
++	  NULL
++	},
++	{ "devicecapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
++	  wpas_dbus_getter_p2p_peer_device_capability,
++	  NULL
++	},
++	{ "groupcapability", WPAS_DBUS_NEW_IFACE_P2P_PEER, "y",
++	  wpas_dbus_getter_p2p_peer_group_capability,
++	  NULL
++	},
++	{ "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
++	  wpas_dbus_getter_p2p_peer_secondary_device_types,
++	  NULL
++	},
++	{ "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "as",
++	  wpas_dbus_getter_p2p_peer_vendor_extension,
+ 	  NULL
+ 	},
+ 	{ "IEs", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1172,14 +1172,13 @@ dbus_bool_t wpas_dbus_getter_p2p_peergo(
+  * Peer object properties accessor methods
+  */
+ 
+-dbus_bool_t wpas_dbus_getter_p2p_peer_properties(DBusMessageIter *iter,
+-	DBusError *error, void *user_data)
++dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
++						  DBusError *error,
++						  void *user_data)
+ {
+ 	struct peer_handler_args *peer_args = user_data;
+-	DBusMessageIter variant_iter, dict_iter;
+-	const struct p2p_peer_info *info = NULL;
+-	const struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
+-	int i, num;
++	const struct p2p_peer_info *info;
++	char *tmp;
+ 
+ 	if (!wpa_dbus_p2p_check_enabled(peer_args->wpa_s, NULL, NULL, error))
+ 		return FALSE;
+@@ -1188,66 +1187,210 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_pr
+ 	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
+ 				  peer_args->p2p_device_addr, 0);
+ 	if (info == NULL) {
+-		dbus_set_error(error, DBUS_ERROR_FAILED, "failed to find peer");
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
+ 		return FALSE;
+ 	}
+ 
+-	if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+-					      "a{sv}", &variant_iter) ||
+-	    !wpa_dbus_dict_open_write(&variant_iter, &dict_iter))
+-		goto err_no_mem;
++	tmp = os_strdup(info->device_name);
++	if (!tmp) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
+ 
+-	/* Fill out the dictionary */
+-	if (!wpa_dbus_dict_append_string(&dict_iter, "DeviceName",
+-					 info->device_name))
+-		goto err_no_mem;
+-	if (!wpa_dbus_dict_append_byte_array(&dict_iter, "PrimaryDeviceType",
+-					     (char *)info->pri_dev_type,
+-					     WPS_DEV_TYPE_LEN))
+-		goto err_no_mem;
+-	if (!wpa_dbus_dict_append_uint16(&dict_iter, "config_method",
+-					 info->config_methods))
+-		goto err_no_mem;
+-	if (!wpa_dbus_dict_append_int32(&dict_iter, "level",
+-					info->level))
+-		goto err_no_mem;
+-	if (!wpa_dbus_dict_append_byte(&dict_iter, "devicecapability",
+-				       info->dev_capab))
+-		goto err_no_mem;
+-	if (!wpa_dbus_dict_append_byte(&dict_iter, "groupcapability",
+-				       info->group_capab))
+-		goto err_no_mem;
++	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING, &tmp,
++					      error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		os_free(tmp);
++		return FALSE;
++	}
++
++	os_free(tmp);
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
++	DBusMessageIter *iter, DBusError *error, void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
++
++	if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
++						    (char *)
++						    info->pri_dev_type,
++						    WPS_DEV_TYPE_LEN, error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_config_method(DBusMessageIter *iter,
++                                                    DBusError *error,
++                                                    void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
++
++	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
++					      &info->config_methods, error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
++                                            DBusError *error,
++                                            void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
++
++	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
++					      &info->level, error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
++                                                        DBusError *error,
++                                                        void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
++
++	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BYTE,
++					      &info->dev_capab, error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_group_capability(DBusMessageIter *iter,
++						       DBusError *error,
++						       void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
++
++	if (!wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BYTE,
++					      &info->group_capab, error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_secondary_device_types(
++	DBusMessageIter *iter, DBusError *error, void *user_data)
++{
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
++	}
+ 
+ 	if (info->wps_sec_dev_type_list_len) {
+ 		const u8 *sec_dev_type_list = info->wps_sec_dev_type_list;
+-		int num_sec_dev_types =
+-			info->wps_sec_dev_type_list_len / WPS_DEV_TYPE_LEN;
+-		DBusMessageIter iter_secdev_dict_entry, iter_secdev_dict_val,
+-				iter_secdev_dict_array;
+-
+-		if (num_sec_dev_types) {
+-			if (!wpa_dbus_dict_begin_array(&dict_iter,
+-						"SecondaryDeviceTypes",
+-						DBUS_TYPE_ARRAY_AS_STRING
+-						DBUS_TYPE_BYTE_AS_STRING,
+-						&iter_secdev_dict_entry,
+-						&iter_secdev_dict_val,
+-						&iter_secdev_dict_array))
+-				goto err_no_mem;
+-			for (i = 0; i < num_sec_dev_types; i++) {
+-				wpa_dbus_dict_bin_array_add_element(
+-						&iter_secdev_dict_array,
+-						sec_dev_type_list,
+-						WPS_DEV_TYPE_LEN);
+-				sec_dev_type_list += WPS_DEV_TYPE_LEN;
+-			}
+-
+-			if (!wpa_dbus_dict_end_array(&dict_iter,
+-						&iter_secdev_dict_entry,
+-						&iter_secdev_dict_val,
+-						&iter_secdev_dict_array))
+-				goto err_no_mem;
+-		}
++		int num_sec_dev_types = info->wps_sec_dev_type_list_len;
++
++		if (!wpas_dbus_simple_array_property_getter(iter,
++							    DBUS_TYPE_BYTE,
++							    sec_dev_type_list,
++							    num_sec_dev_types,
++							    error))
++			goto err_no_mem;
++		else
++			return TRUE;
++	}
++
++	if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE, NULL,
++						    0, error))
++		goto err_no_mem;
++
++	return TRUE;
++
++err_no_mem:
++	dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++	return FALSE;
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_vendor_extension(DBusMessageIter *iter,
++						       DBusError *error,
++						       void *user_data)
++{
++	const struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
++	int i, num;
++	struct peer_handler_args *peer_args = user_data;
++	const struct p2p_peer_info *info;
++
++	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
++				  peer_args->p2p_device_addr, 0);
++	if (info == NULL) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "failed to find peer");
++		return FALSE;
+ 	}
+ 
+ 	/* Add WPS vendor extensions attribute */
+@@ -1258,19 +1401,14 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_pr
+ 		num++;
+ 	}
+ 
+-	if (!wpa_dbus_dict_append_wpabuf_array(&dict_iter, "VendorExtension",
+-					       vendor_extension, num))
+-		goto err_no_mem;
+-
+-	if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
+-	    !dbus_message_iter_close_container(iter, &variant_iter))
+-		goto err_no_mem;
++	if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_STRING,
++						    vendor_extension, num,
++						    error)) {
++		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++		return FALSE;
++	}
+ 
+ 	return TRUE;
+-
+-err_no_mem:
+-	dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+-	return FALSE;
+ }
+ 
+ 
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+@@ -118,9 +118,36 @@ dbus_bool_t wpas_dbus_getter_p2p_peergo(
+ /*
+  * P2P Peer properties.
+  */
+-dbus_bool_t wpas_dbus_getter_p2p_peer_properties(DBusMessageIter *iter,
+-						 DBusError *error,
+-						 void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_device_name(DBusMessageIter *iter,
++                                                  DBusError *error,
++                                                  void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_primary_device_type(
++	DBusMessageIter *iter, DBusError *error, void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_config_method(DBusMessageIter *iter,
++                                                    DBusError *error,
++                                                    void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_level(DBusMessageIter *iter,
++                                            DBusError *error,
++                                            void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_device_capability(DBusMessageIter *iter,
++                                                        DBusError *error,
++                                                        void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_group_capability(DBusMessageIter *iter,
++                                                       DBusError *error,
++                                                       void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_secondary_device_types(
++	DBusMessageIter *iter, DBusError *error, void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_peer_vendor_extension(DBusMessageIter *iter,
++                                                       DBusError *error,
++                                                       void *user_data);
+ 
+ dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
+ 					  DBusError *error,

Added: wpa/trunk/debian/patches/upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch (added)
+++ wpa/trunk/debian/patches/upstream/0044-dbus-utility-to-create-dbus-message-from-wpabuf-arra.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,113 @@
+From db4b7c8db78d7e4f6ba1ee84bc470a8256854ed8 Mon Sep 17 00:00:00 2001
+From: Jayant Sane <jayant.sane at intel.com>
+Date: Sat, 25 Feb 2012 10:45:17 +0200
+Subject: [PATCH 44/58] dbus: utility to create dbus message from wpabuf array
+
+If a wpabuf array is used to store basic typed data that we would like
+to send over D-Bus then this utility will be of help when it places the
+data in a variant with format aa? (array of an array of type ?, with ?
+indicating any basic type).
+
+Signed-hostap: Jayant Sane <jayant.sane at intel.com>
+Signed-hostap: Angie Chinchilla <angie.v.chinchilla at intel.com>
+intended-for: hostap-1
+(cherry picked from commit 96c4f3a70754a142318264de963b0ec41271987c)
+---
+ wpa_supplicant/dbus/dbus_new_handlers.c |   70 +++++++++++++++++++++++++++++++
+ wpa_supplicant/dbus/dbus_new_handlers.h |    6 +++
+ 2 files changed, 76 insertions(+)
+
+--- a/wpa_supplicant/dbus/dbus_new_handlers.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers.c
+@@ -449,6 +449,76 @@ dbus_bool_t wpas_dbus_simple_array_prope
+ 
+ 
+ /**
++ * wpas_dbus_simple_array_array_property_getter - Get array array type property
++ * @iter: Pointer to incoming dbus message iterator
++ * @type: DBus type of property array elements (must be basic type)
++ * @array: pointer to array of elements to put into response message
++ * @array_len: length of above array
++ * @error: a pointer to an error to fill on failure
++ * Returns: TRUE if the request succeeded, FALSE if it failed
++ *
++ * Generic getter for array type properties. Array elements type is
++ * required to be basic.
++ */
++dbus_bool_t wpas_dbus_simple_array_array_property_getter(DBusMessageIter *iter,
++							 const int type,
++							 struct wpabuf **array,
++							 size_t array_len,
++							 DBusError *error)
++{
++	DBusMessageIter variant_iter, array_iter;
++	char type_str[] = "aa?";
++	char inner_type_str[] = "a?";
++	const char *sub_type_str;
++	size_t i;
++
++	if (!dbus_type_is_basic(type)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "%s: given type is not basic", __func__);
++		return FALSE;
++	}
++
++	sub_type_str = wpa_dbus_type_as_string(type);
++	type_str[2] = sub_type_str[0];
++	inner_type_str[1] = sub_type_str[0];
++
++	if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
++					      type_str, &variant_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "%s: failed to construct message 1", __func__);
++		return FALSE;
++	}
++	if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
++					      inner_type_str, &array_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "%s: failed to construct message 2", __func__);
++		return FALSE;
++	}
++
++	for (i = 0; i < array_len; i++) {
++		wpa_dbus_dict_bin_array_add_element(&array_iter,
++						    wpabuf_head(array[i]),
++						    wpabuf_len(array[i]));
++
++	}
++
++	if (!dbus_message_iter_close_container(&variant_iter, &array_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "%s: failed to close message 2", __func__);
++		return FALSE;
++	}
++
++	if (!dbus_message_iter_close_container(iter, &variant_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++			       "%s: failed to close message 1", __func__);
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++/**
+  * wpas_dbus_handler_create_interface - Request registration of a network iface
+  * @message: Pointer to incoming dbus message
+  * @global: %wpa_supplicant global data structure
+--- a/wpa_supplicant/dbus/dbus_new_handlers.h
++++ b/wpa_supplicant/dbus/dbus_new_handlers.h
+@@ -41,6 +41,12 @@ dbus_bool_t wpas_dbus_simple_array_prope
+ 						   size_t array_len,
+ 						   DBusError *error);
+ 
++dbus_bool_t wpas_dbus_simple_array_array_property_getter(DBusMessageIter *iter,
++							 const int type,
++							 struct wpabuf **array,
++							 size_t array_len,
++							 DBusError *error);
++
+ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
+ 						 struct wpa_global *global);
+ 

Added: wpa/trunk/debian/patches/upstream/0045-dbus-revert-changes-to-some-peer-properties.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0045-dbus-revert-changes-to-some-peer-properties.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0045-dbus-revert-changes-to-some-peer-properties.patch (added)
+++ wpa/trunk/debian/patches/upstream/0045-dbus-revert-changes-to-some-peer-properties.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,182 @@
+From 3d8748b1789531e58212390206ed64dc7040fc8c Mon Sep 17 00:00:00 2001
+From: Reinette Chatre <reinette.chatre at intel.com>
+Date: Sat, 25 Feb 2012 10:50:13 +0200
+Subject: [PATCH 45/58] dbus: revert changes to some peer properties
+
+Commit 3f6e50ac282bbcb4be137023316543bd232ba350 made it possible to access
+P2P peer properties using the org.freedesktop.DBus.Properties interface.
+
+While maintaining the original intent of that patch we make two changes
+to it here:
+
+First, 3f6e50ac282bbcb4be137023316543bd232ba350 changed the type used to
+represent the WPS vendor extension data from bytes to a string. In
+addition to the type change the way in which the vendor extension data
+was provided to the function creating the string was incorrect and would
+not present the correct vendor extension data even in string format.
+
+Revert the type change made in 3f6e50ac282bbcb4be137023316543bd232ba350
+and present the WPS vendor extension data as an array of an array of
+bytes as it was before.
+
+Second, 3f6e50ac282bbcb4be137023316543bd232ba350 changes the secondary
+device types representation from an array of an array of bytes to an
+array of bytes. Revert that change to make secondary device types
+accessible via an array of an array of bytes again.
+
+Signed-hostap: Reinette Chatre <reinette.chatre at intel.com>
+intended-for: hostap-1
+(cherry picked from commit ca298427004f0f68de042fa6d3061a706f52f18c)
+---
+ wpa_supplicant/dbus/dbus_new.c              |    4 +-
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |   94 ++++++++++++++++++++-------
+ 2 files changed, 74 insertions(+), 24 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new.c
++++ b/wpa_supplicant/dbus/dbus_new.c
+@@ -2922,11 +2922,11 @@ static const struct wpa_dbus_property_de
+ 	  wpas_dbus_getter_p2p_peer_group_capability,
+ 	  NULL
+ 	},
+-	{ "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "ay",
++	{ "SecondaryDeviceTypes", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
+ 	  wpas_dbus_getter_p2p_peer_secondary_device_types,
+ 	  NULL
+ 	},
+-	{ "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "as",
++	{ "VendorExtension", WPAS_DBUS_NEW_IFACE_P2P_PEER, "aay",
+ 	  wpas_dbus_getter_p2p_peer_vendor_extension,
+ 	  NULL
+ 	},
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1341,6 +1341,7 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_se
+ {
+ 	struct peer_handler_args *peer_args = user_data;
+ 	const struct p2p_peer_info *info;
++	DBusMessageIter variant_iter, array_iter;
+ 
+ 	info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
+ 				  peer_args->p2p_device_addr, 0);
+@@ -1350,29 +1351,80 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_se
+ 		return FALSE;
+ 	}
+ 
++	if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
++					      DBUS_TYPE_ARRAY_AS_STRING
++					      DBUS_TYPE_ARRAY_AS_STRING
++					      DBUS_TYPE_BYTE_AS_STRING,
++					      &variant_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++		               "%s: failed to construct message 1", __func__);
++		return FALSE;
++	}
++
++	if (!dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
++					      DBUS_TYPE_ARRAY_AS_STRING
++					      DBUS_TYPE_BYTE_AS_STRING,
++					      &array_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++		               "%s: failed to construct message 2", __func__);
++		return FALSE;
++	}
++
+ 	if (info->wps_sec_dev_type_list_len) {
+ 		const u8 *sec_dev_type_list = info->wps_sec_dev_type_list;
+-		int num_sec_dev_types = info->wps_sec_dev_type_list_len;
++		int num_sec_device_types =
++			info->wps_sec_dev_type_list_len / WPS_DEV_TYPE_LEN;
++		int i;
++		DBusMessageIter inner_array_iter;
++
++		for (i = 0; i < num_sec_device_types; i++) {
++			if (!dbus_message_iter_open_container(
++				    &array_iter, DBUS_TYPE_ARRAY,
++				    DBUS_TYPE_BYTE_AS_STRING,
++				    &inner_array_iter)) {
++				dbus_set_error(error, DBUS_ERROR_FAILED,
++					       "%s: failed to construct "
++					       "message 3 (%d)",
++					       __func__, i);
++				return FALSE;
++			}
++
++			if (!dbus_message_iter_append_fixed_array(
++				    &inner_array_iter, DBUS_TYPE_BYTE,
++				    &sec_dev_type_list, WPS_DEV_TYPE_LEN)) {
++				dbus_set_error(error, DBUS_ERROR_FAILED,
++					       "%s: failed to construct "
++					       "message 4 (%d)",
++					       __func__, i);
++				return FALSE;
++			}
++
++			if (!dbus_message_iter_close_container(
++				    &array_iter, &inner_array_iter)) {
++				dbus_set_error(error, DBUS_ERROR_FAILED,
++					       "%s: failed to construct "
++					       "message 5 (%d)",
++					       __func__, i);
++				return FALSE;
++			}
+ 
+-		if (!wpas_dbus_simple_array_property_getter(iter,
+-							    DBUS_TYPE_BYTE,
+-							    sec_dev_type_list,
+-							    num_sec_dev_types,
+-							    error))
+-			goto err_no_mem;
+-		else
+-			return TRUE;
++			sec_dev_type_list += WPS_DEV_TYPE_LEN;
++		}
+ 	}
+ 
+-	if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE, NULL,
+-						    0, error))
+-		goto err_no_mem;
++	if (!dbus_message_iter_close_container(&variant_iter, &array_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++		               "%s: failed to construct message 6", __func__);
++		return FALSE;
++	}
+ 
+-	return TRUE;
++	if (!dbus_message_iter_close_container(iter, &variant_iter)) {
++		dbus_set_error(error, DBUS_ERROR_FAILED,
++		               "%s: failed to construct message 7", __func__);
++		return FALSE;
++	}
+ 
+-err_no_mem:
+-	dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+-	return FALSE;
++	return TRUE;
+ }
+ 
+ 
+@@ -1380,7 +1432,7 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ve
+ 						       DBusError *error,
+ 						       void *user_data)
+ {
+-	const struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
++	struct wpabuf *vendor_extension[P2P_MAX_WPS_VENDOR_EXT];
+ 	int i, num;
+ 	struct peer_handler_args *peer_args = user_data;
+ 	const struct p2p_peer_info *info;
+@@ -1401,12 +1453,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ve
+ 		num++;
+ 	}
+ 
+-	if (!wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_STRING,
+-						    vendor_extension, num,
+-						    error)) {
+-		dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
++	if (!wpas_dbus_simple_array_array_property_getter(iter, DBUS_TYPE_BYTE,
++							  vendor_extension,
++							  num, error))
+ 		return FALSE;
+-	}
+ 
+ 	return TRUE;
+ }

Added: wpa/trunk/debian/patches/upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch (added)
+++ wpa/trunk/debian/patches/upstream/0046-dbus-return-NULL-data-for-peer-IEs.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,33 @@
+From 717ee459a4d08b2b68b1ad22a62403a567ca3b0d Mon Sep 17 00:00:00 2001
+From: Reinette Chatre <reinette.chatre at intel.com>
+Date: Sat, 25 Feb 2012 10:54:11 +0200
+Subject: [PATCH 46/58] dbus: return NULL data for peer IEs
+
+The org.freedesktop.DBus.Properties interface is now supported for peer
+properties. Ensure that GetAll will work by having the IEs property
+function return NULL data instead of a failure until it is implemented.
+
+Signed-hostap: Reinette Chatre <reinette.chatre at intel.com>
+intended-for: hostap-1
+(cherry picked from commit 93d1749fe09522892779151f0e22adb3e52efa20)
+---
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1465,10 +1465,12 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_ve
+ dbus_bool_t wpas_dbus_getter_p2p_peer_ies(DBusMessageIter *iter,
+ 					  DBusError *error, void *user_data)
+ {
++	dbus_bool_t success;
+ 	/* struct peer_handler_args *peer_args = user_data; */
+ 
+-	dbus_set_error_const(error, DBUS_ERROR_FAILED, "not implemented");
+-	return FALSE;
++	success = wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
++							 NULL, 0, error);
++	return success;
+ }
+ 
+ 

Added: wpa/trunk/debian/patches/upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch (added)
+++ wpa/trunk/debian/patches/upstream/0047-P2P-Fix-group-idle-timer-cancellation-on-group-remov.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,47 @@
+From 791e6df3dfb605acda94732eb35214d818c4f68d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Sun, 19 Feb 2012 18:10:20 +0200
+Subject: [PATCH 47/58] P2P: Fix group idle timer cancellation on group
+ removal
+
+The wpas_p2p_group_idle_timeout was getting cancelled in the beginning
+of wpas_p2p_group_delete(). However, in the case of P2P client role,
+this function called wpa_supplicant_deauthenticate() next and that ended
+up changing state to WPA_DISCONNECTED which resulted in
+wpas_p2p_notif_disconnected() rescheduling the timeout. This left the
+unexpected timeout behind after the group was removed. If another group
+operation was started within P2P_MAX_CLIENT_IDLE (10) seconds, that
+timeout could end up terminating the group while it was still being set
+up.
+
+Fix this by reordering wpas_p2p_group_delete() to cancel the group idle
+timeout only after having called wpa_supplicant_deauthenticate(). The
+group idle timeout is still rescheduled, but it gets removed immediately
+afterwards when the actual group information is being cleared.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit a7a30b90e59e7c9f9db5ec5db6190a0fba4fc37e)
+---
+ wpa_supplicant/p2p_supplicant.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -219,8 +219,6 @@ static void wpas_p2p_group_delete(struct
+ 	char *gtype;
+ 	const char *reason;
+ 
+-	eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
+-
+ 	ssid = wpa_s->current_ssid;
+ 	if (ssid == NULL) {
+ 		/*
+@@ -270,6 +268,8 @@ static void wpas_p2p_group_delete(struct
+ 	wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_REMOVED "%s %s%s",
+ 		wpa_s->ifname, gtype, reason);
+ 
++	eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
++
+ 	if (ssid)
+ 		wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
+ 

Added: wpa/trunk/debian/patches/upstream/0048-Fix-processing-of-channel-list-update-events.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0048-Fix-processing-of-channel-list-update-events.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0048-Fix-processing-of-channel-list-update-events.patch (added)
+++ wpa/trunk/debian/patches/upstream/0048-Fix-processing-of-channel-list-update-events.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,57 @@
+From 449185b0e6d45fdb27537c4b9be5a4f52d5cf29a Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Thu, 1 Mar 2012 17:53:53 +0200
+Subject: [PATCH 48/58] Fix processing of channel list update events
+
+Commit 6bf731e8cea4d9d41665d271b331e096c7c569e9 broke handling of
+EVENT_CHANNEL_LIST_CHANGED by introducing a cached copy of the driver
+channel list that does not get updated even if driver changes its list.
+Fix this by synchronizing the cacched wpa_s->hw.modes information
+whenever EVENT_CHANNEL_LIST_CHANGED is processed. This fixes P2P channel
+list updates based on regulatory domain hints that may trigger driver to
+change its supported channel list.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+intended-for: hostap-1
+(cherry picked from commit 6979582ca6ff9b82c77fd81025fdcaed4f67e593)
+---
+ wpa_supplicant/events.c           |    5 +++++
+ wpa_supplicant/wpa_supplicant.c   |    2 +-
+ wpa_supplicant/wpa_supplicant_i.h |    1 +
+ 3 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -2413,6 +2413,11 @@ void wpa_supplicant_event(void *ctx, enu
+ 	case EVENT_CHANNEL_LIST_CHANGED:
+ 		if (wpa_s->drv_priv == NULL)
+ 			break; /* Ignore event during drv initialization */
++
++		free_hw_features(wpa_s);
++		wpa_s->hw.modes = wpa_drv_get_hw_feature_data(
++			wpa_s, &wpa_s->hw.num_modes, &wpa_s->hw.flags);
++
+ #ifdef CONFIG_P2P
+ 		wpas_p2p_update_channel_list(wpa_s);
+ #endif /* CONFIG_P2P */
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -370,7 +370,7 @@ void wpa_supplicant_set_non_wpa_policy(s
+ }
+ 
+ 
+-static void free_hw_features(struct wpa_supplicant *wpa_s)
++void free_hw_features(struct wpa_supplicant *wpa_s)
+ {
+ 	int i;
+ 	if (wpa_s->hw.modes == NULL)
+--- a/wpa_supplicant/wpa_supplicant_i.h
++++ b/wpa_supplicant/wpa_supplicant_i.h
+@@ -558,6 +558,7 @@ int wpa_supplicant_set_bss_expiration_co
+ int wpa_supplicant_set_debug_params(struct wpa_global *global,
+ 				    int debug_level, int debug_timestamp,
+ 				    int debug_show_keys);
++void free_hw_features(struct wpa_supplicant *wpa_s);
+ 
+ void wpa_show_license(void);
+ 

Added: wpa/trunk/debian/patches/upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch (added)
+++ wpa/trunk/debian/patches/upstream/0049-P2P-Skip-duplicated-provision-discovery-on-join.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,189 @@
+From 8a5a27b668a14ae4a3b9ddef4196be4eff9193f0 Mon Sep 17 00:00:00 2001
+From: Jithu Jance <jithu at broadcom.com>
+Date: Tue, 6 Dec 2011 21:44:57 +0200
+Subject: [PATCH 49/58] P2P: Skip duplicated provision discovery on join
+
+If p2p_prov_disc join command is used prior to p2p_connect join,
+skip the duplicated provision discovery exchange.
+
+Signed-hostap: Jithu Jance <jithu at broadcom.com>
+(cherry picked from commit ec437d9e748a44d6dc31fb54e9f601e092f7dfcf)
+---
+ src/p2p/p2p.c                   |   28 ++++++++++++++++++++++++++++
+ src/p2p/p2p.h                   |   22 ++++++++++++++++++++++
+ src/p2p/p2p_i.h                 |    8 ++++++++
+ src/p2p/p2p_pd.c                |    7 +++++++
+ wpa_supplicant/p2p_supplicant.c |   33 +++++++++++++++++++++++++++++++++
+ 5 files changed, 98 insertions(+)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -142,6 +142,34 @@ static const char * p2p_state_txt(int st
+ }
+ 
+ 
++u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr)
++{
++	struct p2p_device *dev = NULL;
++
++	if (!addr || !p2p)
++		return 0;
++
++	dev = p2p_get_device(p2p, addr);
++	if (dev)
++		return dev->wps_prov_info;
++	else
++		return 0;
++}
++
++
++void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr)
++{
++	struct p2p_device *dev = NULL;
++
++	if (!iface_addr || !p2p)
++		return;
++
++	dev = p2p_get_device_interface(p2p, iface_addr);
++	if (dev)
++		dev->wps_prov_info = 0;
++}
++
++
+ void p2p_set_state(struct p2p_data *p2p, int new_state)
+ {
+ 	wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: State %s -> %s",
+--- a/src/p2p/p2p.h
++++ b/src/p2p/p2p.h
+@@ -1051,6 +1051,28 @@ void p2p_wps_success_cb(struct p2p_data
+  */
+ void p2p_group_formation_failed(struct p2p_data *p2p);
+ 
++/**
++ * p2p_get_provisioning_info - Get any stored provisioning info
++ * @p2p: P2P module context from p2p_init()
++ * @addr: Peer P2P Device Address
++ * Returns: WPS provisioning information (WPS config method) or 0 if no
++ * information is available
++ *
++ * This function is used to retrieve stored WPS provisioning info for the given
++ * peer.
++ */
++u16 p2p_get_provisioning_info(struct p2p_data *p2p, const u8 *addr);
++
++/**
++ * p2p_clear_provisioning_info - Clear any stored provisioning info
++ * @p2p: P2P module context from p2p_init()
++ * @iface_addr: Peer P2P Interface Address
++ *
++ * This function is used to clear stored WPS provisioning info for the given
++ * peer.
++ */
++void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr);
++
+ 
+ /* Event notifications from lower layer driver operations */
+ 
+--- a/src/p2p/p2p_i.h
++++ b/src/p2p/p2p_i.h
+@@ -71,6 +71,14 @@ struct p2p_device {
+ 	 */
+ 	u16 req_config_methods;
+ 
++	/**
++	 * wps_prov_info - Stored provisioning WPS config method
++	 *
++	 * This is used to store pending WPS config method between Provisioning
++	 * Discovery and connection to a running group.
++	 */
++	u16 wps_prov_info;
++
+ #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
+ #define P2P_DEV_REPORTED BIT(1)
+ #define P2P_DEV_NOT_YET_READY BIT(2)
+--- a/src/p2p/p2p_pd.c
++++ b/src/p2p/p2p_pd.c
+@@ -267,6 +267,10 @@ void p2p_process_prov_disc_resp(struct p
+ 			MAC2STR(sa));
+ 		dev->flags |= P2P_DEV_PD_PEER_KEYPAD;
+ 	}
++
++	/* Store the provisioning info */
++	dev->wps_prov_info = msg.wps_config_methods;
++
+ 	p2p_parse_free(&msg);
+ 
+ out:
+@@ -356,6 +360,9 @@ int p2p_prov_disc_req(struct p2p_data *p
+ 	if (config_methods == 0)
+ 		return -1;
+ 
++	/* Reset provisioning info */
++	dev->wps_prov_info = 0;
++
+ 	dev->req_config_methods = config_methods;
+ 	if (join)
+ 		dev->flags |= P2P_DEV_PD_FOR_JOIN;
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -2398,6 +2398,14 @@ void wpas_p2p_deinit(struct wpa_supplica
+ {
+ 	if (wpa_s->driver && wpa_s->drv_priv)
+ 		wpa_drv_probe_req_report(wpa_s, 0);
++
++	if (wpa_s->go_params) {
++		/* Clear any stored provisioning info */
++		p2p_clear_provisioning_info(
++			wpa_s->global->p2p,
++			wpa_s->go_params->peer_interface_addr);
++	}
++
+ 	os_free(wpa_s->go_params);
+ 	wpa_s->go_params = NULL;
+ 	eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s, NULL);
+@@ -2623,6 +2631,21 @@ static void wpas_p2p_scan_res_join(struc
+ 			break;
+ 		}
+ 
++		if ((p2p_get_provisioning_info(wpa_s->global->p2p,
++					       wpa_s->pending_join_dev_addr) ==
++		     method)) {
++			/*
++			 * We have already performed provision discovery for
++			 * joining the group. Proceed directly to join
++			 * operation without duplicated provision discovery. */
++			wpa_printf(MSG_DEBUG, "P2P: Provisioning discovery "
++				   "with " MACSTR " already done - proceed to "
++				   "join",
++				   MAC2STR(wpa_s->pending_join_dev_addr));
++			wpa_s->pending_pd_before_join = 0;
++			goto start;
++		}
++
+ 		if (p2p_prov_disc_req(wpa_s->global->p2p,
+ 				      wpa_s->pending_join_dev_addr, method, 1,
+ 				      freq) < 0) {
+@@ -3411,6 +3434,9 @@ void wpas_p2p_wps_success(struct wpa_sup
+ 		return;
+ 	}
+ 
++	/* Clear any stored provisioning info */
++	p2p_clear_provisioning_info(wpa_s->global->p2p, peer_addr);
++
+ 	eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent,
+ 			     NULL);
+ 	if (wpa_s->global->p2p)
+@@ -3429,6 +3455,13 @@ void wpas_p2p_wps_failed(struct wpa_supp
+ 			   "provisioning not in progress");
+ 		return;
+ 	}
++
++	if (wpa_s->go_params) {
++		p2p_clear_provisioning_info(
++			wpa_s->global->p2p,
++			wpa_s->go_params->peer_interface_addr);
++	}
++
+ 	wpas_notify_p2p_wps_failed(wpa_s, fail);
+ }
+ 

Added: wpa/trunk/debian/patches/upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch (added)
+++ wpa/trunk/debian/patches/upstream/0050-P2P-Fix-provisioning-info-clearing-after-successful-.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,104 @@
+From b9ec7f810c93418171e370ed30b453a45b0dcde7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Thu, 1 Mar 2012 22:06:03 +0200
+Subject: [PATCH 50/58] P2P: Fix provisioning info clearing after successful
+ WPS step
+
+Previously, this provisioning info was cleared using the P2P Interface
+Address of the GO as the key. That did not always work in the case the
+where we joined an already running group. This could result in the next
+connection to that same GO skipping provision discovery. Fix this by
+finding the peer entry based on its P2P Device Address instead of the
+P2P Interface Address which may not always be set.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+intended-for: hostap-1
+(cherry picked from commit 10531d216686119fe1b6ce1e3751d5a4c2f70f43)
+---
+ src/p2p/p2p.c                   |    6 +++---
+ src/p2p/p2p.h                   |    4 ++--
+ wpa_supplicant/p2p_supplicant.c |   16 ++++++++++++----
+ 3 files changed, 17 insertions(+), 9 deletions(-)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -157,14 +157,14 @@ u16 p2p_get_provisioning_info(struct p2p
+ }
+ 
+ 
+-void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr)
++void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr)
+ {
+ 	struct p2p_device *dev = NULL;
+ 
+-	if (!iface_addr || !p2p)
++	if (!addr || !p2p)
+ 		return;
+ 
+-	dev = p2p_get_device_interface(p2p, iface_addr);
++	dev = p2p_get_device(p2p, addr);
+ 	if (dev)
+ 		dev->wps_prov_info = 0;
+ }
+--- a/src/p2p/p2p.h
++++ b/src/p2p/p2p.h
+@@ -1066,12 +1066,12 @@ u16 p2p_get_provisioning_info(struct p2p
+ /**
+  * p2p_clear_provisioning_info - Clear any stored provisioning info
+  * @p2p: P2P module context from p2p_init()
+- * @iface_addr: Peer P2P Interface Address
++ * @iface_addr: Peer P2P Device Address
+  *
+  * This function is used to clear stored WPS provisioning info for the given
+  * peer.
+  */
+-void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *iface_addr);
++void p2p_clear_provisioning_info(struct p2p_data *p2p, const u8 *addr);
+ 
+ 
+ /* Event notifications from lower layer driver operations */
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -2403,7 +2403,7 @@ void wpas_p2p_deinit(struct wpa_supplica
+ 		/* Clear any stored provisioning info */
+ 		p2p_clear_provisioning_info(
+ 			wpa_s->global->p2p,
+-			wpa_s->go_params->peer_interface_addr);
++			wpa_s->go_params->peer_device_addr);
+ 	}
+ 
+ 	os_free(wpa_s->go_params);
+@@ -3428,14 +3428,22 @@ struct p2p_group * wpas_p2p_group_init(s
+ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
+ 			  int registrar)
+ {
++	struct wpa_ssid *ssid = wpa_s->current_ssid;
++
+ 	if (!wpa_s->p2p_in_provisioning) {
+ 		wpa_printf(MSG_DEBUG, "P2P: Ignore WPS success event - P2P "
+ 			   "provisioning not in progress");
+ 		return;
+ 	}
+ 
+-	/* Clear any stored provisioning info */
+-	p2p_clear_provisioning_info(wpa_s->global->p2p, peer_addr);
++	if (ssid && ssid->mode == WPAS_MODE_INFRA) {
++		u8 go_dev_addr[ETH_ALEN];
++		os_memcpy(go_dev_addr, wpa_s->bssid, ETH_ALEN);
++		wpas_p2p_persistent_group(wpa_s, go_dev_addr, ssid->ssid,
++					  ssid->ssid_len);
++		/* Clear any stored provisioning info */
++		p2p_clear_provisioning_info(wpa_s->global->p2p, go_dev_addr);
++	}
+ 
+ 	eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent,
+ 			     NULL);
+@@ -3459,7 +3467,7 @@ void wpas_p2p_wps_failed(struct wpa_supp
+ 	if (wpa_s->go_params) {
+ 		p2p_clear_provisioning_info(
+ 			wpa_s->global->p2p,
+-			wpa_s->go_params->peer_interface_addr);
++			wpa_s->go_params->peer_device_addr);
+ 	}
+ 
+ 	wpas_notify_p2p_wps_failed(wpa_s, fail);

Added: wpa/trunk/debian/patches/upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch (added)
+++ wpa/trunk/debian/patches/upstream/0051-P2P-Fix-remain-on-channel-use-with-PD-Invitation-Req.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,83 @@
+From 5aa5c1b8c9a96a3c01768740d31b54d0634e4392 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Mon, 27 Feb 2012 17:23:41 +0200
+Subject: [PATCH 51/58] P2P: Fix remain-on-channel use with PD/Invitation
+ Request while in Listen
+
+If Listen state was in progress on another channel when a request to
+send an Action frame (e.g., Provision Discovery Request or Invitation
+Request to a peer on the peer's Listen channel that is different from
+our Listenc hannel) is issued, wpa_supplicant tried to use concurrent
+remain-on-channel operations. While some drivers can handle this
+cleanly, there are drivers that don't and wpa_supplicant is not expected
+to request concurrent remain-on-channel operations.
+
+Fix this by cancelling the ongoing remain-on-channel with stop_listen
+prior to sending the Action frame on another channel. If a P2P search
+was in progress, it will be continued after the timeout on the new
+operation.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 1a9c618d3f465b974a724dc2cb3e4030837e2982)
+---
+ src/p2p/p2p.c            |   10 ++++++++++
+ src/p2p/p2p_i.h          |    1 +
+ src/p2p/p2p_invitation.c |    2 ++
+ src/p2p/p2p_pd.c         |    2 ++
+ 4 files changed, 15 insertions(+)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -1030,11 +1030,21 @@ void p2p_stop_find_for_freq(struct p2p_d
+ 	p2p->go_neg_peer = NULL;
+ 	p2p->sd_peer = NULL;
+ 	p2p->invite_peer = NULL;
++	p2p_stop_listen_for_freq(p2p, freq);
++}
++
++
++void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq)
++{
+ 	if (freq > 0 && p2p->drv_in_listen == freq && p2p->in_listen) {
+ 		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Skip stop_listen "
+ 			"since we are on correct channel for response");
+ 		return;
+ 	}
++	if (p2p->in_listen) {
++		p2p->in_listen = 0;
++		p2p_clear_timeout(p2p);
++	}
+ 	if (p2p->drv_in_listen) {
+ 		/*
+ 		 * The driver may not deliver callback to p2p_listen_end()
+--- a/src/p2p/p2p_i.h
++++ b/src/p2p/p2p_i.h
+@@ -673,5 +673,6 @@ void p2p_build_ssid(struct p2p_data *p2p
+ int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
+ 		    const u8 *src, const u8 *bssid, const u8 *buf,
+ 		    size_t len, unsigned int wait_time);
++void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
+ 
+ #endif /* P2P_I_H */
+--- a/src/p2p/p2p_invitation.c
++++ b/src/p2p/p2p_invitation.c
+@@ -350,6 +350,8 @@ int p2p_invite_send(struct p2p_data *p2p
+ 	req = p2p_build_invitation_req(p2p, dev, go_dev_addr);
+ 	if (req == NULL)
+ 		return -1;
++	if (p2p->state != P2P_IDLE)
++		p2p_stop_listen_for_freq(p2p, freq);
+ 	wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
+ 		"P2P: Sending Invitation Request");
+ 	p2p_set_state(p2p, P2P_INVITE);
+--- a/src/p2p/p2p_pd.c
++++ b/src/p2p/p2p_pd.c
+@@ -322,6 +322,8 @@ int p2p_send_prov_disc_req(struct p2p_da
+ 	if (req == NULL)
+ 		return -1;
+ 
++	if (p2p->state != P2P_IDLE)
++		p2p_stop_listen_for_freq(p2p, freq);
+ 	p2p->pending_action_state = P2P_PENDING_PD;
+ 	if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
+ 			    p2p->cfg->dev_addr, dev->info.p2p_device_addr,

Added: wpa/trunk/debian/patches/upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch (added)
+++ wpa/trunk/debian/patches/upstream/0052-P2P-Make-p2p_flush-stop-P2P-operations-consistently.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,31 @@
+From 73bde309e0ad18a6af04757536721d5b9323f353 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Mon, 27 Feb 2012 19:10:04 +0200
+Subject: [PATCH 52/58] P2P: Make p2p_flush stop P2P operations consistently
+
+p2p_flush did not explicit stop all P2P operations, i.e., the exact
+behavior depended on the P2P module state at the time the p2p_flush
+command was issued. Make this more consistent by explicitly calling
+p2p_stop_find() from p2p_flush().
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 78db55b800f0fe48ad5afcb4c7e0c58636a56e39)
+---
+ src/p2p/p2p.c |    6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- a/src/p2p/p2p.c
++++ b/src/p2p/p2p.c
+@@ -2251,11 +2251,7 @@ void p2p_deinit(struct p2p_data *p2p)
+ void p2p_flush(struct p2p_data *p2p)
+ {
+ 	struct p2p_device *dev, *prev;
+-	p2p_clear_timeout(p2p);
+-	p2p_set_state(p2p, P2P_IDLE);
+-	p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING;
+-	p2p->go_neg_peer = NULL;
+-	eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
++	p2p_stop_find(p2p);
+ 	dl_list_for_each_safe(dev, prev, &p2p->devices, struct p2p_device,
+ 			      list) {
+ 		dl_list_del(&dev->list);

Added: wpa/trunk/debian/patches/upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch (added)
+++ wpa/trunk/debian/patches/upstream/0053-P2P-Fix-p2p_cancel-to-return-success-if-GO-Negotiati.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,25 @@
+From 50ad8895b6bb3b3437105c4cc433d3a2aa3e2547 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Thu, 1 Mar 2012 01:16:06 +0200
+Subject: [PATCH 53/58] P2P: Fix p2p_cancel to return success if GO
+ Negotiation is stopped
+
+If a GO Negotiation peer is found, wpas_p2p_stop_find() stops the
+negotiation and p2p_cancel can return success.
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+(cherry picked from commit 75c208b9db7ec027ea923ff8af2b408da110bcc2)
+---
+ wpa_supplicant/p2p_supplicant.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/wpa_supplicant/p2p_supplicant.c
++++ b/wpa_supplicant/p2p_supplicant.c
+@@ -4288,6 +4288,7 @@ int wpas_p2p_cancel(struct wpa_supplican
+ 		wpa_printf(MSG_DEBUG, "P2P: Unauthorize pending GO Neg peer "
+ 			   MACSTR, MAC2STR(peer));
+ 		p2p_unauthorize(global->p2p, peer);
++		found = 1;
+ 	}
+ 
+ 	wpas_p2p_stop_find(wpa_s);

Added: wpa/trunk/debian/patches/upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch (added)
+++ wpa/trunk/debian/patches/upstream/0054-Fix-memory-leak-on-parsing-multiple-network-block-ea.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,23 @@
+From 4f9fca87ac436b8047b8871d2cc88778ffc7a3dc Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j at w1.fi>
+Date: Sun, 4 Mar 2012 16:13:00 +0200
+Subject: [PATCH 54/58] Fix memory leak on parsing multiple network block eap
+ entries
+
+Signed-hostap: Jouni Malinen <j at w1.fi>
+intended-for: hostap-1
+(cherry picked from commit bb8b1bb0fcdf61511fb777cbe30a6b71d16ce4ce)
+---
+ wpa_supplicant/config.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -1116,6 +1116,7 @@ static int wpa_config_parse_eap(const st
+ 
+ 	wpa_hexdump(MSG_MSGDUMP, "eap methods",
+ 		    (u8 *) methods, num_methods * sizeof(*methods));
++	os_free(ssid->eap.eap_methods);
+ 	ssid->eap.eap_methods = methods;
+ 	return errors ? -1 : 0;
+ }

Added: wpa/trunk/debian/patches/upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch (added)
+++ wpa/trunk/debian/patches/upstream/0055-P2P-Filter-input-parameters-in-p2p_serv_disc_externa.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,24 @@
+From 23a9b2c61e592498c9a90ddf5601fd77b25ba3c6 Mon Sep 17 00:00:00 2001
+From: Grzegorz Bajorski <grzegorz.bajorski at tieto.com>
+Date: Mon, 5 Mar 2012 16:26:19 +0200
+Subject: [PATCH 55/58] P2P: Filter input parameters in p2p_serv_disc_external
+
+p2p_ctrl_serv_disc_external() can take only one parameters "0" or "1".
+
+Signed-hostap: Grzegorz Bajorski <grzegorz.bajorski at tieto.com>
+(cherry picked from commit 28ef705d2df8002ef1c69a0089cd493f41c2157f)
+---
+ wpa_supplicant/ctrl_iface.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/wpa_supplicant/ctrl_iface.c
++++ b/wpa_supplicant/ctrl_iface.c
+@@ -2633,6 +2633,8 @@ static int p2p_ctrl_serv_disc_resp(struc
+ static int p2p_ctrl_serv_disc_external(struct wpa_supplicant *wpa_s,
+ 				       char *cmd)
+ {
++	if (os_strcmp(cmd, "0") && os_strcmp(cmd, "1"))
++		return -1;
+ 	wpa_s->p2p_sd_over_ctrl_iface = atoi(cmd);
+ 	return 0;
+ }

Added: wpa/trunk/debian/patches/upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch (added)
+++ wpa/trunk/debian/patches/upstream/0056-TTLS-Fix-peer-challenge-generation-for-TTLS-MSCHAPv2.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,55 @@
+From 201f339dd8f7920653ac647bdab1de6c04783542 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni at qca.qualcomm.com>
+Date: Mon, 5 Mar 2012 16:59:03 +0200
+Subject: [PATCH 56/58] TTLS: Fix peer challenge generation for TTLS/MSCHAPv2
+
+Commit 30680e9332c96803533b9dae6105fd7b15b5bb52 changed the length
+of the implicit challenge result to match with the exact length used
+in TTLS. However, it failed to update the peer_challenge generation
+to use a separate random value. Previously, this was generated as
+part of the implicit challenge, but more correct way would have been
+to generate a random value for it separately. Do this now to fix the
+read after the allocated buffer (16 bytes after the implicit
+challenge).
+
+Signed-hostap: Jouni Malinen <jouni at qca.qualcomm.com>
+intended-for: hostap-1
+(cherry picked from commit e19467e1618854c0ebf4bb847fb38ad9cebbe083)
+---
+ src/eap_peer/eap_ttls.c |   11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/src/eap_peer/eap_ttls.c
++++ b/src/eap_peer/eap_ttls.c
+@@ -441,7 +441,6 @@ static int eap_ttls_phase2_request_mscha
+ 			   "implicit challenge");
+ 		return -1;
+ 	}
+-	peer_challenge = challenge + 1 + EAP_TTLS_MSCHAPV2_CHALLENGE_LEN;
+ 
+ 	pos = eap_ttls_avp_add(buf, pos, RADIUS_ATTR_MS_CHAP_CHALLENGE,
+ 			       RADIUS_VENDOR_ID_MICROSOFT, 1,
+@@ -454,7 +453,14 @@ static int eap_ttls_phase2_request_mscha
+ 	data->ident = challenge[EAP_TTLS_MSCHAPV2_CHALLENGE_LEN];
+ 	*pos++ = data->ident;
+ 	*pos++ = 0; /* Flags */
+-	os_memcpy(pos, peer_challenge, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN);
++	if (os_get_random(pos, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN) < 0) {
++		os_free(challenge);
++		wpabuf_free(msg);
++		wpa_printf(MSG_ERROR, "EAP-TTLS/MSCHAPV2: Failed to get "
++			   "random data for peer challenge");
++		return -1;
++	}
++	peer_challenge = pos;
+ 	pos += EAP_TTLS_MSCHAPV2_CHALLENGE_LEN;
+ 	os_memset(pos, 0, 8); /* Reserved, must be zero */
+ 	pos += 8;
+@@ -462,6 +468,7 @@ static int eap_ttls_phase2_request_mscha
+ 				     password_len, pwhash, challenge,
+ 				     peer_challenge, pos, data->auth_response,
+ 				     data->master_key)) {
++		os_free(challenge);
+ 		wpabuf_free(msg);
+ 		wpa_printf(MSG_ERROR, "EAP-TTLS/MSCHAPV2: Failed to derive "
+ 			   "response");

Added: wpa/trunk/debian/patches/upstream/0057-BSS-Fix-use-after-realloc.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0057-BSS-Fix-use-after-realloc.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0057-BSS-Fix-use-after-realloc.patch (added)
+++ wpa/trunk/debian/patches/upstream/0057-BSS-Fix-use-after-realloc.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,28 @@
+From ffda7cfaf1f7acdc38bed15a877c62b47f9e515c Mon Sep 17 00:00:00 2001
+From: Eliad Peller <eliad at wizery.com>
+Date: Mon, 5 Mar 2012 17:09:55 +0200
+Subject: [PATCH 57/58] BSS: Fix use-after-realloc
+
+After reallocation of the bss struct, current_bss wasn't updated and
+could hold an invalid pointer (which might get dereferenced later).
+
+Update current_bss if the pointer was changed.
+
+Signed-hostap: Eliad Peller <eliad at wizery.com>
+intended-for: hostap-1
+(cherry picked from commit eb37e085a4c17a7ebdf258d480c5f2c8a2ac7f08)
+---
+ wpa_supplicant/bss.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/wpa_supplicant/bss.c
++++ b/wpa_supplicant/bss.c
+@@ -332,6 +332,8 @@ static void wpa_bss_update(struct wpa_su
+ 		nbss = os_realloc(bss, sizeof(*bss) + res->ie_len +
+ 				  res->beacon_ie_len);
+ 		if (nbss) {
++			if (wpa_s->current_bss == bss)
++				wpa_s->current_bss = nbss;
+ 			bss = nbss;
+ 			os_memcpy(bss + 1, res + 1,
+ 				  res->ie_len + res->beacon_ie_len);

Added: wpa/trunk/debian/patches/upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/patches/upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch?rev=1678&op=file
==============================================================================
--- wpa/trunk/debian/patches/upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch (added)
+++ wpa/trunk/debian/patches/upstream/0058-dbus-Make-P2P-group-properties-accessible-individual.patch Sat Apr  7 23:08:15 2012
@@ -1,0 +1,362 @@
+From 03de63ceb81eed9db7506c1d124658f7f10a85d9 Mon Sep 17 00:00:00 2001
+From: Todd Previte <toddx.a.previte at intel.com>
+Date: Mon, 5 Mar 2012 17:25:08 +0200
+Subject: [PATCH 58/58] dbus: Make P2P group properties accessible
+ individually
+
+Group properties are now accessible individually. The function to retrieve
+the dictionary containing the group properties is removed in favor of the
+individual functions. The group member properties are removed as well as
+they erroneously retrieved the group properties via the old function.
+
+Signed-hostap: Todd Previte <toddx.a.previte at intel.com>
+Signed-hostap: Angie Chinchilla <angie.v.chinchilla at intel.com>
+intended-for: hostap-1
+(cherry picked from commit 7d39d9c9cced1ecee8ba512c0cd6ebe589436cda)
+---
+ wpa_supplicant/dbus/dbus_new.c              |   39 ++++-
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.c |  214 ++++++++++++++++-----------
+ wpa_supplicant/dbus/dbus_new_handlers_p2p.h |   24 ++-
+ 3 files changed, 178 insertions(+), 99 deletions(-)
+
+--- a/wpa_supplicant/dbus/dbus_new.c
++++ b/wpa_supplicant/dbus/dbus_new.c
+@@ -3127,10 +3127,37 @@ static const struct wpa_dbus_property_de
+ 	  wpas_dbus_getter_p2p_group_members,
+ 	  NULL
+ 	},
+-	{ "Properties",
+-	  WPAS_DBUS_NEW_IFACE_P2P_GROUP, "a{sv}",
+-	  wpas_dbus_getter_p2p_group_properties,
+-	  wpas_dbus_setter_p2p_group_properties
++	{ "Group", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "o",
++	  wpas_dbus_getter_p2p_group,
++	  NULL
++	},
++	{ "Role", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
++	  wpas_dbus_getter_p2p_role,
++	  NULL
++	},
++	{ "SSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
++	  wpas_dbus_getter_p2p_group_ssid,
++	  NULL
++	},
++	{ "BSSID", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
++	  wpas_dbus_getter_p2p_group_bssid,
++	  NULL
++	},
++	{ "Frequency", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "q",
++	  wpas_dbus_getter_p2p_group_frequency,
++	  NULL
++	},
++	{ "Passphrase", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "s",
++	  wpas_dbus_getter_p2p_group_passphrase,
++	  NULL
++	},
++	{ "PSK", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "ay",
++	  wpas_dbus_getter_p2p_group_psk,
++	  NULL
++	},
++	{ "WPSVendorExtensions", WPAS_DBUS_NEW_IFACE_P2P_GROUP, "aay",
++	  wpas_dbus_getter_p2p_group_vendor_ext,
++	  wpas_dbus_setter_p2p_group_vendor_ext
+ 	},
+ 	{ NULL, NULL, NULL, NULL, NULL }
+ };
+@@ -3252,10 +3279,6 @@ void wpas_dbus_unregister_p2p_group(stru
+ 
+ static const struct wpa_dbus_property_desc
+ wpas_dbus_p2p_groupmember_properties[] = {
+-	{ "Properties", WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER, "a{sv}",
+-	  wpas_dbus_getter_p2p_group_properties,
+-	  NULL
+-	},
+ 	{ NULL, NULL, NULL, NULL, NULL }
+ };
+ 
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+@@ -1798,9 +1798,11 @@ dbus_bool_t wpas_dbus_getter_p2p_group_m
+ 	const u8 *addr;
+ 	dbus_bool_t success = FALSE;
+ 
+-	/* Ensure we are a GO */
+-	if (wpa_s->wpa_state != WPA_COMPLETED)
+-		return FALSE;
++	/* Verify correct role for this property */
++	if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_GO) {
++		return wpas_dbus_simple_array_property_getter(
++			iter, DBUS_TYPE_OBJECT_PATH, NULL, 0, error);
++	}
+ 
+ 	ssid = wpa_s->conf->ssid;
+ 	/* At present WPAS P2P_GO mode only applicable for p2p_go */
+@@ -1848,111 +1850,145 @@ out_of_memory:
+ }
+ 
+ 
+-dbus_bool_t wpas_dbus_getter_p2p_group_properties(DBusMessageIter *iter,
++dbus_bool_t wpas_dbus_getter_p2p_group_ssid(DBusMessageIter *iter,
++					    DBusError *error, void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	if (wpa_s->current_ssid == NULL)
++		return FALSE;
++	return wpas_dbus_simple_array_property_getter(
++		iter, DBUS_TYPE_BYTE, wpa_s->current_ssid->ssid,
++		wpa_s->current_ssid->ssid_len, error);
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_group_bssid(DBusMessageIter *iter,
++					     DBusError *error,
++					     void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	u8 role = wpas_get_p2p_role(wpa_s);
++	u8 *p_bssid;
++
++	if (role == WPAS_P2P_ROLE_CLIENT) {
++		if (wpa_s->current_ssid == NULL)
++			return FALSE;
++		p_bssid = wpa_s->current_ssid->bssid;
++	} else {
++		if (wpa_s->ap_iface == NULL)
++			return FALSE;
++		p_bssid = wpa_s->ap_iface->bss[0]->own_addr;
++	}
++
++	return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
++						      p_bssid, ETH_ALEN,
++						      error);
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_group_frequency(DBusMessageIter *iter,
++						 DBusError *error,
++						 void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	u16 op_freq;
++	u8 role = wpas_get_p2p_role(wpa_s);
++
++	if (role == WPAS_P2P_ROLE_CLIENT) {
++		if (wpa_s->go_params == NULL)
++			return FALSE;
++		op_freq = wpa_s->go_params->freq;
++	} else {
++		if (wpa_s->ap_iface == NULL)
++			return FALSE;
++		op_freq = wpa_s->ap_iface->freq;
++	}
++
++	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
++						&op_freq, error);
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
+ 						  DBusError *error,
+ 						  void *user_data)
+ {
+ 	struct wpa_supplicant *wpa_s = user_data;
+-	DBusMessageIter variant_iter, dict_iter;
+-	struct hostapd_data *hapd = NULL;
+-	const struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
+-	int num_vendor_ext = 0;
+-	int i;
+ 	u8 role = wpas_get_p2p_role(wpa_s);
+-	u16 op_freq = 0;
+-	u8 *p_bssid = NULL;
+-	char *role_name = NULL;
++	char *p_pass = NULL;
+ 
+-	if (!wpa_s->current_ssid)
+-		return FALSE;
++	/* Verify correct role for this property */
++	if (role == WPAS_P2P_ROLE_GO) {
++		if (wpa_s->current_ssid == NULL)
++			return FALSE;
++		p_pass = wpa_s->current_ssid->passphrase;
++	} else
++		p_pass = "";
+ 
+-	/* Check current role and adjust information accordingly */
+-	switch (role) {
+-	case WPAS_P2P_ROLE_CLIENT:
+-		/* go_params is only valid for a client */
+-		if (wpa_s->go_params) {
+-			op_freq = wpa_s->go_params->freq;
+-			p_bssid = wpa_s->current_ssid->bssid;
+-			role_name = "client";
+-		} else
+-			return FALSE;
+-		break;
+-	case WPAS_P2P_ROLE_GO:
+-		/* ap_iface is only valid for a GO */
+-		if (wpa_s->ap_iface) {
+-			hapd = wpa_s->ap_iface->bss[0];
+-			p_bssid = hapd->own_addr;
+-			op_freq = wpa_s->ap_iface->freq;
+-			role_name = "GO";
+-		} else
+-			return FALSE;
+-		break;
+-	default:
+-		/* Error condition; this should NEVER occur */
+-		return FALSE;
++	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
++						&p_pass, error);
++
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
++					   DBusError *error, void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	u8 role = wpas_get_p2p_role(wpa_s);
++	u8 *p_psk = NULL;
++	u8 psk_len = 0;
++
++	/* Verify correct role for this property */
++	if (role == WPAS_P2P_ROLE_CLIENT) {
++		if (wpa_s->current_ssid == NULL)
++			return FALSE;
++		p_psk = wpa_s->current_ssid->psk;
++		psk_len = 32;
+ 	}
+ 
+-	if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+-					      "a{sv}", &variant_iter) ||
+-	    !wpa_dbus_dict_open_write(&variant_iter, &dict_iter))
+-		goto err_no_mem;
+-	/* Provide the SSID */
+-	if (!wpa_dbus_dict_append_byte_array(
+-		    &dict_iter, "SSID",
+-		    (const char *) wpa_s->current_ssid->ssid,
+-		    wpa_s->current_ssid->ssid_len))
+-		goto err_no_mem;
+-	/* Provide the BSSID */
+-	if (p_bssid &&
+-	    !wpa_dbus_dict_append_byte_array(&dict_iter, "BSSID",
+-					     (const char *) p_bssid, ETH_ALEN))
+-		goto err_no_mem;
+-	/* Provide the role within the group */
+-	if (role_name &&
+-	    !wpa_dbus_dict_append_string(&dict_iter, "Role", role_name))
+-		goto err_no_mem;
+-	/* Provide the operational frequency */
+-	if (!wpa_dbus_dict_append_uint16(&dict_iter, "Frequency", op_freq))
+-		goto err_no_mem;
++	return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
++						      &p_psk, psk_len, error);
++}
++
++
++dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(DBusMessageIter *iter,
++						  DBusError *error,
++						  void *user_data)
++{
++	struct wpa_supplicant *wpa_s = user_data;
++	struct hostapd_data *hapd;
++	struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
++	int num_vendor_ext = 0;
++	int i;
++
++	/* Verify correct role for this property */
++	if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO) {
++		if (wpa_s->ap_iface == NULL)
++			return FALSE;
++		hapd = wpa_s->ap_iface->bss[0];
+ 
+-	/* Additional information for group owners */
+-	if (role == WPAS_P2P_ROLE_GO) {
+-		/* Provide the passphrase */
+-		if (!wpa_dbus_dict_append_string(&dict_iter, "Passphrase",
+-					wpa_s->current_ssid->passphrase))
+-			goto err_no_mem;
+ 		/* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
+-		for (i = 0; hapd && i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
++		for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
+ 			if (hapd->conf->wps_vendor_ext[i] == NULL)
+-				continue;
+-			vendor_ext[num_vendor_ext++] =
+-				hapd->conf->wps_vendor_ext[i];
++				vendor_ext[i] = NULL;
++			else {
++				vendor_ext[num_vendor_ext++] =
++					hapd->conf->wps_vendor_ext[i];
++			}
+ 		}
+-		if (!wpa_dbus_dict_append_wpabuf_array(&dict_iter,
+-					"WPSVendorExtensions",
+-					vendor_ext, num_vendor_ext))
+-			goto err_no_mem;
+-	} else {
+-		/* If not a GO, provide the PSK */
+-		if (!wpa_dbus_dict_append_byte_array(
+-			    &dict_iter, "PSK",
+-			    (const char *) wpa_s->current_ssid->psk, 32))
+-			goto err_no_mem;
+ 	}
+ 
+-	if (!wpa_dbus_dict_close_write(&variant_iter, &dict_iter) ||
+-	    !dbus_message_iter_close_container(iter, &variant_iter))
+-		goto err_no_mem;
+-
+-	return TRUE;
+-
+-err_no_mem:
+-	dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
+-	return FALSE;
++	/* Return vendor extensions or no data */
++	return wpas_dbus_simple_array_array_property_getter(iter,
++							    DBUS_TYPE_BYTE,
++							    vendor_ext,
++							    num_vendor_ext,
++						 error);
+ }
+ 
+ 
+-dbus_bool_t wpas_dbus_setter_p2p_group_properties(DBusMessageIter *iter,
++dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(DBusMessageIter *iter,
+ 						  DBusError *error,
+ 						  void *user_data)
+ {
+--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
++++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+@@ -161,11 +161,31 @@ dbus_bool_t wpas_dbus_getter_p2p_group_m
+ 					       DBusError *error,
+ 					       void *user_data);
+ 
+-dbus_bool_t wpas_dbus_getter_p2p_group_properties(DBusMessageIter *iter,
++dbus_bool_t wpas_dbus_getter_p2p_group_ssid(DBusMessageIter *iter,
++					    DBusError *error,
++					    void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_group_bssid(DBusMessageIter *iter,
++					     DBusError *error,
++					     void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_group_frequency(DBusMessageIter *iter,
++						 DBusError *error,
++						 void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
++						  DBusError *error,
++						  void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
++					   DBusError *error,
++					   void *user_data);
++
++dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(DBusMessageIter *iter,
+ 						  DBusError *error,
+ 						  void *user_data);
+ 
+-dbus_bool_t wpas_dbus_setter_p2p_group_properties(DBusMessageIter *iter,
++dbus_bool_t wpas_dbus_setter_p2p_group_vendor_ext(DBusMessageIter *iter,
+ 						  DBusError *error,
+ 						  void *user_data);
+ 




More information about the Pkg-wpa-devel mailing list