[pkg-wpa-devel] r1087 - in /wpasupplicant/trunk: debian/ src/common/ src/crypto/ src/drivers/ src/eap_common/ src/eap_peer/ src/eap_server/ src/eapol_supp/ src/radius/ src/rsn_supp/ src/utils/ src/wps/ wpa_supplicant/ wpa_supplicant/doc/ wpa_supplicant/doc/docbook/ wpa_supplicant/wpa_gui-qt4/ wpa_supplicant/wpa_gui/

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Fri Feb 1 14:38:48 UTC 2008


Author: kelmo-guest
Date: Fri Feb  1 14:38:48 2008
New Revision: 1087

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1087
Log:
* New Upstream git snapshot.

Added:
    wpasupplicant/trunk/src/eap_peer/eap_config.h
      - copied unchanged from r1084, wpasupplicant/branches/upstream/current/src/eap_peer/eap_config.h
    wpasupplicant/trunk/src/eap_peer/mschapv2.c
      - copied unchanged from r1084, wpasupplicant/branches/upstream/current/src/eap_peer/mschapv2.c
    wpasupplicant/trunk/src/eap_peer/mschapv2.h
      - copied unchanged from r1084, wpasupplicant/branches/upstream/current/src/eap_peer/mschapv2.h
    wpasupplicant/trunk/src/utils/uuid.c
      - copied unchanged from r1084, wpasupplicant/branches/upstream/current/src/utils/uuid.c
    wpasupplicant/trunk/src/utils/uuid.h
      - copied unchanged from r1084, wpasupplicant/branches/upstream/current/src/utils/uuid.h
Removed:
    wpasupplicant/trunk/src/eap_common/eap_wsc_common.c
    wpasupplicant/trunk/src/eap_common/eap_wsc_common.h
    wpasupplicant/trunk/src/eap_peer/eap_wsc.c
    wpasupplicant/trunk/src/eap_server/eap_wsc.c
    wpasupplicant/trunk/src/wps/
    wpasupplicant/trunk/wpa_supplicant/config_blob.h
Modified:
    wpasupplicant/trunk/debian/changelog
    wpasupplicant/trunk/src/common/defs.h
    wpasupplicant/trunk/src/common/wpa_common.c
    wpasupplicant/trunk/src/common/wpa_common.h
    wpasupplicant/trunk/src/common/wpa_ctrl.h
    wpasupplicant/trunk/src/crypto/crypto_openssl.c
    wpasupplicant/trunk/src/drivers/driver.h
    wpasupplicant/trunk/src/drivers/driver_test.c
    wpasupplicant/trunk/src/drivers/driver_wext.c
    wpasupplicant/trunk/src/eap_common/ikev2_common.c
    wpasupplicant/trunk/src/eap_peer/eap.c
    wpasupplicant/trunk/src/eap_peer/eap.h
    wpasupplicant/trunk/src/eap_peer/eap_aka.c
    wpasupplicant/trunk/src/eap_peer/eap_fast.c
    wpasupplicant/trunk/src/eap_peer/eap_fast_pac.c
    wpasupplicant/trunk/src/eap_peer/eap_gpsk.c
    wpasupplicant/trunk/src/eap_peer/eap_i.h
    wpasupplicant/trunk/src/eap_peer/eap_ikev2.c
    wpasupplicant/trunk/src/eap_peer/eap_methods.c
    wpasupplicant/trunk/src/eap_peer/eap_mschapv2.c
    wpasupplicant/trunk/src/eap_peer/eap_pax.c
    wpasupplicant/trunk/src/eap_peer/eap_peap.c
    wpasupplicant/trunk/src/eap_peer/eap_psk.c
    wpasupplicant/trunk/src/eap_peer/eap_sake.c
    wpasupplicant/trunk/src/eap_peer/eap_sim.c
    wpasupplicant/trunk/src/eap_peer/eap_tls.c
    wpasupplicant/trunk/src/eap_peer/eap_tls_common.c
    wpasupplicant/trunk/src/eap_peer/eap_tls_common.h
    wpasupplicant/trunk/src/eap_peer/eap_ttls.c
    wpasupplicant/trunk/src/eap_peer/ikev2.c
    wpasupplicant/trunk/src/eap_server/eap.c
    wpasupplicant/trunk/src/eap_server/eap.h
    wpasupplicant/trunk/src/eap_server/eap_i.h
    wpasupplicant/trunk/src/eap_server/eap_ikev2.c
    wpasupplicant/trunk/src/eap_server/ikev2.c
    wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.c
    wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.h
    wpasupplicant/trunk/src/radius/radius.c
    wpasupplicant/trunk/src/radius/radius.h
    wpasupplicant/trunk/src/radius/radius_client.c
    wpasupplicant/trunk/src/radius/radius_server.c
    wpasupplicant/trunk/src/radius/radius_server.h
    wpasupplicant/trunk/src/rsn_supp/peerkey.c
    wpasupplicant/trunk/src/rsn_supp/pmksa_cache.c
    wpasupplicant/trunk/src/rsn_supp/preauth.c
    wpasupplicant/trunk/src/rsn_supp/preauth.h
    wpasupplicant/trunk/src/rsn_supp/wpa.c
    wpasupplicant/trunk/src/rsn_supp/wpa.h
    wpasupplicant/trunk/src/rsn_supp/wpa_ft.c
    wpasupplicant/trunk/src/rsn_supp/wpa_i.h
    wpasupplicant/trunk/src/rsn_supp/wpa_ie.c
    wpasupplicant/trunk/wpa_supplicant/ChangeLog
    wpasupplicant/trunk/wpa_supplicant/Makefile
    wpasupplicant/trunk/wpa_supplicant/README
    wpasupplicant/trunk/wpa_supplicant/README-Windows.txt
    wpasupplicant/trunk/wpa_supplicant/config.c
    wpasupplicant/trunk/wpa_supplicant/config.h
    wpasupplicant/trunk/wpa_supplicant/config_file.c
    wpasupplicant/trunk/wpa_supplicant/config_ssid.h
    wpasupplicant/trunk/wpa_supplicant/config_winreg.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c
    wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h
    wpasupplicant/trunk/wpa_supplicant/defconfig
    wpasupplicant/trunk/wpa_supplicant/doc/ctrl_iface.doxygen
    wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
    wpasupplicant/trunk/wpa_supplicant/eap_testing.txt
    wpasupplicant/trunk/wpa_supplicant/eapol_test.c
    wpasupplicant/trunk/wpa_supplicant/events.c
    wpasupplicant/trunk/wpa_supplicant/main.c
    wpasupplicant/trunk/wpa_supplicant/mlme.c
    wpasupplicant/trunk/wpa_supplicant/mlme.h
    wpasupplicant/trunk/wpa_supplicant/preauth_test.c
    wpasupplicant/trunk/wpa_supplicant/scan.c
    wpasupplicant/trunk/wpa_supplicant/todo.txt
    wpasupplicant/trunk/wpa_supplicant/wpa_cli.c
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui
    wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h
    wpasupplicant/trunk/wpa_supplicant/wpa_gui/wpagui.ui.h
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.conf
    wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h
    wpasupplicant/trunk/wpa_supplicant/wpas_glue.c
    wpasupplicant/trunk/wpa_supplicant/wpas_glue.h

Modified: wpasupplicant/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/changelog?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Fri Feb  1 14:38:48 2008
@@ -1,3 +1,9 @@
+wpasupplicant (0.6.2+git20080201.gde6ccd7-1) UNRELEASED; urgency=low
+
+  * New Upstream git snapshot.
+
+ -- Kel Modderman <kel at otaku42.de>  Sat, 02 Feb 2008 00:37:47 +1000
+
 wpasupplicant (0.6.2-2) UNRELEASED; urgency=low
 
   * Make sure wpa_supplicant process is checked for and killed by wpa_action

Modified: wpasupplicant/trunk/src/common/defs.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/defs.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/defs.h (original)
+++ wpasupplicant/trunk/src/common/defs.h Fri Feb  1 14:38:48 2008
@@ -55,7 +55,8 @@
 	       CIPHER_WEP104 } wpa_cipher;
 typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
 	       KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE,
-	       KEY_MGMT_FT_802_1X, KEY_MGMT_FT_PSK } wpa_key_mgmt;
+	       KEY_MGMT_FT_802_1X, KEY_MGMT_FT_PSK
+} wpa_key_mgmt;
 
 /**
  * enum wpa_states - wpa_supplicant state

Modified: wpasupplicant/trunk/src/common/wpa_common.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/wpa_common.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/wpa_common.c (original)
+++ wpasupplicant/trunk/src/common/wpa_common.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA/RSN - Shared functions for supplicant and authenticator
- * Copyright (c) 2002-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2002-2008, 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
@@ -124,8 +124,7 @@
 
 
 #ifdef CONFIG_IEEE80211R
-int wpa_ft_mic(const u8 *kck, int use_aes_cmac,
-	       const u8 *sta_addr, const u8 *ap_addr,
+int wpa_ft_mic(const u8 *kck, const u8 *sta_addr, const u8 *ap_addr,
 	       u8 transaction_seqnum, const u8 *mdie, size_t mdie_len,
 	       const u8 *ftie, size_t ftie_len,
 	       const u8 *rsnie, size_t rsnie_len,
@@ -170,13 +169,10 @@
 	}
 
 	wpa_hexdump(MSG_MSGDUMP, "FT: MIC data", buf, pos - buf);
-	if (use_aes_cmac) {
-		if (omac1_aes_128(kck, buf, pos - buf, mic)) {
-			os_free(buf);
-			return -1;
-		}
-	} else
-		hmac_md5(kck, 16, buf, pos - buf, mic);
+	if (omac1_aes_128(kck, buf, pos - buf, mic)) {
+		os_free(buf);
+		return -1;
+	}
 
 	os_free(buf);
 
@@ -398,7 +394,7 @@
 /**
  * wpa_derive_pmk_r0 - Derive PMK-R0 and PMKR0Name
  *
- * IEEE 802.11r/D8.0 - 8.5.1.5.3
+ * IEEE 802.11r/D9.0 - 8.5.1.5.3
  */
 void wpa_derive_pmk_r0(const u8 *xxkey, size_t xxkey_len,
 		       const u8 *ssid, size_t ssid_len,
@@ -438,10 +434,10 @@
 	os_memcpy(pmk_r0, r0_key_data, PMK_LEN);
 
 	/*
-	 * PMKR0Name = Truncate-128(SHA-256("FT-R0" || PMK-R0Name-Salt)
+	 * PMKR0Name = Truncate-128(SHA-256("FT-R0N" || PMK-R0Name-Salt)
 	 */
-	addr[0] = (const u8 *) "FT-R0";
-	len[0] = 5;
+	addr[0] = (const u8 *) "FT-R0N";
+	len[0] = 6;
 	addr[1] = r0_key_data + PMK_LEN;
 	len[1] = 16;
 
@@ -453,7 +449,7 @@
 /**
  * wpa_derive_pmk_r1_name - Derive PMKR1Name
  *
- * IEEE 802.11r/D8.0 - 8.5.1.5.4
+ * IEEE 802.11r/D9.0 - 8.5.1.5.4
  */
 void wpa_derive_pmk_r1_name(const u8 *pmk_r0_name, const u8 *r1kh_id,
 			    const u8 *s1kh_id, u8 *pmk_r1_name)
@@ -463,11 +459,11 @@
 	size_t len[4];
 
 	/*
-	 * PMKR1Name = Truncate-128(SHA-256("FT-R1" || PMKR0Name ||
+	 * PMKR1Name = Truncate-128(SHA-256("FT-R1N" || PMKR0Name ||
 	 *                                  R1KH-ID || S1KH-ID))
 	 */
-	addr[0] = (const u8 *) "FT-R1";
-	len[0] = 5;
+	addr[0] = (const u8 *) "FT-R1N";
+	len[0] = 6;
 	addr[1] = pmk_r0_name;
 	len[1] = WPA_PMK_NAME_LEN;
 	addr[2] = r1kh_id;
@@ -483,7 +479,7 @@
 /**
  * wpa_derive_pmk_r1 - Derive PMK-R1 and PMKR1Name from PMK-R0
  *
- * IEEE 802.11r/D8.0 - 8.5.1.5.4
+ * IEEE 802.11r/D9.0 - 8.5.1.5.4
  */
 void wpa_derive_pmk_r1(const u8 *pmk_r0, const u8 *pmk_r0_name,
 		       const u8 *r1kh_id, const u8 *s1kh_id,
@@ -508,7 +504,7 @@
 /**
  * wpa_pmk_r1_to_ptk - Derive PTK and PTKName from PMK-R1
  *
- * IEEE 802.11r/D8.0 - 8.5.1.5.5
+ * IEEE 802.11r/D9.0 - 8.5.1.5.5
  */
 void wpa_pmk_r1_to_ptk(const u8 *pmk_r1, const u8 *snonce, const u8 *anonce,
 		       const u8 *sta_addr, const u8 *bssid,
@@ -537,13 +533,13 @@
 	sha256_prf(pmk_r1, PMK_LEN, "FT-PTK", buf, pos - buf, ptk, ptk_len);
 
 	/*
-	 * PTKName = Truncate-128(SHA-256(PMKR1Name || "FT-PTK" || SNonce ||
+	 * PTKName = Truncate-128(SHA-256(PMKR1Name || "FT-PTKN" || SNonce ||
 	 *                                ANonce || BSSID || STA-ADDR))
 	 */
 	addr[0] = pmk_r1_name;
 	len[0] = WPA_PMK_NAME_LEN;
-	addr[1] = (const u8 *) "FT-PTK";
-	len[1] = 6;
+	addr[1] = (const u8 *) "FT-PTKN";
+	len[1] = 7;
 	addr[2] = snonce;
 	len[2] = WPA_NONCE_LEN;
 	addr[3] = anonce;

Modified: wpasupplicant/trunk/src/common/wpa_common.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/wpa_common.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/wpa_common.h (original)
+++ wpasupplicant/trunk/src/common/wpa_common.h Fri Feb  1 14:38:48 2008
@@ -290,8 +290,7 @@
 		    u8 *ptk, size_t ptk_len);
 
 #ifdef CONFIG_IEEE80211R
-int wpa_ft_mic(const u8 *kck, int use_aes_cmac,
-	       const u8 *sta_addr, const u8 *ap_addr,
+int wpa_ft_mic(const u8 *kck, const u8 *sta_addr, const u8 *ap_addr,
 	       u8 transaction_seqnum, const u8 *mdie, size_t mdie_len,
 	       const u8 *ftie, size_t ftie_len,
 	       const u8 *rsnie, size_t rsnie_len,

Modified: wpasupplicant/trunk/src/common/wpa_ctrl.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/common/wpa_ctrl.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/common/wpa_ctrl.h (original)
+++ wpasupplicant/trunk/src/common/wpa_ctrl.h Fri Feb  1 14:38:48 2008
@@ -46,6 +46,13 @@
 #define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
 /** EAP authentication failed (EAP-Failure received) */
 #define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
+/** New scan results available */
+#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
+
+
+/* hostapd control interface - fixed message prefixes */
+#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
+#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
 
 
 /* wpa_supplicant/hostapd control interface access */

Modified: wpasupplicant/trunk/src/crypto/crypto_openssl.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/crypto/crypto_openssl.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/crypto/crypto_openssl.c (original)
+++ wpasupplicant/trunk/src/crypto/crypto_openssl.c Fri Feb  1 14:38:48 2008
@@ -20,6 +20,7 @@
 #include <openssl/des.h>
 #include <openssl/aes.h>
 #include <openssl/bn.h>
+#include <openssl/evp.h>
 
 #include "common.h"
 #include "crypto.h"
@@ -66,7 +67,6 @@
 }
 
 
-#ifdef EAP_TLS_FUNCS
 void md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
 {
 	MD5_CTX ctx;
@@ -207,7 +207,6 @@
 {
 	os_free(ctx);
 }
-#endif /* EAP_TLS_FUNCS */
 
 
 int crypto_mod_exp(const u8 *base, size_t base_len,
@@ -246,3 +245,114 @@
 	BN_CTX_free(ctx);
 	return ret;
 }
+
+
+struct crypto_cipher {
+	EVP_CIPHER_CTX enc;
+	EVP_CIPHER_CTX dec;
+};
+
+
+struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
+					  const u8 *iv, const u8 *key,
+					  size_t key_len)
+{
+	struct crypto_cipher *ctx;
+	const EVP_CIPHER *cipher;
+
+	ctx = os_zalloc(sizeof(*ctx));
+	if (ctx == NULL)
+		return NULL;
+
+	switch (alg) {
+#ifndef OPENSSL_NO_RC4
+	case CRYPTO_CIPHER_ALG_RC4:
+		cipher = EVP_rc4();
+		break;
+#endif /* OPENSSL_NO_RC4 */
+#ifndef OPENSSL_NO_AES
+	case CRYPTO_CIPHER_ALG_AES:
+		switch (key_len) {
+		case 16:
+			cipher = EVP_aes_128_cbc();
+			break;
+		case 24:
+			cipher = EVP_aes_192_cbc();
+			break;
+		case 32:
+			cipher = EVP_aes_256_cbc();
+			break;
+		default:
+			return NULL;
+		}
+		break;
+#endif /* OPENSSL_NO_AES */
+#ifndef OPENSSL_NO_DES
+	case CRYPTO_CIPHER_ALG_3DES:
+		cipher = EVP_des_ede3_cbc();
+		break;
+	case CRYPTO_CIPHER_ALG_DES:
+		cipher = EVP_des_cbc();
+		break;
+#endif /* OPENSSL_NO_DES */
+#ifndef OPENSSL_NO_RC2
+	case CRYPTO_CIPHER_ALG_RC2:
+		cipher = EVP_rc2_ecb();
+		break;
+#endif /* OPENSSL_NO_RC2 */
+	default:
+		return NULL;
+	}
+
+	EVP_CIPHER_CTX_init(&ctx->enc);
+	EVP_CIPHER_CTX_set_padding(&ctx->enc, 0);
+	if (!EVP_EncryptInit_ex(&ctx->enc, cipher, NULL, NULL, NULL) ||
+	    !EVP_CIPHER_CTX_set_key_length(&ctx->enc, key_len) ||
+	    !EVP_EncryptInit_ex(&ctx->enc, cipher, NULL, key, iv)) {
+		EVP_CIPHER_CTX_cleanup(&ctx->enc);
+		os_free(ctx);
+		return NULL;
+	}
+
+	EVP_CIPHER_CTX_init(&ctx->dec);
+	EVP_CIPHER_CTX_set_padding(&ctx->dec, 0);
+	if (!EVP_DecryptInit_ex(&ctx->dec, cipher, NULL, NULL, NULL) ||
+	    !EVP_CIPHER_CTX_set_key_length(&ctx->dec, key_len) ||
+	    !EVP_DecryptInit_ex(&ctx->dec, cipher, NULL, key, iv)) {
+		EVP_CIPHER_CTX_cleanup(&ctx->enc);
+		EVP_CIPHER_CTX_cleanup(&ctx->dec);
+		os_free(ctx);
+		return NULL;
+	}
+
+	return ctx;
+}
+
+
+int crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain,
+			  u8 *crypt, size_t len)
+{
+	int outl;
+	if (!EVP_EncryptUpdate(&ctx->enc, crypt, &outl, plain, len))
+		return -1;
+	return 0;
+}
+
+
+int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt,
+			  u8 *plain, size_t len)
+{
+	int outl;
+	outl = len;
+	if (!EVP_DecryptUpdate(&ctx->dec, plain, &outl, crypt, len))
+		return -1;
+	return 0;
+}
+
+
+void crypto_cipher_deinit(struct crypto_cipher *ctx)
+{
+	EVP_CIPHER_CTX_cleanup(&ctx->enc);
+	EVP_CIPHER_CTX_cleanup(&ctx->dec);
+	os_free(ctx);
+}

Modified: wpasupplicant/trunk/src/drivers/driver.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver.h (original)
+++ wpasupplicant/trunk/src/drivers/driver.h Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - driver interface definition
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -920,6 +920,15 @@
 	 * freeing the data structure) on success, NULL on failure
 	 */
 	 struct wpa_scan_results * (*get_scan_results2)(void *priv);
+
+	/**
+	 * * set_probe_req_ie - Set information element(s) for Probe Request
+	 * @priv: private driver interface data
+	 * @ies: Information elements to append or %NULL to remove extra IEs
+	 * @ies_len: Length of the IE buffer in octets
+	 * Returns: 0 on success, -1 on failure
+	 */
+	int (*set_probe_req_ie)(void *, const u8 *ies, size_t ies_len);
 };
 
 /**
@@ -1202,9 +1211,13 @@
 void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
 			     const u8 *buf, size_t len);
 
+void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
+			   struct ieee80211_rx_status *rx_status);
+void wpa_supplicant_sta_free_hw_features(struct wpa_hw_modes *hw_features,
+					 size_t num_hw_features);
+
 const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
 #define WPA_IE_VENDOR_TYPE 0x0050f201
-#define WPS_IE_VENDOR_TYPE 0x0050f204
 const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
 				  u32 vendor_type);
 int wpa_scan_get_max_rate(const struct wpa_scan_res *res);

Modified: wpasupplicant/trunk/src/drivers/driver_test.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_test.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_test.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_test.c Fri Feb  1 14:38:48 2008
@@ -23,7 +23,6 @@
 #include "eloop.h"
 #include "sha1.h"
 #include "ieee802_11_defs.h"
-#include "mlme.h"
 
 
 struct wpa_driver_test_data {
@@ -456,7 +455,7 @@
 {
 	struct ieee80211_rx_status rx_status;
 	os_memset(&rx_status, 0, sizeof(rx_status));
-	ieee80211_sta_rx(drv->ctx, data, data_len, &rx_status);
+	wpa_supplicant_sta_rx(drv->ctx, data, data_len, &rx_status);
 }
 
 
@@ -796,7 +795,7 @@
 	modes[0].channels = os_zalloc(sizeof(struct wpa_channel_data));
 	modes[0].rates = os_zalloc(sizeof(struct wpa_rate_data));
 	if (modes[0].channels == NULL || modes[0].rates == NULL) {
-		ieee80211_sta_free_hw_features(modes, *num_modes);
+		wpa_supplicant_sta_free_hw_features(modes, *num_modes);
 		return NULL;
 	}
 	modes[0].channels[0].chan = 1;
@@ -982,5 +981,6 @@
 #endif /* CONFIG_CLIENT_MLME */
 	NULL /* update_ft_ies */,
 	NULL /* send_ft_action */,
-	wpa_driver_test_get_scan_results2
+	wpa_driver_test_get_scan_results2,
+	NULL /* set_probe_req_ie */
 };

Modified: wpasupplicant/trunk/src/drivers/driver_wext.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/drivers/driver_wext.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/drivers/driver_wext.c (original)
+++ wpasupplicant/trunk/src/drivers/driver_wext.c Fri Feb  1 14:38:48 2008
@@ -32,9 +32,108 @@
 
 #ifdef CONFIG_CLIENT_MLME
 #include <netpacket/packet.h>
-#include <hostapd_ioctl.h>
-#include <ieee80211_common.h>
-/* from net/mac80211.h */
+/* old definitions from net/mac80211 */
+
+typedef u32 __bitwise __be32;
+typedef u64 __bitwise __be64;
+
+#define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0)
+#define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1)
+#define PRISM2_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 3)
+
+#define PRISM2_PARAM_USER_SPACE_MLME 1045
+#define PRISM2_PARAM_MGMT_IF		1046
+#define PRISM2_HOSTAPD_ADD_STA 2
+#define PRISM2_HOSTAPD_REMOVE_STA 3
+#define PRISM2_HOSTAPD_GET_HW_FEATURES	1002
+#define PRISM2_HOSTAPD_MAX_BUF_SIZE	2048
+
+#ifndef ALIGNED
+#define ALIGNED __attribute__ ((aligned))
+#endif
+
+struct prism2_hostapd_param {
+	u32 cmd;
+	u8 sta_addr[ETH_ALEN];
+	u8 pad[2];
+	union {
+		struct {
+			u16 aid;
+			u16 capability;
+			u8 supp_rates[32];
+			u8 wds_flags;
+#define IEEE80211_STA_DYNAMIC_ENC BIT(0)
+			u8 enc_flags;
+			u16 listen_interval;
+		} add_sta;
+		struct {
+			u16 num_modes;
+			u16 flags;
+			u8 data[0] ALIGNED; /* num_modes * feature data */
+		} hw_features;
+		struct {
+			u16 mode; /* MODE_* */
+			u16 num_supported_rates;
+			u16 num_basic_rates;
+			u8 data[0] ALIGNED; /* num_supported_rates * u16 +
+					     * num_basic_rates * u16 */
+		} set_rate_sets;
+		struct {
+			u16 mode; /* MODE_* */
+			u16 chan;
+			u32 flag;
+			u8 power_level; /* regulatory limit in dBm */
+			u8 antenna_max;
+		} set_channel_flag;
+		struct {
+			u32 rd;
+		} set_regulatory_domain;
+		struct {
+			u32 queue;
+			s32 aifs;
+			u32 cw_min;
+			u32 cw_max;
+			u32 burst_time; /* maximum burst time in 0.1 ms, i.e.,
+					 * 10 = 1 ms */
+		} tx_queue_params;
+	} u;
+};
+
+struct hostapd_ioctl_hw_modes_hdr {
+	int mode;
+	int num_channels;
+	int num_rates;
+};
+
+/*
+ * frame format for the management interface that is slated
+ * to be replaced by "cooked monitor" with radiotap
+ */
+#define IEEE80211_FI_VERSION 0x80211001
+struct ieee80211_frame_info {
+	__be32 version;
+	__be32 length;
+	__be64 mactime;
+	__be64 hosttime;
+	__be32 phytype;
+	__be32 channel;
+	__be32 datarate;
+	__be32 antenna;
+	__be32 priority;
+	__be32 ssi_type;
+	__be32 ssi_signal;
+	__be32 ssi_noise;
+	__be32 preamble;
+	__be32 encoding;
+
+	/* Note: this structure is otherwise identical to capture format used
+	 * in linux-wlan-ng, but this additional field is used to provide meta
+	 * data about the frame to hostapd. This was the easiest method for
+	 * providing this information, but this might change in the future. */
+	__be32 msg_type;
+} __attribute__ ((packed));
+
+/* old mode definitions */
 enum {
 	MODE_IEEE80211A = 0 /* IEEE 802.11a */,
 	MODE_IEEE80211B = 1 /* IEEE 802.11b only */,
@@ -43,8 +142,6 @@
 	MODE_ATHEROS_TURBOG = 4 /* Atheros Turbo mode (2x.11g at 2.4 GHz) */,
 	NUM_IEEE80211_MODES = 5
 };
-
-#include "mlme.h"
 
 #ifndef ETH_P_ALL
 #define ETH_P_ALL 0x0003
@@ -1778,7 +1875,7 @@
 		os_memset(&iwr, 0, sizeof(iwr));
 		os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
 		iwr.u.encoding.flags = key_idx + 1;
-		iwr.u.encoding.pointer = (caddr_t) key;
+		iwr.u.encoding.pointer = (caddr_t) NULL;
 		iwr.u.encoding.length = 0;
 		if (ioctl(drv->ioctl_sock, SIOCSIWENCODE, &iwr) < 0) {
 			perror("ioctl[SIOCSIWENCODE] (set_tx)");
@@ -2261,7 +2358,7 @@
 		default:
 			wpa_printf(MSG_ERROR, "Unknown hw_mode=%d in "
 				   "get_hw_features data", hdr->mode);
-			ieee80211_sta_free_hw_features(modes, *num_modes);
+			wpa_supplicant_sta_free_hw_features(modes, *num_modes);
 			modes = NULL;
 			break;
 		}
@@ -2272,7 +2369,7 @@
 		feature->rates = os_malloc(rlen);
 		if (!feature->channels || !feature->rates ||
 		    pos + clen + rlen > end) {
-			ieee80211_sta_free_hw_features(modes, *num_modes);
+			wpa_supplicant_sta_free_hw_features(modes, *num_modes);
 			modes = NULL;
 			break;
 		}
@@ -2328,9 +2425,10 @@
 	rx_status.ssi = ntohl(fi->ssi_signal);
 	rx_status.channel = ntohl(fi->channel);
 
-	ieee80211_sta_rx(drv->ctx, buf + sizeof(struct ieee80211_frame_info),
-			 len - sizeof(struct ieee80211_frame_info),
-			 &rx_status);
+	wpa_supplicant_sta_rx(drv->ctx,
+			      buf + sizeof(struct ieee80211_frame_info),
+			      len - sizeof(struct ieee80211_frame_info),
+			      &rx_status);
 }
 
 

Modified: wpasupplicant/trunk/src/eap_common/ikev2_common.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_common/ikev2_common.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_common/ikev2_common.c (original)
+++ wpasupplicant/trunk/src/eap_common/ikev2_common.c Fri Feb  1 14:38:48 2008
@@ -327,7 +327,8 @@
 			   next_payload);
 		if (end - pos < (int) sizeof(*phdr)) {
 			wpa_printf(MSG_INFO, "IKEV2:   Too short message for "
-				   "payload header (left=%d)", end - pos);
+				   "payload header (left=%ld)",
+				   (long) (end - pos));
 		}
 		phdr = (const struct ikev2_payload_hdr *) pos;
 		plen = WPA_GET_BE16(phdr->payload_length);

Modified: wpasupplicant/trunk/src/eap_peer/eap.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer state machines (RFC 4137)
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -25,7 +25,7 @@
 
 #include "common.h"
 #include "eap_i.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "tls.h"
 #include "crypto.h"
 #include "pcsc_funcs.h"
@@ -107,7 +107,7 @@
  */
 static int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	int i;
 	struct eap_method_type *m;
 
@@ -269,7 +269,7 @@
 		sm->eap_method_priv = sm->m->init(sm);
 
 	if (sm->eap_method_priv == NULL) {
-		struct wpa_ssid *config = eap_get_config(sm);
+		struct eap_peer_config *config = eap_get_config(sm);
 		wpa_msg(sm->msg_ctx, MSG_INFO,
 			"EAP: Failed to initialize EAP method: vendor %u "
 			"method %u (%s)",
@@ -863,12 +863,13 @@
 
 
 #ifdef PCSC_FUNCS
-static int eap_sm_imsi_identity(struct eap_sm *sm, struct wpa_ssid *ssid)
+static int eap_sm_imsi_identity(struct eap_sm *sm,
+				struct eap_peer_config *conf)
 {
 	int aka = 0;
 	char imsi[100];
 	size_t imsi_len;
-	struct eap_method_type *m = ssid->eap_methods;
+	struct eap_method_type *m = conf->eap_methods;
 	int i;
 
 	imsi_len = sizeof(imsi);
@@ -888,40 +889,41 @@
 		}
 	}
 
-	os_free(ssid->identity);
-	ssid->identity = os_malloc(1 + imsi_len);
-	if (ssid->identity == NULL) {
+	os_free(conf->identity);
+	conf->identity = os_malloc(1 + imsi_len);
+	if (conf->identity == NULL) {
 		wpa_printf(MSG_WARNING, "Failed to allocate buffer for "
 			   "IMSI-based identity");
 		return -1;
 	}
 
-	ssid->identity[0] = aka ? '0' : '1';
-	os_memcpy(ssid->identity + 1, imsi, imsi_len);
-	ssid->identity_len = 1 + imsi_len;
+	conf->identity[0] = aka ? '0' : '1';
+	os_memcpy(conf->identity + 1, imsi, imsi_len);
+	conf->identity_len = 1 + imsi_len;
 
 	return 0;
 }
 #endif /* PCSC_FUNCS */
 
 
-static int eap_sm_get_scard_identity(struct eap_sm *sm, struct wpa_ssid *ssid)
+static int eap_sm_get_scard_identity(struct eap_sm *sm,
+				     struct eap_peer_config *conf)
 {
 #ifdef PCSC_FUNCS
-	if (scard_set_pin(sm->scard_ctx, ssid->pin)) {
+	if (scard_set_pin(sm->scard_ctx, conf->pin)) {
 		/*
 		 * Make sure the same PIN is not tried again in order to avoid
 		 * blocking SIM.
 		 */
-		os_free(ssid->pin);
-		ssid->pin = NULL;
+		os_free(conf->pin);
+		conf->pin = NULL;
 
 		wpa_printf(MSG_WARNING, "PIN validation failed");
 		eap_sm_request_pin(sm);
 		return -1;
 	}
 
-	return eap_sm_imsi_identity(sm, ssid);
+	return eap_sm_imsi_identity(sm, conf);
 #else /* PCSC_FUNCS */
 	return -1;
 #endif /* PCSC_FUNCS */
@@ -941,7 +943,7 @@
  */
 struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	struct wpabuf *resp;
 	const u8 *identity;
 	size_t identity_len;
@@ -1160,6 +1162,8 @@
 	sm->eapol_cb = eapol_cb;
 	sm->msg_ctx = msg_ctx;
 	sm->ClientTimeout = 60;
+	if (conf->mac_addr)
+		os_memcpy(sm->mac_addr, conf->mac_addr, ETH_ALEN);
 
 	os_memset(&tlsconf, 0, sizeof(tlsconf));
 	tlsconf.opensc_engine_path = conf->opensc_engine_path;
@@ -1397,12 +1401,8 @@
 static void eap_sm_request(struct eap_sm *sm, eap_ctrl_req_type type,
 			   const char *msg, size_t msglen)
 {
-	struct wpa_ssid *config;
-	char *buf;
-	size_t buflen;
-	int len;
-	char *field;
-	char *txt, *tmp;
+	struct eap_peer_config *config;
+	char *field, *txt, *tmp;
 
 	if (sm == NULL)
 		return;
@@ -1460,25 +1460,8 @@
 		return;
 	}
 
-	buflen = 100 + os_strlen(txt) + config->ssid_len;
-	buf = os_malloc(buflen);
-	if (buf == NULL)
-		return;
-	len = os_snprintf(buf, buflen,
-			  WPA_CTRL_REQ "%s-%d:%s needed for SSID ",
-			  field, config->id, txt);
-	if (len < 0 || (size_t) len >= buflen) {
-		os_free(buf);
-		return;
-	}
-	if (config->ssid && buflen > len + config->ssid_len) {
-		os_memcpy(buf + len, config->ssid, config->ssid_len);
-		len += config->ssid_len;
-		buf[len] = '\0';
-	}
-	buf[buflen - 1] = '\0';
-	wpa_msg(sm->msg_ctx, MSG_INFO, "%s", buf);
-	os_free(buf);
+	if (sm->eapol_cb->eap_param_needed)
+		sm->eapol_cb->eap_param_needed(sm->eapol_ctx, field, txt);
 }
 #else /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
 #define eap_sm_request(sm, type, msg, msglen) do { } while (0)
@@ -1585,7 +1568,7 @@
  */
 void eap_sm_notify_ctrl_attached(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	if (config == NULL)
 		return;
@@ -1650,7 +1633,7 @@
  * This function generates an array of allowed EAP phase 2 (tunneled) types for
  * the given network configuration.
  */
-struct eap_method_type * eap_get_phase2_types(struct wpa_ssid *config,
+struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config,
 					      size_t *count)
 {
 	struct eap_method_type *buf;
@@ -1715,23 +1698,23 @@
  * EAP peer methods should avoid using this function if they can use other
  * access functions, like eap_get_config_identity() and
  * eap_get_config_password(), that do not require direct access to
- * struct wpa_ssid.
- */
-struct wpa_ssid * eap_get_config(struct eap_sm *sm)
+ * struct eap_peer_config.
+ */
+struct eap_peer_config * eap_get_config(struct eap_sm *sm)
 {
 	return sm->eapol_cb->get_config(sm->eapol_ctx);
 }
 
 
 /**
- * eap_get_config_password - Get identity from the network configuration
+ * eap_get_config_identity - Get identity from the network configuration
  * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init()
  * @len: Buffer for the length of the identity
  * Returns: Pointer to the identity or %NULL if not found
  */
 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return NULL;
 	*len = config->identity_len;
@@ -1747,7 +1730,7 @@
  */
 const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return NULL;
 	*len = config->password_len;
@@ -1766,12 +1749,12 @@
  */
 const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return NULL;
 	*len = config->password_len;
 	if (hash)
-		*hash = !!(config->flags & WPA_CONFIG_FLAGS_PASSWORD_NTHASH);
+		*hash = !!(config->flags & EAP_CONFIG_FLAGS_PASSWORD_NTHASH);
 	return config->password;
 }
 
@@ -1784,7 +1767,7 @@
  */
 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return NULL;
 	*len = config->new_password_len;
@@ -1800,7 +1783,7 @@
  */
 const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return NULL;
 	*len = config->otp_len;
@@ -1818,7 +1801,7 @@
  */
 void eap_clear_config_otp(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL)
 		return;
 	os_memset(config->otp, 0, config->otp_len);
@@ -1829,6 +1812,34 @@
 
 
 /**
+ * eap_get_config_phase1 - Get phase1 data from the network configuration
+ * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init()
+ * Returns: Pointer to the phase1 data or %NULL if not found
+ */
+const char * eap_get_config_phase1(struct eap_sm *sm)
+{
+	struct eap_peer_config *config = eap_get_config(sm);
+	if (config == NULL)
+		return NULL;
+	return config->phase1;
+}
+
+
+/**
+ * eap_get_config_phase2 - Get phase2 data from the network configuration
+ * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init()
+ * Returns: Pointer to the phase1 data or %NULL if not found
+ */
+const char * eap_get_config_phase2(struct eap_sm *sm)
+{
+	struct eap_peer_config *config = eap_get_config(sm);
+	if (config == NULL)
+		return NULL;
+	return config->phase2;
+}
+
+
+/**
  * eap_key_available - Get key availability (eapKeyAvailable variable)
  * @sm: Pointer to EAP state machine allocated with eap_peer_sm_init()
  * Returns: 1 if EAP keying material is available, 0 if not

Modified: wpasupplicant/trunk/src/eap_peer/eap.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap.h (original)
+++ wpasupplicant/trunk/src/eap_peer/eap.h Fri Feb  1 14:38:48 2008
@@ -20,7 +20,6 @@
 #include "eap_peer/eap_methods.h"
 
 struct eap_sm;
-struct wpa_ssid;
 struct wpa_config_blob;
 struct wpabuf;
 
@@ -139,7 +138,7 @@
 	 * get_config - Get pointer to the current network configuration
 	 * @ctx: eapol_ctx from eap_peer_sm_init() call
 	 */
-	struct wpa_ssid * (*get_config)(void *ctx);
+	struct eap_peer_config * (*get_config)(void *ctx);
 
 	/**
 	 * get_bool - Get a boolean EAPOL state variable
@@ -213,6 +212,15 @@
 	 * request to EAP state machine.
 	 */
 	void (*notify_pending)(void *ctx);
+
+	/**
+	 * eap_param_needed - Notify that EAP parameter is needed
+	 * @ctx: eapol_ctx from eap_peer_sm_init() call
+	 * @field: Field name (e.g., "IDENTITY")
+	 * @txt: User readable text describing the required parameter
+	 */
+	void (*eap_param_needed)(void *ctx, const char *field,
+				 const char *txt);
 };
 
 /**
@@ -237,6 +245,12 @@
 	 * Usually, path to opensc-pkcs11.so.
 	 */
 	const char *pkcs11_module_path;
+	/**
+	 * mac_addr - MAC address of the peer
+	 *
+	 * This is only used by EAP-WSC and can be left %NULL if not available.
+	 */
+	const u8 *mac_addr;
 };
 
 struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
@@ -256,7 +270,7 @@
 void eap_sm_request_passphrase(struct eap_sm *sm);
 void eap_sm_notify_ctrl_attached(struct eap_sm *sm);
 u32 eap_get_phase2_type(const char *name, int *vendor);
-struct eap_method_type * eap_get_phase2_types(struct wpa_ssid *config,
+struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config,
 					      size_t *count);
 void eap_set_fast_reauth(struct eap_sm *sm, int enabled);
 void eap_set_workaround(struct eap_sm *sm, unsigned int workaround);

Modified: wpasupplicant/trunk/src/eap_peer/eap_aka.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_aka.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_aka.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_aka.c Fri Feb  1 14:38:48 2008
@@ -20,7 +20,6 @@
 #include "eap_common/eap_sim_common.h"
 #include "sha1.h"
 #include "crypto.h"
-#include "config_ssid.h"
 
 
 struct eap_aka_data {
@@ -87,7 +86,7 @@
 static void * eap_aka_init(struct eap_sm *sm)
 {
 	struct eap_aka_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	const char *phase1 = eap_get_config_phase1(sm);
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)
@@ -96,8 +95,7 @@
 	eap_aka_state(data, CONTINUE);
 	data->prev_id = -1;
 
-	data->result_ind = config && config->phase1 &&
-			    os_strstr(config->phase1, "result_ind=1") != NULL;
+	data->result_ind = phase1 && os_strstr(phase1, "result_ind=1") != NULL;
 
 	return data;
 }

Modified: wpasupplicant/trunk/src/eap_peer/eap_fast.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_fast.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_fast.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_fast.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-FAST (RFC 4851)
- * Copyright (c) 2004-2006, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -17,7 +17,7 @@
 #include "common.h"
 #include "eap_i.h"
 #include "eap_tls_common.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "tls.h"
 #include "eap_tlv.h"
 #include "sha1.h"
@@ -168,7 +168,7 @@
 static void * eap_fast_init(struct eap_sm *sm)
 {
 	struct eap_fast_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)
@@ -472,7 +472,7 @@
 	size_t len = be_to_host16(hdr->length);
 	u8 *pos;
 	struct eap_method_ret iret;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	struct wpabuf msg;
 
 	if (len <= sizeof(struct eap_hdr)) {
@@ -1122,7 +1122,7 @@
 					    struct eap_method_ret *ret,
 					    u8 *pac, size_t pac_len)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	struct eap_fast_pac entry;
 
 	os_memset(&entry, 0, sizeof(entry));

Modified: wpasupplicant/trunk/src/eap_peer/eap_fast_pac.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_fast_pac.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_fast_pac.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_fast_pac.c Fri Feb  1 14:38:48 2008
@@ -15,8 +15,7 @@
 #include "includes.h"
 
 #include "common.h"
-#include "config_blob.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "eap_i.h"
 #include "eap_fast_pac.h"
 

Modified: wpasupplicant/trunk/src/eap_peer/eap_gpsk.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_gpsk.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_gpsk.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_gpsk.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-GPSK (draft-ietf-emu-eap-gpsk-08.txt)
- * Copyright (c) 2006-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2006-2008, 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
@@ -16,7 +16,6 @@
 
 #include "common.h"
 #include "eap_peer/eap_i.h"
-#include "config_ssid.h"
 #include "eap_common/eap_gpsk_common.h"
 
 struct eap_gpsk_data {
@@ -83,16 +82,13 @@
 
 static void * eap_gpsk_init(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
 	struct eap_gpsk_data *data;
-
-	if (config == NULL) {
-		wpa_printf(MSG_INFO, "EAP-GPSK: No configuration found");
-		return NULL;
-	}
-
-	if (config->eappsk == NULL) {
-		wpa_printf(MSG_INFO, "EAP-GPSK: No key (eappsk) configured");
+	const u8 *identity, *password;
+	size_t identity_len, password_len;
+
+	password = eap_get_config_password(sm, &password_len);
+	if (password == NULL) {
+		wpa_printf(MSG_INFO, "EAP-GPSK: No key (password) configured");
 		return NULL;
 	}
 
@@ -101,23 +97,24 @@
 		return NULL;
 	data->state = GPSK_1;
 
-	if (config->nai) {
-		data->id_peer = os_malloc(config->nai_len);
+	identity = eap_get_config_identity(sm, &identity_len);
+	if (identity) {
+		data->id_peer = os_malloc(identity_len);
 		if (data->id_peer == NULL) {
 			eap_gpsk_deinit(sm, data);
 			return NULL;
 		}
-		os_memcpy(data->id_peer, config->nai, config->nai_len);
-		data->id_peer_len = config->nai_len;
-	}
-
-	data->psk = os_malloc(config->eappsk_len);
+		os_memcpy(data->id_peer, identity, identity_len);
+		data->id_peer_len = identity_len;
+	}
+
+	data->psk = os_malloc(password_len);
 	if (data->psk == NULL) {
 		eap_gpsk_deinit(sm, data);
 		return NULL;
 	}
-	os_memcpy(data->psk, config->eappsk, config->eappsk_len);
-	data->psk_len = config->eappsk_len;
+	os_memcpy(data->psk, password, password_len);
+	data->psk_len = password_len;
 
 	return data;
 }

Modified: wpasupplicant/trunk/src/eap_peer/eap_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_i.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_i.h (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_i.h Fri Feb  1 14:38:48 2008
@@ -332,6 +332,8 @@
 
 	int num_rounds;
 	int force_disabled;
+
+	u8 mac_addr[ETH_ALEN];
 };
 
 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
@@ -340,7 +342,9 @@
 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len);
 const u8 * eap_get_config_otp(struct eap_sm *sm, size_t *len);
 void eap_clear_config_otp(struct eap_sm *sm);
-struct wpa_ssid * eap_get_config(struct eap_sm *sm);
+const char * eap_get_config_phase1(struct eap_sm *sm);
+const char * eap_get_config_phase2(struct eap_sm *sm);
+struct eap_peer_config * eap_get_config(struct eap_sm *sm);
 void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob);
 const struct wpa_config_blob *
 eap_get_config_blob(struct eap_sm *sm, const char *name);

Modified: wpasupplicant/trunk/src/eap_peer/eap_ikev2.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_ikev2.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_ikev2.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_ikev2.c Fri Feb  1 14:38:48 2008
@@ -368,8 +368,8 @@
 
 		if (message_length < (u32) (end - pos)) {
 			wpa_printf(MSG_DEBUG, "EAP-IKEV2: Invalid Message "
-				   "Length (%d; %d remaining in this msg)",
-				   message_length, end - pos);
+				   "Length (%d; %ld remaining in this msg)",
+				   message_length, (long) (end - pos));
 			ret->ignore = TRUE;
 			return NULL;
 		}

Modified: wpasupplicant/trunk/src/eap_peer/eap_methods.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_methods.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_methods.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_methods.c Fri Feb  1 14:38:48 2008
@@ -455,13 +455,6 @@
 	}
 #endif /* EAP_GPSK */
 
-#ifdef EAP_WSC
-	if (ret == 0) {
-		int eap_peer_wsc_register(void);
-		ret = eap_peer_wsc_register();
-	}
-#endif /* EAP_WSC */
-
 #ifdef EAP_IKEV2
 	if (ret == 0) {
 		int eap_peer_ikev2_register(void);

Modified: wpasupplicant/trunk/src/eap_peer/eap_mschapv2.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_mschapv2.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_mschapv2.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_mschapv2.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-MSCHAPV2 (draft-kamath-pppext-eap-mschapv2-00.txt)
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -23,13 +23,11 @@
 
 #include "common.h"
 #include "eap_i.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "ms_funcs.h"
 #include "wpa_ctrl.h"
-
-
-#define MSCHAPV2_CHAL_LEN 16
-#define MSCHAPV2_NT_RESPONSE_LEN 24
+#include "mschapv2.h"
+
 
 #ifdef _MSC_VER
 #pragma pack(push, 1)
@@ -83,7 +81,7 @@
 
 
 struct eap_mschapv2_data {
-	u8 auth_response[20];
+	u8 auth_response[MSCHAPV2_AUTH_RESPONSE_LEN];
 	int auth_response_valid;
 
 	int prev_error;
@@ -98,7 +96,7 @@
 	int full_key;
 
 	int phase2;
-	u8 master_key[16];
+	u8 master_key[MSCHAPV2_MASTER_KEY_LEN];
 	int master_key_valid;
 	int success;
 
@@ -155,86 +153,6 @@
 }
 
 
-static const u8 * eap_mschapv2_remove_domain(const u8 *username, size_t *len)
-{
-	size_t i;
-
-	/*
-	 * MSCHAPv2 does not include optional domain name in the
-	 * challenge-response calculation, so remove domain prefix
-	 * (if present).
-	 */
-
-	for (i = 0; i < *len; i++) {
-		if (username[i] == '\\') {
-			*len -= i + 1;
-			return username + i + 1;
-		}
-	}
-
-	return username;
-}
-
-
-static void eap_mschapv2_derive_response(
-	struct eap_mschapv2_data *data,
-	const u8 *username, size_t username_len,
-	const u8 *password, size_t password_len, int pwhash,
-	const u8 *auth_challenge, const u8 *peer_challenge,
-	u8 *nt_response)
-{
-	u8 password_hash[16], password_hash_hash[16];
-
-	wpa_hexdump(MSG_DEBUG, "EAP-MSCHAPV2: auth_challenge",
-		    auth_challenge, MSCHAPV2_CHAL_LEN);
-	wpa_hexdump(MSG_DEBUG, "EAP-MSCHAPV2: peer_challenge",
-		    peer_challenge, MSCHAPV2_CHAL_LEN);
-	wpa_hexdump_ascii(MSG_DEBUG, "EAP-MSCHAPV2: username",
-			  username, username_len);
-	if (pwhash) {
-		wpa_hexdump_key(MSG_DEBUG, "EAP-MSCHAPV2: password hash",
-				password, password_len);
-		generate_nt_response_pwhash(auth_challenge, peer_challenge,
-					    username, username_len,
-					    password, nt_response);
-	} else {
-		wpa_hexdump_ascii_key(MSG_DEBUG, "EAP-MSCHAPV2: password",
-				      password, password_len);
-		generate_nt_response(auth_challenge, peer_challenge,
-				     username, username_len,
-				     password, password_len, nt_response);
-	}
-	wpa_hexdump(MSG_DEBUG, "EAP-MSCHAPV2: response", nt_response,
-		    MSCHAPV2_NT_RESPONSE_LEN);
-	/* Authenticator response is not really needed yet, but calculate it
-	 * here so that challenges need not be saved. */
-	if (pwhash) {
-		generate_authenticator_response_pwhash(
-			password, peer_challenge, auth_challenge,
-			username, username_len, nt_response,
-			data->auth_response);
-	} else {
-		generate_authenticator_response(password, password_len,
-						peer_challenge, auth_challenge,
-						username, username_len,
-						nt_response,
-						data->auth_response);
-	}
-	data->auth_response_valid = 1;
-
-	/* Likewise, generate master_key here since we have the needed data
-	 * available. */
-	if (pwhash) {
-		hash_nt_password_hash(password, password_hash_hash);
-	} else {
-		nt_password_hash(password, password_len, password_hash);
-		hash_nt_password_hash(password_hash, password_hash_hash);
-	}
-	get_master_key(password_hash_hash, nt_response, data->master_key);
-	data->master_key_valid = 1;
-}
-
-
 static struct wpabuf * eap_mschapv2_challenge_reply(
 	struct eap_sm *sm, struct eap_mschapv2_data *data, u8 id,
 	u8 mschapv2_id, const u8 *auth_challenge)
@@ -244,8 +162,8 @@
 	u8 *peer_challenge;
 	int ms_len;
 	struct ms_response *r;
-	size_t username_len, identity_len, password_len;
-	const u8 *username, *identity, *password;
+	size_t identity_len, password_len;
+	const u8 *identity, *password;
 	int pwhash;
 
 	wpa_printf(MSG_DEBUG, "EAP-MSCHAPV2: Generating Challenge Response");
@@ -254,9 +172,6 @@
 	password = eap_get_config_password2(sm, &password_len, &pwhash);
 	if (identity == NULL || password == NULL)
 		return NULL;
-
-	username_len = identity_len;
-	username = eap_mschapv2_remove_domain(identity, &username_len);
 
 	ms_len = sizeof(*ms) + 1 + sizeof(*r) + identity_len;
 	resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_MSCHAPV2, ms_len,
@@ -298,10 +213,12 @@
 			   "in Phase 1");
 		auth_challenge = data->auth_challenge;
 	}
-	eap_mschapv2_derive_response(data, username, username_len,
-				     password, password_len, pwhash,
-				     auth_challenge, peer_challenge,
-				     r->nt_response);
+	mschapv2_derive_response(identity, identity_len, password,
+				 password_len, pwhash, auth_challenge,
+				 peer_challenge, r->nt_response,
+				 data->auth_response, data->master_key);
+	data->auth_response_valid = 1;
+	data->master_key_valid = 1;
 
 	r->flags = 0; /* reserved, must be zero */
 
@@ -384,14 +301,14 @@
 static void eap_mschapv2_password_changed(struct eap_sm *sm,
 					  struct eap_mschapv2_data *data)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config && config->new_password) {
 		wpa_msg(sm->msg_ctx, MSG_INFO,
 			WPA_EVENT_PASSWORD_CHANGED
 			"EAP-MSCHAPV2: Password changed successfully");
 		data->prev_error = 0;
 		os_free(config->password);
-		if (config->flags & WPA_CONFIG_FLAGS_PASSWORD_NTHASH) {
+		if (config->flags & EAP_CONFIG_FLAGS_PASSWORD_NTHASH) {
 			config->password = os_malloc(16);
 			config->password_len = 16;
 			if (config->password) {
@@ -429,24 +346,21 @@
 {
 	struct wpabuf *resp;
 	const u8 *pos;
-	u8 recv_response[20];
 	size_t len;
 
 	wpa_printf(MSG_DEBUG, "EAP-MSCHAPV2: Received success");
 	len = req_len - sizeof(*req);
 	pos = (const u8 *) (req + 1);
-	if (!data->auth_response_valid || len < 42 ||
-	    pos[0] != 'S' || pos[1] != '=' ||
-	    hexstr2bin((char *) (pos + 2), recv_response, 20) ||
-	    os_memcmp(data->auth_response, recv_response, 20) != 0) {
+	if (!data->auth_response_valid ||
+	    mschapv2_verify_auth_response(data->auth_response, pos, len)) {
 		wpa_printf(MSG_WARNING, "EAP-MSCHAPV2: Invalid authenticator "
 			   "response in success request");
 		ret->methodState = METHOD_DONE;
 		ret->decision = DECISION_FAIL;
 		return NULL;
 	}
-	pos += 42;
-	len -= 42;
+	pos += 2 + 2 * MSCHAPV2_AUTH_RESPONSE_LEN;
+	len -= 2 + 2 * MSCHAPV2_AUTH_RESPONSE_LEN;
 	while (len > 0 && *pos == ' ') {
 		pos++;
 		len--;
@@ -485,7 +399,7 @@
 {
 	char *pos, *msg = "";
 	int retry = 1;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	/* For example:
 	 * E=691 R=1 C=<32 octets hex challenge> V=3 M=Authentication Failure
@@ -602,7 +516,7 @@
 	if (username == NULL || password == NULL || new_password == NULL)
 		return NULL;
 
-	username = eap_mschapv2_remove_domain(username, &username_len);
+	username = mschapv2_remove_domain(username, &username_len);
 
 	ret->ignore = FALSE;
 	ret->methodState = METHOD_MAY_CONT;
@@ -747,7 +661,7 @@
 
 	if (data->prev_error == ERROR_PASSWD_EXPIRED &&
 	    data->passwd_change_version == 3) {
-		struct wpa_ssid *config = eap_get_config(sm);
+		struct eap_peer_config *config = eap_get_config(sm);
 		if (config && config->new_password)
 			return eap_mschapv2_change_password(sm, data, ret, req,
 							    id);
@@ -843,7 +757,7 @@
 					    const struct wpabuf *reqData)
 {
 	struct eap_mschapv2_data *data = priv;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	const struct eap_mschapv2_hdr *ms;
 	int using_prev_challenge = 0;
 	const u8 *pos;

Modified: wpasupplicant/trunk/src/eap_peer/eap_pax.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_pax.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_pax.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_pax.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-PAX (RFC 4746)
- * Copyright (c) 2005-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2005-2008, 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
@@ -16,7 +16,6 @@
 
 #include "common.h"
 #include "eap_peer/eap_i.h"
-#include "config_ssid.h"
 #include "eap_common/eap_pax_common.h"
 #include "sha1.h"
 #include "crypto.h"
@@ -54,19 +53,20 @@
 
 static void * eap_pax_init(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
 	struct eap_pax_data *data;
-
-	if (config == NULL || !config->nai ||
-	    (!config->eappsk && !config->password)) {
-		wpa_printf(MSG_INFO, "EAP-PAX: CID (nai) or key "
-			   "(eappsk/password) not configured");
-		return NULL;
-	}
-
-	if (config->eappsk && config->eappsk_len != EAP_PAX_AK_LEN) {
-		wpa_printf(MSG_INFO, "EAP-PAX: incorrect key length (eappsk); "
-			   "expected %d", EAP_PAX_AK_LEN);
+	const u8 *identity, *password;
+	size_t identity_len, password_len;
+
+	identity = eap_get_config_identity(sm, &identity_len);
+	password = eap_get_config_password(sm, &password_len);
+	if (!identity || !password) {
+		wpa_printf(MSG_INFO, "EAP-PAX: CID (nai) or key (password) "
+			   "not configured");
+		return NULL;
+	}
+
+	if (password_len != EAP_PAX_AK_LEN) {
+		wpa_printf(MSG_INFO, "EAP-PAX: Invalid PSK length");
 		return NULL;
 	}
 
@@ -75,25 +75,15 @@
 		return NULL;
 	data->state = PAX_INIT;
 
-	data->cid = os_malloc(config->nai_len);
+	data->cid = os_malloc(identity_len);
 	if (data->cid == NULL) {
 		eap_pax_deinit(sm, data);
 		return NULL;
 	}
-	os_memcpy(data->cid, config->nai, config->nai_len);
-	data->cid_len = config->nai_len;
-
-	if (config->eappsk) {
-		os_memcpy(data->ak, config->eappsk, EAP_PAX_AK_LEN);
-	} else {
-		u8 hash[SHA1_MAC_LEN];
-		const unsigned char *addr[1];
-		size_t len[1];
-		addr[0] = config->password;
-		len[0] = config->password_len;
-		sha1_vector(1, addr, len, hash);
-		os_memcpy(data->ak, hash, EAP_PAX_AK_LEN);
-	}
+	os_memcpy(data->cid, identity, identity_len);
+	data->cid_len = identity_len;
+
+	os_memcpy(data->ak, password, EAP_PAX_AK_LEN);
 
 	return data;
 }

Modified: wpasupplicant/trunk/src/eap_peer/eap_peap.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_peap.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_peap.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_peap.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-PEAP (draft-josefsson-pppext-eap-tls-eap-07.txt)
- * Copyright (c) 2004-2006, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -17,7 +17,7 @@
 #include "common.h"
 #include "eap_i.h"
 #include "eap_tls_common.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "tls.h"
 #include "eap_tlv.h"
 
@@ -101,7 +101,7 @@
 static void * eap_peap_init(struct eap_sm *sm)
 {
 	struct eap_peap_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)
@@ -162,7 +162,7 @@
 	size_t len = be_to_host16(hdr->length);
 	u8 *pos;
 	struct eap_method_ret iret;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	if (len <= sizeof(struct eap_hdr)) {
 		wpa_printf(MSG_INFO, "EAP-PEAP: too short "

Modified: wpasupplicant/trunk/src/eap_peer/eap_psk.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_psk.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_psk.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_psk.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-PSK (RFC 4764)
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -19,7 +19,6 @@
 
 #include "common.h"
 #include "eap_peer/eap_i.h"
-#include "config_ssid.h"
 #include "aes_wrap.h"
 #include "eap_common/eap_psk_common.h"
 
@@ -37,18 +36,21 @@
 
 static void * eap_psk_init(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
 	struct eap_psk_data *data;
-
-	if (config == NULL || !config->eappsk) {
-		wpa_printf(MSG_INFO, "EAP-PSK: pre-shared key not configured");
+	const u8 *identity, *password;
+	size_t identity_len, password_len;
+
+	password = eap_get_config_password(sm, &password_len);
+	if (!password || password_len != 16) {
+		wpa_printf(MSG_INFO, "EAP-PSK: 16-octet pre-shared key not "
+			   "configured");
 		return NULL;
 	}
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)
 		return NULL;
-	if (eap_psk_key_setup(config->eappsk, data->ak, data->kdk)) {
+	if (eap_psk_key_setup(password, data->ak, data->kdk)) {
 		os_free(data);
 		return NULL;
 	}
@@ -56,11 +58,12 @@
 	wpa_hexdump_key(MSG_DEBUG, "EAP-PSK: KDK", data->kdk, EAP_PSK_KDK_LEN);
 	data->state = PSK_INIT;
 
-	if (config->nai) {
-		data->id_p = os_malloc(config->nai_len);
+	identity = eap_get_config_identity(sm, &identity_len);
+	if (identity) {
+		data->id_p = os_malloc(identity_len);
 		if (data->id_p)
-			os_memcpy(data->id_p, config->nai, config->nai_len);
-		data->id_p_len = config->nai_len;
+			os_memcpy(data->id_p, identity, identity_len);
+		data->id_p_len = identity_len;
 	}
 	if (data->id_p == NULL) {
 		wpa_printf(MSG_INFO, "EAP-PSK: could not get own identity");

Modified: wpasupplicant/trunk/src/eap_peer/eap_sake.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_sake.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_sake.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_sake.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-SAKE (RFC 4763)
- * Copyright (c) 2006-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2006-2008, 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
@@ -16,7 +16,6 @@
 
 #include "common.h"
 #include "eap_peer/eap_i.h"
-#include "config_ssid.h"
 #include "eap_common/eap_sake_common.h"
 
 struct eap_sake_data {
@@ -73,18 +72,14 @@
 
 static void * eap_sake_init(struct eap_sm *sm)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
 	struct eap_sake_data *data;
-
-	if (config == NULL) {
-		wpa_printf(MSG_INFO, "EAP-SAKE: No configuration found");
-		return NULL;
-	}
-
-	if (!config->eappsk ||
-	    config->eappsk_len != 2 * EAP_SAKE_ROOT_SECRET_LEN) {
-		wpa_printf(MSG_INFO, "EAP-SAKE: No key (eappsk) of correct "
-			   "length configured");
+	const u8 *identity, *password;
+	size_t identity_len, password_len;
+
+	password = eap_get_config_password(sm, &password_len);
+	if (!password || password_len != 2 * EAP_SAKE_ROOT_SECRET_LEN) {
+		wpa_printf(MSG_INFO, "EAP-SAKE: No key of correct length "
+			   "configured");
 		return NULL;
 	}
 
@@ -93,20 +88,20 @@
 		return NULL;
 	data->state = IDENTITY;
 
-	if (config->nai) {
-		data->peerid = os_malloc(config->nai_len);
+	identity = eap_get_config_identity(sm, &identity_len);
+	if (identity) {
+		data->peerid = os_malloc(identity_len);
 		if (data->peerid == NULL) {
 			eap_sake_deinit(sm, data);
 			return NULL;
 		}
-		os_memcpy(data->peerid, config->nai, config->nai_len);
-		data->peerid_len = config->nai_len;
-	}
-
-	os_memcpy(data->root_secret_a, config->eappsk,
-		  EAP_SAKE_ROOT_SECRET_LEN);
+		os_memcpy(data->peerid, identity, identity_len);
+		data->peerid_len = identity_len;
+	}
+
+	os_memcpy(data->root_secret_a, password, EAP_SAKE_ROOT_SECRET_LEN);
 	os_memcpy(data->root_secret_b,
-		  config->eappsk + EAP_SAKE_ROOT_SECRET_LEN,
+		  password + EAP_SAKE_ROOT_SECRET_LEN,
 		  EAP_SAKE_ROOT_SECRET_LEN);
 
 	return data;

Modified: wpasupplicant/trunk/src/eap_peer/eap_sim.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_sim.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_sim.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_sim.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-SIM (RFC 4186)
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -16,7 +16,7 @@
 
 #include "common.h"
 #include "eap_peer/eap_i.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "pcsc_funcs.h"
 #include "eap_common/eap_sim_common.h"
 
@@ -86,7 +86,7 @@
 static void * eap_sim_init(struct eap_sm *sm)
 {
 	struct eap_sim_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	data = os_zalloc(sizeof(*data));
 	if (data == NULL)

Modified: wpasupplicant/trunk/src/eap_peer/eap_tls.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_tls.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_tls.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_tls.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-TLS (RFC 2716)
- * Copyright (c) 2004-2006, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -17,7 +17,7 @@
 #include "common.h"
 #include "eap_i.h"
 #include "eap_tls_common.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "tls.h"
 
 
@@ -33,7 +33,7 @@
 static void * eap_tls_init(struct eap_sm *sm)
 {
 	struct eap_tls_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	if (config == NULL ||
 	    ((sm->init_phase2 ? config->private_key2 : config->private_key)
 	    == NULL && config->engine == 0)) {
@@ -89,7 +89,7 @@
 	ret->decision = DECISION_FAIL;
 
 	if (res == -1) {
-		struct wpa_ssid *config = eap_get_config(sm);
+		struct eap_peer_config *config = eap_get_config(sm);
 		if (config) {
 			/*
 			 * The TLS handshake failed. So better forget the old

Modified: wpasupplicant/trunk/src/eap_peer/eap_tls_common.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_tls_common.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_tls_common.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_tls_common.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer: EAP-TLS/PEAP/TTLS/FAST common functions
- * Copyright (c) 2004-2006, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -17,8 +17,7 @@
 #include "common.h"
 #include "eap_i.h"
 #include "eap_tls_common.h"
-#include "config_blob.h"
-#include "config_ssid.h"
+#include "eap_config.h"
 #include "sha1.h"
 #include "tls.h"
 
@@ -47,7 +46,7 @@
 
 
 static void eap_tls_params_from_conf1(struct tls_connection_params *params,
-				      struct wpa_ssid *config)
+				      struct eap_peer_config *config)
 {
 	params->ca_cert = (char *) config->ca_cert;
 	params->ca_path = (char *) config->ca_path;
@@ -64,7 +63,7 @@
 
 
 static void eap_tls_params_from_conf2(struct tls_connection_params *params,
-				      struct wpa_ssid *config)
+				      struct eap_peer_config *config)
 {
 	params->ca_cert = (char *) config->ca_cert2;
 	params->ca_path = (char *) config->ca_path2;
@@ -80,7 +79,7 @@
 static int eap_tls_params_from_conf(struct eap_sm *sm,
 				    struct eap_ssl_data *data,
 				    struct tls_connection_params *params,
-				    struct wpa_ssid *config, int phase2)
+				    struct eap_peer_config *config, int phase2)
 {
 	os_memset(params, 0, sizeof(*params));
 	params->engine = config->engine;
@@ -114,7 +113,7 @@
 
 static int eap_tls_init_connection(struct eap_sm *sm,
 				   struct eap_ssl_data *data,
-				   struct wpa_ssid *config,
+				   struct eap_peer_config *config,
 				   struct tls_connection_params *params)
 {
 	int res;
@@ -167,7 +166,7 @@
  * EAP-PEAP, EAP-TTLS, and EAP-FAST.
  */
 int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
-			  struct wpa_ssid *config)
+			  struct eap_peer_config *config)
 {
 	struct tls_connection_params params;
 
@@ -898,7 +897,8 @@
  * This function is used to parse EAP method list and select allowed methods
  * for Phase2 authentication.
  */
-int eap_peer_select_phase2_methods(struct wpa_ssid *config, const char *prefix,
+int eap_peer_select_phase2_methods(struct eap_peer_config *config,
+				   const char *prefix,
 				   struct eap_method_type **types,
 				   size_t *num_types)
 {

Modified: wpasupplicant/trunk/src/eap_peer/eap_tls_common.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_tls_common.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_tls_common.h (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_tls_common.h Fri Feb  1 14:38:48 2008
@@ -98,7 +98,7 @@
 
 
 int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
-			  struct wpa_ssid *config);
+			  struct eap_peer_config *config);
 void eap_peer_tls_ssl_deinit(struct eap_sm *sm, struct eap_ssl_data *data);
 u8 * eap_peer_tls_derive_key(struct eap_sm *sm, struct eap_ssl_data *data,
 			     const char *label, size_t len);
@@ -129,7 +129,8 @@
 			 EapType eap_type, int peap_version, u8 id,
 			 const struct wpabuf *in_data,
 			 struct wpabuf **out_data);
-int eap_peer_select_phase2_methods(struct wpa_ssid *config, const char *prefix,
+int eap_peer_select_phase2_methods(struct eap_peer_config *config,
+				   const char *prefix,
 				   struct eap_method_type **types,
 				   size_t *num_types);
 int eap_peer_tls_phase2_nak(struct eap_method_type *types, size_t num_types,

Modified: wpasupplicant/trunk/src/eap_peer/eap_ttls.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/eap_ttls.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/eap_ttls.c (original)
+++ wpasupplicant/trunk/src/eap_peer/eap_ttls.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-TTLS (draft-ietf-pppext-eap-ttls-03.txt)
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -17,11 +17,12 @@
 #include "common.h"
 #include "eap_peer/eap_i.h"
 #include "eap_peer/eap_tls_common.h"
-#include "config_ssid.h"
+#include "eap_peer/eap_config.h"
 #include "ms_funcs.h"
 #include "sha1.h"
 #include "eap_common/chap.h"
 #include "tls.h"
+#include "mschapv2.h"
 #include "eap_common/eap_ttls.h"
 
 
@@ -35,6 +36,7 @@
 
 
 #define MSCHAPV2_KEY_LEN 16
+#define MSCHAPV2_NT_RESPONSE_LEN 24
 
 
 static void eap_ttls_deinit(struct eap_sm *sm, void *priv);
@@ -51,7 +53,7 @@
 	int phase2_success;
 	int phase2_start;
 
-	enum {
+	enum phase2_types {
 		EAP_TTLS_PHASE2_EAP,
 		EAP_TTLS_PHASE2_MSCHAPV2,
 		EAP_TTLS_PHASE2_MSCHAP,
@@ -62,8 +64,9 @@
 	struct eap_method_type *phase2_eap_types;
 	size_t num_phase2_eap_types;
 
-	u8 auth_response[20];
+	u8 auth_response[MSCHAPV2_AUTH_RESPONSE_LEN];
 	int auth_response_valid;
+	u8 master_key[MSCHAPV2_MASTER_KEY_LEN]; /* MSCHAPv2 master key */
 	u8 ident;
 	int resuming; /* starting a resumed session */
 	int reauth; /* reauthentication */
@@ -81,7 +84,7 @@
 static void * eap_ttls_init(struct eap_sm *sm)
 {
 	struct eap_ttls_data *data;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	char *selected;
 
 	data = os_zalloc(sizeof(*data));
@@ -155,13 +158,23 @@
 }
 
 
+static void eap_ttls_phase2_eap_deinit(struct eap_sm *sm,
+				       struct eap_ttls_data *data)
+{
+	if (data->phase2_priv && data->phase2_method) {
+		data->phase2_method->deinit(sm, data->phase2_priv);
+		data->phase2_method = NULL;
+		data->phase2_priv = NULL;
+	}
+}
+
+
 static void eap_ttls_deinit(struct eap_sm *sm, void *priv)
 {
 	struct eap_ttls_data *data = priv;
 	if (data == NULL)
 		return;
-	if (data->phase2_priv && data->phase2_method)
-		data->phase2_method->deinit(sm, data->phase2_priv);
+	eap_ttls_phase2_eap_deinit(sm, data);
 	os_free(data->phase2_eap_types);
 	if (data->ssl_initialized)
 		eap_peer_tls_ssl_deinit(sm, &data->ssl);
@@ -460,91 +473,15 @@
 }
 
 
-static int eap_ttls_phase2_request_eap_method(struct eap_sm *sm,
-					      struct eap_ttls_data *data,
-					      struct eap_method_ret *ret,
-					      struct eap_hdr *hdr, size_t len,
-					      u8 method, struct wpabuf **resp)
-{
+static int eap_ttls_phase2_eap_process(struct eap_sm *sm,
+				       struct eap_ttls_data *data,
+				       struct eap_method_ret *ret,
+				       struct eap_hdr *hdr, size_t len,
+				       struct wpabuf **resp)
+{
+	struct wpabuf msg;
 	struct eap_method_ret iret;
-	struct wpabuf msg;
-
-#ifdef EAP_TNC
-	if (data->tnc_started && data->phase2_method &&
-	    data->phase2_priv && method == EAP_TYPE_TNC &&
-	    data->phase2_eap_type.method == EAP_TYPE_TNC)
-		goto process;
-
-	if (data->ready_for_tnc && !data->tnc_started &&
-	    method == EAP_TYPE_TNC) {
-		wpa_printf(MSG_DEBUG, "EAP-TTLS: Start TNC after completed "
-			   "EAP method");
-		data->tnc_started = 1;
-	}
-
-	if (data->tnc_started) {
-		if (data->phase2_eap_type.vendor != EAP_VENDOR_IETF ||
-		    data->phase2_eap_type.method == EAP_TYPE_TNC) {
-			wpa_printf(MSG_DEBUG, "EAP-TTLS: Unexpected EAP "
-				   "type %d for TNC", method);
-			return -1;
-		}
-
-		data->phase2_eap_type.vendor = EAP_VENDOR_IETF;
-		data->phase2_eap_type.method = method;
-		wpa_printf(MSG_DEBUG, "EAP-TTLS: Selected "
-			   "Phase 2 EAP vendor %d method %d (TNC)",
-			   data->phase2_eap_type.vendor,
-			   data->phase2_eap_type.method);
-
-		if (data->phase2_type == EAP_TTLS_PHASE2_EAP &&
-		    data->phase2_priv && data->phase2_method) {
-			data->phase2_method->deinit(sm, data->phase2_priv);
-			data->phase2_method = NULL;
-			data->phase2_priv = NULL;
-		}
-
-		goto init;
-	}
-#endif /* EAP_TNC */
-
-	if (data->phase2_eap_type.vendor == EAP_VENDOR_IETF &&
-	    data->phase2_eap_type.method == EAP_TYPE_NONE)
-		eap_ttls_phase2_select_eap_method(data, method);
-
-	if (method != data->phase2_eap_type.method || method == EAP_TYPE_NONE)
-	{
-		if (eap_peer_tls_phase2_nak(data->phase2_eap_types,
-					    data->num_phase2_eap_types,
-					    hdr, resp))
-			return -1;
-		return 0;
-	}
-
-#ifdef EAP_TNC
-init:
-#endif /* EAP_TNC */
-
-	if (data->phase2_priv == NULL) {
-		data->phase2_method = eap_peer_get_eap_method(
-			EAP_VENDOR_IETF, method);
-		if (data->phase2_method) {
-			sm->init_phase2 = 1;
-			sm->mschapv2_full_key = 1;
-			data->phase2_priv = data->phase2_method->init(sm);
-			sm->init_phase2 = 0;
-			sm->mschapv2_full_key = 0;
-		}
-	}
-	if (data->phase2_priv == NULL || data->phase2_method == NULL) {
-		wpa_printf(MSG_INFO, "EAP-TTLS: failed to initialize "
-			   "Phase 2 EAP method %d", method);
-		return -1;
-	}
-
-#ifdef EAP_TNC
-process:
-#endif /* EAP_TNC */
+
 	os_memset(&iret, 0, sizeof(iret));
 	wpabuf_set(&msg, hdr, len);
 	*resp = data->phase2_method->process(sm, data->phase2_priv, &iret,
@@ -563,6 +500,80 @@
 }
 
 
+static int eap_ttls_phase2_request_eap_method(struct eap_sm *sm,
+					      struct eap_ttls_data *data,
+					      struct eap_method_ret *ret,
+					      struct eap_hdr *hdr, size_t len,
+					      u8 method, struct wpabuf **resp)
+{
+#ifdef EAP_TNC
+	if (data->tnc_started && data->phase2_method &&
+	    data->phase2_priv && method == EAP_TYPE_TNC &&
+	    data->phase2_eap_type.method == EAP_TYPE_TNC)
+		return eap_ttls_phase2_eap_process(sm, data, ret, hdr, len,
+						   resp);
+
+	if (data->ready_for_tnc && !data->tnc_started &&
+	    method == EAP_TYPE_TNC) {
+		wpa_printf(MSG_DEBUG, "EAP-TTLS: Start TNC after completed "
+			   "EAP method");
+		data->tnc_started = 1;
+	}
+
+	if (data->tnc_started) {
+		if (data->phase2_eap_type.vendor != EAP_VENDOR_IETF ||
+		    data->phase2_eap_type.method == EAP_TYPE_TNC) {
+			wpa_printf(MSG_DEBUG, "EAP-TTLS: Unexpected EAP "
+				   "type %d for TNC", method);
+			return -1;
+		}
+
+		data->phase2_eap_type.vendor = EAP_VENDOR_IETF;
+		data->phase2_eap_type.method = method;
+		wpa_printf(MSG_DEBUG, "EAP-TTLS: Selected "
+			   "Phase 2 EAP vendor %d method %d (TNC)",
+			   data->phase2_eap_type.vendor,
+			   data->phase2_eap_type.method);
+
+		if (data->phase2_type == EAP_TTLS_PHASE2_EAP)
+			eap_ttls_phase2_eap_deinit(sm, data);
+	}
+#endif /* EAP_TNC */
+
+	if (data->phase2_eap_type.vendor == EAP_VENDOR_IETF &&
+	    data->phase2_eap_type.method == EAP_TYPE_NONE)
+		eap_ttls_phase2_select_eap_method(data, method);
+
+	if (method != data->phase2_eap_type.method || method == EAP_TYPE_NONE)
+	{
+		if (eap_peer_tls_phase2_nak(data->phase2_eap_types,
+					    data->num_phase2_eap_types,
+					    hdr, resp))
+			return -1;
+		return 0;
+	}
+
+	if (data->phase2_priv == NULL) {
+		data->phase2_method = eap_peer_get_eap_method(
+			EAP_VENDOR_IETF, method);
+		if (data->phase2_method) {
+			sm->init_phase2 = 1;
+			sm->mschapv2_full_key = 1;
+			data->phase2_priv = data->phase2_method->init(sm);
+			sm->init_phase2 = 0;
+			sm->mschapv2_full_key = 0;
+		}
+	}
+	if (data->phase2_priv == NULL || data->phase2_method == NULL) {
+		wpa_printf(MSG_INFO, "EAP-TTLS: failed to initialize "
+			   "Phase 2 EAP method %d", method);
+		return -1;
+	}
+
+	return eap_ttls_phase2_eap_process(sm, data, ret, hdr, len, resp);
+}
+
+
 static int eap_ttls_phase2_request_eap(struct eap_sm *sm,
 				       struct eap_ttls_data *data,
 				       struct eap_method_ret *ret,
@@ -571,7 +582,7 @@
 {
 	size_t len = be_to_host16(hdr->length);
 	u8 *pos;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	if (len <= sizeof(struct eap_hdr)) {
 		wpa_printf(MSG_INFO, "EAP-TTLS: too short "
@@ -607,33 +618,18 @@
 
 
 static void eap_ttlsv1_permute_inner(struct eap_sm *sm,
-				     struct eap_ttls_data *data,
-				     const u8 *nt_response)
+				     struct eap_ttls_data *data)
 {
 #if EAP_TTLS_VERSION > 0
-	u8 pw_hash[16], pw_hash_hash[16], master_key[16];
 	u8 session_key[2 * MSCHAPV2_KEY_LEN];
-	const u8 *password;
-	size_t password_len;
-	int pwhash;
 
 	if (data->ttls_version == 0)
 		return;
 
-	password = eap_get_config_password2(sm, &password_len, &pwhash);
-	if (password == NULL)
-		return;
-
-	if (pwhash)
-		hash_nt_password_hash(password, pw_hash_hash);
-	else {
-		nt_password_hash(password, password_len, pw_hash);
-		hash_nt_password_hash(pw_hash, pw_hash_hash);
-	}
-	get_master_key(pw_hash_hash, nt_response, master_key);
-	get_asymetric_start_key(master_key, session_key,
+	get_asymetric_start_key(data->master_key, session_key,
 				MSCHAPV2_KEY_LEN, 0, 0);
-	get_asymetric_start_key(master_key, session_key + MSCHAPV2_KEY_LEN,
+	get_asymetric_start_key(data->master_key,
+				session_key + MSCHAPV2_KEY_LEN,
 				MSCHAPV2_KEY_LEN, 1, 0);
 	eap_ttls_ia_permute_inner_secret(sm, data, session_key,
 					 sizeof(session_key));
@@ -648,28 +644,16 @@
 {
 	struct wpabuf *msg;
 	u8 *buf, *pos, *challenge, *peer_challenge;
-	const u8 *identity, *username, *password;
-	size_t identity_len, password_len, username_len, i;
+	const u8 *identity, *password;
+	size_t identity_len, password_len;
 	int pwhash;
 
 	wpa_printf(MSG_DEBUG, "EAP-TTLS: Phase 2 MSCHAPV2 Request");
 
-	/* MSCHAPv2 does not include optional domain name in the
-	 * challenge-response calculation, so remove domain prefix
-	 * (if present). */
 	identity = eap_get_config_identity(sm, &identity_len);
 	password = eap_get_config_password2(sm, &password_len, &pwhash);
 	if (identity == NULL || password == NULL)
 		return -1;
-	username = identity;
-	username_len = identity_len;
-	for (i = 0; i < username_len; i++) {
-		if (username[i] == '\\') {
-			username_len -= i + 1;
-			username += i + 1;
-			break;
-		}
-	}
 
 	msg = wpabuf_alloc(identity_len + 1000);
 	if (msg == NULL) {
@@ -709,37 +693,13 @@
 	pos += EAP_TTLS_MSCHAPV2_CHALLENGE_LEN;
 	os_memset(pos, 0, 8); /* Reserved, must be zero */
 	pos += 8;
-	wpa_hexdump(MSG_DEBUG, "EAP-TTLS: MSCHAPV2: implicit auth_challenge",
-		    challenge, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN);
-	wpa_hexdump(MSG_DEBUG, "EAP-TTLS: MSCHAPV2: peer_challenge",
-		    peer_challenge, EAP_TTLS_MSCHAPV2_CHALLENGE_LEN);
-	wpa_hexdump_ascii(MSG_DEBUG, "EAP-TTLS: MSCHAPV2 username",
-			  username, username_len);
-	if (pwhash) {
-		wpa_hexdump_key(MSG_DEBUG, "EAP-TTLS: MSCHAPV2 password hash",
-				password, 16);
-		generate_nt_response_pwhash(challenge, peer_challenge,
-					    username, username_len,
-					    password, pos);
-		wpa_hexdump(MSG_DEBUG, "EAP-TTLS: MSCHAPV2 response", pos, 24);
-		generate_authenticator_response_pwhash(
-			password, peer_challenge, challenge,
-			username, username_len, pos, data->auth_response);
-	} else {
-		wpa_hexdump_ascii_key(MSG_DEBUG, "EAP-TTLS: MSCHAPV2 password",
-				      password, password_len);
-		generate_nt_response(challenge, peer_challenge,
-				     username, username_len,
-				     password, password_len, pos);
-		wpa_hexdump(MSG_DEBUG, "EAP-TTLS: MSCHAPV2 response", pos, 24);
-		generate_authenticator_response(password, password_len,
-						peer_challenge, challenge,
-						username, username_len,
-						pos, data->auth_response);
-	}
+	mschapv2_derive_response(identity, identity_len, password,
+				 password_len, pwhash, challenge,
+				 peer_challenge, pos, data->auth_response,
+				 data->master_key);
 	data->auth_response_valid = 1;
 
-	eap_ttlsv1_permute_inner(sm, data, pos);
+	eap_ttlsv1_permute_inner(sm, data);
 
 	pos += 24;
 	os_free(challenge);
@@ -1001,11 +961,19 @@
 {
 	int res = 0;
 	size_t len;
-
-	if (data->phase2_type == EAP_TTLS_PHASE2_MSCHAPV2 ||
-	    data->phase2_type == EAP_TTLS_PHASE2_MSCHAP ||
-	    data->phase2_type == EAP_TTLS_PHASE2_PAP ||
-	    data->phase2_type == EAP_TTLS_PHASE2_CHAP) {
+	enum phase2_types phase2_type = data->phase2_type;
+
+#ifdef EAP_TNC
+	if (data->tnc_started) {
+		wpa_printf(MSG_DEBUG, "EAP-TTLS: Processing TNC");
+		phase2_type = EAP_TTLS_PHASE2_EAP;
+	}
+#endif /* EAP_TNC */
+
+	if (phase2_type == EAP_TTLS_PHASE2_MSCHAPV2 ||
+	    phase2_type == EAP_TTLS_PHASE2_MSCHAP ||
+	    phase2_type == EAP_TTLS_PHASE2_PAP ||
+	    phase2_type == EAP_TTLS_PHASE2_CHAP) {
 		if (eap_get_config_identity(sm, &len) == NULL) {
 			wpa_printf(MSG_INFO,
 				   "EAP-TTLS: Identity not configured");
@@ -1022,14 +990,6 @@
 			return 0;
 		}
 	}
-
-#ifdef EAP_TNC
-	if (data->tnc_started) {
-		wpa_printf(MSG_DEBUG, "EAP-TTLS: Processing TNC");
-		res = eap_ttls_phase2_request_eap(sm, data, ret, hdr, resp);
-		goto done;
-	}
-#endif /* EAP_TNC */
 
 	switch (data->phase2_type) {
 	case EAP_TTLS_PHASE2_EAP:
@@ -1052,10 +1012,6 @@
 		res = -1;
 		break;
 	}
-
-#ifdef EAP_TNC
-done:
-#endif /* EAP_TNC */
 
 	if (res < 0) {
 		ret->methodState = METHOD_DONE;
@@ -1368,8 +1324,6 @@
 					    struct eap_method_ret *ret,
 					    struct ttls_parse_avp *parse)
 {
-	u8 recv_response[20];
-
 	if (parse->mschapv2_error) {
 		wpa_printf(MSG_DEBUG, "EAP-TTLS/MSCHAPV2: Received "
 			   "MS-CHAP-Error - failed");
@@ -1391,9 +1345,8 @@
 		return -1;
 	}
 	if (!data->auth_response_valid ||
-	    parse->mschapv2[1] != 'S' || parse->mschapv2[2] != '=' ||
-	    hexstr2bin((char *) (parse->mschapv2 + 3), recv_response, 20) ||
-	    os_memcmp(data->auth_response, recv_response, 20) != 0) {
+	    mschapv2_verify_auth_response(data->auth_response,
+					  parse->mschapv2 + 1, 42)) {
 		wpa_printf(MSG_WARNING, "EAP-TTLS: Invalid authenticator "
 			   "response in Phase 2 MSCHAPV2 success request");
 		return -1;
@@ -1464,10 +1417,16 @@
 				      struct wpabuf **out_data)
 {
 	struct wpabuf *resp = NULL;
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 	int res;
-
-	switch (data->phase2_type) {
+	enum phase2_types phase2_type = data->phase2_type;
+
+#ifdef EAP_TNC
+	if (data->tnc_started)
+		phase2_type = EAP_TTLS_PHASE2_EAP;
+#endif /* EAP_TNC */
+
+	switch (phase2_type) {
 	case EAP_TTLS_PHASE2_EAP:
 		if (eap_ttls_process_phase2_eap(sm, data, ret, parse, &resp) <
 		    0)
@@ -1697,7 +1656,7 @@
 				  struct eap_ttls_data *data, u8 flags,
 				  struct eap_method_ret *ret)
 {
-	struct wpa_ssid *config = eap_get_config(sm);
+	struct eap_peer_config *config = eap_get_config(sm);
 
 	wpa_printf(MSG_DEBUG, "EAP-TTLS: Start (server ver=%d, own ver=%d)",
 		   flags & EAP_PEAP_VERSION_MASK, data->ttls_version);

Modified: wpasupplicant/trunk/src/eap_peer/ikev2.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_peer/ikev2.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_peer/ikev2.c (original)
+++ wpasupplicant/trunk/src/eap_peer/ikev2.c Fri Feb  1 14:38:48 2008
@@ -429,8 +429,8 @@
 	 */
 	if (kei_len - 4 != data->dh->prime_len) {
 		wpa_printf(MSG_INFO, "IKEV2: Invalid DH public value length "
-			   "%d (expected %d)",
-			   kei_len - 4, data->dh->prime_len);
+			   "%ld (expected %ld)",
+			   (long) (kei_len - 4), (long) data->dh->prime_len);
 		return -1;
 	}
 
@@ -456,7 +456,8 @@
 	}
 
 	if (ni_len < IKEV2_NONCE_MIN_LEN || ni_len > IKEV2_NONCE_MAX_LEN) {
-		wpa_printf(MSG_INFO, "IKEV2: Invalid Ni length %d", ni_len);
+		wpa_printf(MSG_INFO, "IKEV2: Invalid Ni length %ld",
+		           (long) ni_len);
 		return -1;
 	}
 

Modified: wpasupplicant/trunk/src/eap_server/eap.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap.c (original)
+++ wpasupplicant/trunk/src/eap_server/eap.c Fri Feb  1 14:38:48 2008
@@ -1154,6 +1154,7 @@
 	if (conf->eap_fast_a_id)
 		sm->eap_fast_a_id = os_strdup(conf->eap_fast_a_id);
 	sm->eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind;
+	sm->wps = conf->wps;
 
 	wpa_printf(MSG_DEBUG, "EAP: Server state machine created");
 

Modified: wpasupplicant/trunk/src/eap_server/eap.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap.h (original)
+++ wpasupplicant/trunk/src/eap_server/eap.h Fri Feb  1 14:38:48 2008
@@ -97,6 +97,7 @@
 	u8 *pac_opaque_encr_key;
 	char *eap_fast_a_id;
 	int eap_sim_aka_result_ind;
+	struct wps_context *wps;
 };
 
 

Modified: wpasupplicant/trunk/src/eap_server/eap_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap_i.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap_i.h (original)
+++ wpasupplicant/trunk/src/eap_server/eap_i.h Fri Feb  1 14:38:48 2008
@@ -172,6 +172,7 @@
 	u8 *pac_opaque_encr_key;
 	char *eap_fast_a_id;
 	int eap_sim_aka_result_ind;
+	struct wps_context *wps;
 };
 
 int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len,

Modified: wpasupplicant/trunk/src/eap_server/eap_ikev2.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/eap_ikev2.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/eap_ikev2.c (original)
+++ wpasupplicant/trunk/src/eap_server/eap_ikev2.c Fri Feb  1 14:38:48 2008
@@ -383,8 +383,8 @@
 
 		if (message_length < (u32) (end - pos)) {
 			wpa_printf(MSG_DEBUG, "EAP-IKEV2: Invalid Message "
-				   "Length (%d; %d remaining in this msg)",
-				   message_length, end - pos);
+				   "Length (%d; %ld remaining in this msg)",
+				   message_length, (long) (end - pos));
 			eap_ikev2_state(data, FAIL);
 			return;
 		}

Modified: wpasupplicant/trunk/src/eap_server/ikev2.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eap_server/ikev2.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eap_server/ikev2.c (original)
+++ wpasupplicant/trunk/src/eap_server/ikev2.c Fri Feb  1 14:38:48 2008
@@ -408,8 +408,8 @@
 	 */
 	if (ker_len - 4 != data->dh->prime_len) {
 		wpa_printf(MSG_INFO, "IKEV2: Invalid DH public value length "
-			   "%d (expected %d)",
-			   ker_len - 4, data->dh->prime_len);
+			   "%ld (expected %ld)",
+			   (long) (ker_len - 4), (long) data->dh->prime_len);
 		return -1;
 	}
 
@@ -434,7 +434,8 @@
 	}
 
 	if (nr_len < IKEV2_NONCE_MIN_LEN || nr_len > IKEV2_NONCE_MAX_LEN) {
-		wpa_printf(MSG_INFO, "IKEV2: Invalid Nr length %d", nr_len);
+		wpa_printf(MSG_INFO, "IKEV2: Invalid Nr length %ld",
+			   (long) nr_len);
 		return -1;
 	}
 

Modified: wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.c (original)
+++ wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAPOL supplicant state machines
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -126,7 +126,7 @@
 	/* Miscellaneous variables (not defined in IEEE 802.1X-2004) */
 	Boolean changed;
 	struct eap_sm *eap;
-	struct wpa_ssid *config;
+	struct eap_peer_config *config;
 	Boolean initial_req;
 	u8 *last_rx_key;
 	size_t last_rx_key_len;
@@ -1325,7 +1325,7 @@
 /**
  * eapol_sm_notify_config - Notification of EAPOL configuration change
  * @sm: Pointer to EAPOL state machine allocated with eapol_sm_init()
- * @config: Pointer to current network configuration
+ * @config: Pointer to current network EAP configuration
  * @conf: Pointer to EAPOL configuration data
  *
  * Notify EAPOL state machine that configuration has changed. config will be
@@ -1334,7 +1334,8 @@
  * data. If conf is %NULL, this part of the configuration change will be
  * skipped.
  */
-void eapol_sm_notify_config(struct eapol_sm *sm, struct wpa_ssid *config,
+void eapol_sm_notify_config(struct eapol_sm *sm,
+			    struct eap_peer_config *config,
 			    const struct eapol_config *conf)
 {
 	if (sm == NULL)
@@ -1574,7 +1575,7 @@
 }
 
 
-static struct wpa_ssid * eapol_sm_get_config(void *ctx)
+static struct eap_peer_config * eapol_sm_get_config(void *ctx)
 {
 	struct eapol_sm *sm = ctx;
 	return sm ? sm->config : NULL;
@@ -1726,6 +1727,20 @@
 }
 
 
+#if defined(CONFIG_CTRL_IFACE) || !defined(CONFIG_NO_STDOUT_DEBUG)
+static void eapol_sm_eap_param_needed(void *ctx, const char *field,
+				      const char *txt)
+{
+	struct eapol_sm *sm = ctx;
+	wpa_printf(MSG_DEBUG, "EAPOL: EAP parameter needed");
+	if (sm->ctx->eap_param_needed)
+		sm->ctx->eap_param_needed(sm->ctx->ctx, field, txt);
+}
+#else /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
+#define eapol_sm_eap_param_needed NULL
+#endif /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
+
+
 static struct eapol_callbacks eapol_cb =
 {
 	eapol_sm_get_config,
@@ -1736,7 +1751,8 @@
 	eapol_sm_get_eapReqData,
 	eapol_sm_set_config_blob,
 	eapol_sm_get_config_blob,
-	eapol_sm_notify_pending
+	eapol_sm_notify_pending,
+	eapol_sm_eap_param_needed
 };
 
 

Modified: wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.h (original)
+++ wpasupplicant/trunk/src/eapol_supp/eapol_supp_sm.h Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * EAPOL supplicant state machines
- * Copyright (c) 2004-2005, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -199,10 +199,19 @@
 	 */
 	const char *pkcs11_module_path;
 #endif /* EAP_TLS_OPENSSL */
+
+	/**
+	 * eap_param_needed - Notify that EAP parameter is needed
+	 * @ctx: Callback context (ctx)
+	 * @field: Field name (e.g., "IDENTITY")
+	 * @txt: User readable text describing the required parameter
+	 */
+	void (*eap_param_needed)(void *ctx, const char *field,
+				 const char *txt);
 };
 
 
-struct wpa_ssid;
+struct eap_peer_config;
 
 #ifdef IEEE8021X_EAPOL
 struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx);
@@ -220,7 +229,8 @@
 void eapol_sm_notify_portValid(struct eapol_sm *sm, Boolean valid);
 void eapol_sm_notify_eap_success(struct eapol_sm *sm, Boolean success);
 void eapol_sm_notify_eap_fail(struct eapol_sm *sm, Boolean fail);
-void eapol_sm_notify_config(struct eapol_sm *sm, struct wpa_ssid *config,
+void eapol_sm_notify_config(struct eapol_sm *sm,
+			    struct eap_peer_config *config,
 			    const struct eapol_config *conf);
 int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len);
 void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff);
@@ -284,7 +294,7 @@
 {
 }
 static inline void eapol_sm_notify_config(struct eapol_sm *sm,
-					  struct wpa_ssid *config,
+					  struct eap_peer_config *config,
 					  struct eapol_config *conf)
 {
 }

Modified: wpasupplicant/trunk/src/radius/radius.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/radius/radius.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/radius/radius.c (original)
+++ wpasupplicant/trunk/src/radius/radius.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * hostapd / RADIUS message processing
- * Copyright (c) 2002-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2002-2008, 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
@@ -142,6 +142,7 @@
 	{ RADIUS_ATTR_CALLING_STATION_ID, "Calling-Station-Id",
 	  RADIUS_ATTR_TEXT },
 	{ RADIUS_ATTR_NAS_IDENTIFIER, "NAS-Identifier", RADIUS_ATTR_TEXT },
+	{ RADIUS_ATTR_PROXY_STATE, "Proxy-State", RADIUS_ATTR_UNDIST },
 	{ RADIUS_ATTR_ACCT_STATUS_TYPE, "Acct-Status-Type",
 	  RADIUS_ATTR_INT32 },
 	{ RADIUS_ATTR_ACCT_DELAY_TIME, "Acct-Delay-Time", RADIUS_ATTR_INT32 },
@@ -667,25 +668,21 @@
 int radius_msg_copy_attr(struct radius_msg *dst, struct radius_msg *src,
 			 u8 type)
 {
-	struct radius_attr_hdr *attr = NULL, *tmp;
+	struct radius_attr_hdr *attr;
 	size_t i;
+	int count = 0;
 
 	for (i = 0; i < src->attr_used; i++) {
-		tmp = radius_get_attr_hdr(src, i);
-		if (tmp->type == type) {
-			attr = tmp;
-			break;
+		attr = radius_get_attr_hdr(src, i);
+		if (attr->type == type) {
+			if (!radius_msg_add_attr(dst, type, (u8 *) (attr + 1),
+						 attr->length - sizeof(*attr)))
+				return -1;
+			count++;
 		}
 	}
 
-	if (attr == NULL)
-		return 0;
-
-	if (!radius_msg_add_attr(dst, type, (u8 *) (attr + 1),
-				 attr->length - sizeof(*attr)))
-		return -1;
-
-	return 1;
+	return count;
 }
 
 

Modified: wpasupplicant/trunk/src/radius/radius.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/radius/radius.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/radius/radius.h (original)
+++ wpasupplicant/trunk/src/radius/radius.h Fri Feb  1 14:38:48 2008
@@ -63,6 +63,7 @@
        RADIUS_ATTR_CALLED_STATION_ID = 30,
        RADIUS_ATTR_CALLING_STATION_ID = 31,
        RADIUS_ATTR_NAS_IDENTIFIER = 32,
+       RADIUS_ATTR_PROXY_STATE = 33,
        RADIUS_ATTR_ACCT_STATUS_TYPE = 40,
        RADIUS_ATTR_ACCT_DELAY_TIME = 41,
        RADIUS_ATTR_ACCT_INPUT_OCTETS = 42,

Modified: wpasupplicant/trunk/src/radius/radius_client.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/radius/radius_client.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/radius/radius_client.c (original)
+++ wpasupplicant/trunk/src/radius/radius_client.c Fri Feb  1 14:38:48 2008
@@ -452,6 +452,13 @@
 	}
 
 	if (msg_type == RADIUS_ACCT || msg_type == RADIUS_ACCT_INTERIM) {
+		if (conf->acct_server == NULL) {
+			hostapd_logger(radius->ctx, NULL,
+				       HOSTAPD_MODULE_RADIUS,
+				       HOSTAPD_LEVEL_INFO,
+				       "No accounting server configured");
+			return -1;
+		}
 		shared_secret = conf->acct_server->shared_secret;
 		shared_secret_len = conf->acct_server->shared_secret_len;
 		radius_msg_finish_acct(msg, shared_secret, shared_secret_len);
@@ -459,6 +466,13 @@
 		s = radius->acct_sock;
 		conf->acct_server->requests++;
 	} else {
+		if (conf->auth_server == NULL) {
+			hostapd_logger(radius->ctx, NULL,
+				       HOSTAPD_MODULE_RADIUS,
+				       HOSTAPD_LEVEL_INFO,
+				       "No authentication server configured");
+			return -1;
+		}
 		shared_secret = conf->auth_server->shared_secret;
 		shared_secret_len = conf->auth_server->shared_secret_len;
 		radius_msg_finish(msg, shared_secret, shared_secret_len);

Modified: wpasupplicant/trunk/src/radius/radius_server.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/radius/radius_server.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/radius/radius_server.c (original)
+++ wpasupplicant/trunk/src/radius/radius_server.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * hostapd / RADIUS authentication server
- * Copyright (c) 2005-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2005-2008, 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
@@ -87,6 +87,7 @@
 	u8 *pac_opaque_encr_key;
 	char *eap_fast_a_id;
 	int eap_sim_aka_result_ind;
+	struct wps_context *wps;
 	int ipv6;
 	struct os_time start_time;
 	struct radius_server_counters counters;
@@ -311,6 +312,7 @@
 	eap_conf.pac_opaque_encr_key = data->pac_opaque_encr_key;
 	eap_conf.eap_fast_a_id = data->eap_fast_a_id;
 	eap_conf.eap_sim_aka_result_ind = data->eap_sim_aka_result_ind;
+	eap_conf.wps = data->wps;
 	sess->eap = eap_server_sm_init(sess, &radius_server_eapol_cb,
 				       &eap_conf);
 	if (sess->eap == NULL) {
@@ -386,6 +388,13 @@
 		}
 	}
 
+	if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) {
+		RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)");
+		radius_msg_free(msg);
+		os_free(msg);
+		return NULL;
+	}
+
 	if (radius_msg_finish_srv(msg, (u8 *) client->shared_secret,
 				  client->shared_secret_len,
 				  request->hdr->authenticator) < 0) {
@@ -424,6 +433,12 @@
 		RADIUS_DEBUG("Failed to add EAP-Message attribute");
 	}
 
+	if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) {
+		RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)");
+		radius_msg_free(msg);
+		os_free(msg);
+		return -1;
+	}
 
 	if (radius_msg_finish_srv(msg, (u8 *) client->shared_secret,
 				  client->shared_secret_len,
@@ -1003,6 +1018,7 @@
 		data->eap_fast_a_id = os_strdup(conf->eap_fast_a_id);
 	data->get_eap_user = conf->get_eap_user;
 	data->eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind;
+	data->wps = conf->wps;
 
 	data->clients = radius_server_read_clients(conf->client_file,
 						   conf->ipv6);

Modified: wpasupplicant/trunk/src/radius/radius_server.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/radius/radius_server.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/radius/radius_server.h (original)
+++ wpasupplicant/trunk/src/radius/radius_server.h Fri Feb  1 14:38:48 2008
@@ -27,6 +27,7 @@
 	u8 *pac_opaque_encr_key;
 	char *eap_fast_a_id;
 	int eap_sim_aka_result_ind;
+	struct wps_context *wps;
 	int ipv6;
 	int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
 			    int phase2, struct eap_user *user);

Modified: wpasupplicant/trunk/src/rsn_supp/peerkey.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/peerkey.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/peerkey.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/peerkey.c Fri Feb  1 14:38:48 2008
@@ -18,7 +18,6 @@
 
 #include "common.h"
 #include "sha1.h"
-#include "config_ssid.h"
 #include "eloop.h"
 #include "wpa.h"
 #include "wpa_i.h"
@@ -180,7 +179,6 @@
 	struct wpa_sm *sm, const unsigned char *src_addr,
 	const struct wpa_eapol_key *key, size_t extra_len, int ver)
 {
-	struct wpa_ssid *ssid = sm->cur_ssid;
 	struct wpa_peerkey *peerkey;
 	struct wpa_eapol_ie_parse kde;
 	struct wpa_ie_data ie;
@@ -190,7 +188,7 @@
 
 	wpa_printf(MSG_DEBUG, "RSN: Received SMK M2");
 
-	if (ssid == NULL || !ssid->peerkey || sm->proto != WPA_PROTO_RSN) {
+	if (!sm->peerkey_enabled || sm->proto != WPA_PROTO_RSN) {
 		wpa_printf(MSG_INFO, "RSN: SMK handshake not allowed for "
 			   "the current network");
 		return -1;
@@ -223,7 +221,7 @@
 		return -1;
 	}
 
-	cipher = ie.pairwise_cipher & ssid->pairwise_cipher;
+	cipher = ie.pairwise_cipher & sm->allowed_pairwise_cipher;
 	if (cipher & WPA_CIPHER_CCMP) {
 		wpa_printf(MSG_DEBUG, "RSN: Using CCMP for PeerKey");
 		cipher = WPA_CIPHER_CCMP;
@@ -464,7 +462,6 @@
 {
 	int cipher;
 	struct wpa_ie_data ie;
-	struct wpa_ssid *ssid = sm->cur_ssid;
 
 	wpa_printf(MSG_DEBUG, "RSN: Received SMK M5 (Peer " MACSTR ")",
 		   MAC2STR(kde->mac_addr));
@@ -492,7 +489,7 @@
 	peerkey->rsnie_p_len = kde->rsn_ie_len;
 	os_memcpy(peerkey->pnonce, kde->nonce, WPA_NONCE_LEN);
 
-	cipher = ie.pairwise_cipher & ssid->pairwise_cipher;
+	cipher = ie.pairwise_cipher & sm->allowed_pairwise_cipher;
 	if (cipher & WPA_CIPHER_CCMP) {
 		wpa_printf(MSG_DEBUG, "RSN: Using CCMP for PeerKey");
 		peerkey->cipher = WPA_CIPHER_CCMP;
@@ -517,13 +514,12 @@
 	struct wpa_sm *sm, const unsigned char *src_addr,
 	const struct wpa_eapol_key *key, size_t extra_len, int ver)
 {
-	struct wpa_ssid *ssid = sm->cur_ssid;
 	struct wpa_peerkey *peerkey;
 	struct wpa_eapol_ie_parse kde;
 	u32 lifetime;
 	struct os_time now;
 
-	if (ssid == NULL || !ssid->peerkey || sm->proto != WPA_PROTO_RSN) {
+	if (!sm->peerkey_enabled || sm->proto != WPA_PROTO_RSN) {
 		wpa_printf(MSG_DEBUG, "RSN: SMK handshake not allowed for "
 			   "the current network");
 		return -1;
@@ -598,7 +594,6 @@
 	struct wpa_sm *sm, const unsigned char *src_addr,
 	const struct wpa_eapol_key *key, size_t extra_len)
 {
-	struct wpa_ssid *ssid = sm->cur_ssid;
 	struct wpa_eapol_ie_parse kde;
 	struct rsn_error_kde error;
 	u8 peer[ETH_ALEN];
@@ -606,7 +601,7 @@
 
 	wpa_printf(MSG_DEBUG, "RSN: Received SMK Error");
 
-	if (ssid == NULL || !ssid->peerkey || sm->proto != WPA_PROTO_RSN) {
+	if (!sm->peerkey_enabled || sm->proto != WPA_PROTO_RSN) {
 		wpa_printf(MSG_DEBUG, "RSN: SMK handshake not allowed for "
 			   "the current network");
 		return -1;
@@ -994,13 +989,11 @@
 	int key_info, ver;
 	u8 bssid[ETH_ALEN], *rbuf, *pos, *count_pos;
 	u16 count;
-	struct wpa_ssid *ssid = sm->cur_ssid;
 	struct rsn_ie_hdr *hdr;
 	struct wpa_peerkey *peerkey;
 	struct wpa_ie_data ie;
 
-	if (sm->proto != WPA_PROTO_RSN || !sm->ptk_set ||
-	    ssid == NULL || !ssid->peerkey)
+	if (sm->proto != WPA_PROTO_RSN || !sm->ptk_set || !sm->peerkey_enabled)
 		return -1;
 
 	if (sm->ap_rsn_ie &&
@@ -1047,12 +1040,12 @@
 	pos += 2;
 
 	count = 0;
-	if (ssid->pairwise_cipher & WPA_CIPHER_CCMP) {
+	if (sm->allowed_pairwise_cipher & WPA_CIPHER_CCMP) {
 		RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_CCMP);
 		pos += RSN_SELECTOR_LEN;
 		count++;
 	}
-	if (ssid->pairwise_cipher & WPA_CIPHER_TKIP) {
+	if (sm->allowed_pairwise_cipher & WPA_CIPHER_TKIP) {
 		RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_TKIP);
 		pos += RSN_SELECTOR_LEN;
 		count++;

Modified: wpasupplicant/trunk/src/rsn_supp/pmksa_cache.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/pmksa_cache.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/pmksa_cache.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/pmksa_cache.c Fri Feb  1 14:38:48 2008
@@ -17,7 +17,6 @@
 #include "common.h"
 #include "wpa.h"
 #include "eloop.h"
-#include "config_ssid.h"
 #include "sha1.h"
 #include "wpa_i.h"
 #include "eapol_supp/eapol_supp_sm.h"

Modified: wpasupplicant/trunk/src/rsn_supp/preauth.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/preauth.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/preauth.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/preauth.c Fri Feb  1 14:38:48 2008
@@ -18,7 +18,6 @@
 #include "wpa.h"
 #include "drivers/driver.h"
 #include "eloop.h"
-#include "config_ssid.h"
 #include "l2_packet/l2_packet.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "preauth.h"
@@ -106,7 +105,7 @@
 			sm->pmk_len = pmk_len;
 			pmksa_cache_add(sm->pmksa, pmk, pmk_len,
 					sm->preauth_bssid, sm->own_addr,
-					sm->cur_ssid);
+					sm->network_ctx);
 		} else {
 			wpa_msg(sm->ctx->ctx, MSG_INFO, "RSN: failed to get "
 				"master session key from pre-auth EAPOL state "
@@ -165,7 +164,7 @@
  * rsn_preauth_init - Start new RSN pre-authentication
  * @sm: Pointer to WPA state machine data from wpa_sm_init()
  * @dst: Authenticator address (BSSID) with which to preauthenticate
- * @config: Current network configuration
+ * @eap_conf: Current EAP configuration
  * Returns: 0 on success, -1 on another pre-authentication is in progress,
  * -2 on layer 2 packet initialization failure, -3 on EAPOL state machine
  * initialization failure, -4 on memory allocation failure
@@ -175,7 +174,8 @@
  * or from driver reports. In addition, ctrl_iface PREAUTH command can trigger
  * pre-authentication.
  */
-int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst, struct wpa_ssid *config)
+int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
+		     struct eap_peer_config *eap_conf)
 {
 	struct eapol_config eapol_conf;
 	struct eapol_ctx *ctx;
@@ -235,9 +235,8 @@
 	eapol_conf.accept_802_1x_keys = 0;
 	eapol_conf.required_keys = 0;
 	eapol_conf.fast_reauth = sm->fast_reauth;
-	if (config)
-		eapol_conf.workaround = config->eap_workaround;
-	eapol_sm_notify_config(sm->preauth_eapol, config, &eapol_conf);
+	eapol_conf.workaround = sm->eap_workaround;
+	eapol_sm_notify_config(sm->preauth_eapol, eap_conf, &eapol_conf);
 	/*
 	 * Use a shorter startPeriod with preauthentication since the first
 	 * preauth EAPOL-Start frame may end up being dropped due to race
@@ -323,7 +322,8 @@
 				" selected for pre-authentication",
 				MAC2STR(candidate->bssid));
 			sm->pmksa_candidates = candidate->next;
-			rsn_preauth_init(sm, candidate->bssid, sm->cur_ssid);
+			rsn_preauth_init(sm, candidate->bssid,
+					 sm->eap_conf_ctx);
 			os_free(candidate);
 			return;
 		}
@@ -360,8 +360,9 @@
 {
 	struct rsn_pmksa_candidate *cand, *prev, *pos;
 
-	if (sm->cur_ssid && sm->cur_ssid->proactive_key_caching)
-		pmksa_cache_get_opportunistic(sm->pmksa, sm->cur_ssid, bssid);
+	if (sm->network_ctx && sm->proactive_key_caching)
+		pmksa_cache_get_opportunistic(sm->pmksa, sm->network_ctx,
+					      bssid);
 
 	if (!preauth) {
 		wpa_printf(MSG_DEBUG, "RSN: Ignored PMKID candidate without "
@@ -436,7 +437,7 @@
 	int i;
 	struct rsn_pmksa_cache_entry *pmksa;
 
-	if (sm->cur_ssid == NULL)
+	if (sm->ssid_len == 0)
 		return;
 
 	/*
@@ -451,8 +452,8 @@
 		r = results->res[i];
 
 		ssid = wpa_scan_get_ie(r, WLAN_EID_SSID);
-		if (ssid == NULL || ssid[1] != sm->cur_ssid->ssid_len ||
-		    os_memcmp(ssid + 2, sm->cur_ssid->ssid, ssid[1]) != 0)
+		if (ssid == NULL || ssid[1] != sm->ssid_len ||
+		    os_memcmp(ssid + 2, sm->ssid, ssid[1]) != 0)
 			continue;
 
 		if (os_memcmp(r->bssid, sm->bssid, ETH_ALEN) == 0)

Modified: wpasupplicant/trunk/src/rsn_supp/preauth.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/preauth.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/preauth.h (original)
+++ wpasupplicant/trunk/src/rsn_supp/preauth.h Fri Feb  1 14:38:48 2008
@@ -21,7 +21,7 @@
 
 void pmksa_candidate_free(struct wpa_sm *sm);
 int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
-		     struct wpa_ssid *config);
+		     struct eap_peer_config *eap_conf);
 void rsn_preauth_deinit(struct wpa_sm *sm);
 void rsn_preauth_scan_results(struct wpa_sm *sm,
 			      struct wpa_scan_results *results);
@@ -43,7 +43,7 @@
 }
 
 static inline int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
-				   struct wpa_ssid *config)
+				   struct eap_peer_config *eap_conf)
 {
 	return -1;
 }

Modified: wpasupplicant/trunk/src/rsn_supp/wpa.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - WPA state machine and EAPOL-Key processing
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -19,7 +19,6 @@
 #include "aes_wrap.h"
 #include "wpa.h"
 #include "eloop.h"
-#include "config_ssid.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "preauth.h"
 #include "pmksa_cache.h"
@@ -142,14 +141,12 @@
 	int key_info, ver;
 	u8 bssid[ETH_ALEN], *rbuf;
 
-	if (sm->pairwise_cipher == WPA_CIPHER_CCMP) {
+	if (sm->key_mgmt == WPA_KEY_MGMT_FT_IEEE8021X ||
+	    sm->key_mgmt == WPA_KEY_MGMT_FT_PSK)
+		ver = WPA_KEY_INFO_TYPE_AES_128_CMAC;
+	else if (sm->pairwise_cipher == WPA_CIPHER_CCMP)
 		ver = WPA_KEY_INFO_TYPE_HMAC_SHA1_AES;
-#ifdef CONFIG_IEEE80211R
-		if (sm->key_mgmt == WPA_KEY_MGMT_FT_IEEE8021X ||
-		    sm->key_mgmt == WPA_KEY_MGMT_FT_PSK)
-			ver = WPA_KEY_INFO_TYPE_AES_128_CMAC;
-#endif /* CONFIG_IEEE80211R */
-	} else
+	else
 		ver = WPA_KEY_INFO_TYPE_HMAC_MD5_RC4;
 
 	if (wpa_sm_get_bssid(sm, bssid) < 0) {
@@ -248,7 +245,7 @@
 					"machines", sm->pmk, pmk_len);
 			sm->pmk_len = pmk_len;
 			pmksa_cache_add(sm->pmksa, sm->pmk, pmk_len, src_addr,
-					sm->own_addr, sm->cur_ssid);
+					sm->own_addr, sm->network_ctx);
 			if (!sm->cur_pmksa && pmkid &&
 			    pmksa_cache_get(sm->pmksa, src_addr, pmkid)) {
 				wpa_printf(MSG_DEBUG, "RSN: the new PMK "
@@ -381,7 +378,7 @@
 	struct wpa_ptk *ptk;
 	u8 buf[8];
 
-	if (wpa_sm_get_ssid(sm) == NULL) {
+	if (wpa_sm_get_network_ctx(sm) == NULL) {
 		wpa_printf(MSG_WARNING, "WPA: No SSID info found (msg 1 of "
 			   "4).");
 		return;
@@ -1469,11 +1466,9 @@
 	}
 
 #ifdef CONFIG_IEEE80211R
-	if (sm->pairwise_cipher == WPA_CIPHER_CCMP &&
-	    (sm->key_mgmt == WPA_KEY_MGMT_FT_IEEE8021X ||
-	     sm->key_mgmt == WPA_KEY_MGMT_FT_PSK)) {
-		/* IEEE 802.11r introduces special rules for using a new
-		 * key_info type (AES-128-CMAC). */
+	if (sm->key_mgmt == WPA_KEY_MGMT_FT_IEEE8021X ||
+	    sm->key_mgmt == WPA_KEY_MGMT_FT_PSK) {
+		/* IEEE 802.11r uses a new key_info type (AES-128-CMAC). */
 		if (ver != WPA_KEY_INFO_TYPE_AES_128_CMAC) {
 			wpa_printf(MSG_INFO, "FT: AP did not use "
 				   "AES-128-CMAC.");
@@ -1985,12 +1980,32 @@
  * stored as a backpointer to network configuration. This can be %NULL to clear
  * the stored pointed.
  */
-void wpa_sm_set_config(struct wpa_sm *sm, struct wpa_ssid *config)
-{
-	if (sm) {
-		sm->cur_ssid = config;
-		pmksa_cache_notify_reconfig(sm->pmksa);
-	}
+void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config)
+{
+	if (!sm)
+		return;
+
+	sm->network_ctx = config;
+	if (config) {
+		sm->peerkey_enabled = config->peerkey_enabled;
+		sm->allowed_pairwise_cipher = config->allowed_pairwise_cipher;
+		sm->proactive_key_caching = config->proactive_key_caching;
+		sm->eap_workaround = config->eap_workaround;
+		sm->eap_conf_ctx = config->eap_conf_ctx;
+		if (config->ssid) {
+			os_memcpy(sm->ssid, config->ssid, config->ssid_len);
+			sm->ssid_len = config->ssid_len;
+		} else
+			sm->ssid_len = 0;
+	} else {
+		sm->peerkey_enabled = 0;
+		sm->allowed_pairwise_cipher = 0;
+		sm->proactive_key_caching = 0;
+		sm->eap_workaround = 0;
+		sm->eap_conf_ctx = NULL;
+		sm->ssid_len = 0;
+	}
+	pmksa_cache_notify_reconfig(sm->pmksa);
 }
 
 

Modified: wpasupplicant/trunk/src/rsn_supp/wpa.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa.h (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa.h Fri Feb  1 14:38:48 2008
@@ -28,7 +28,6 @@
 #endif
 
 struct wpa_sm;
-struct wpa_ssid;
 struct eapol_sm;
 struct wpa_config_blob;
 
@@ -45,7 +44,7 @@
 		       const u8 *addr, int key_idx, int set_tx,
 		       const u8 *seq, size_t seq_len,
 		       const u8 *key, size_t key_len);
-	struct wpa_ssid * (*get_ssid)(void *ctx);
+	void * (*get_network_ctx)(void *ctx);
 	int (*get_bssid)(void *ctx, u8 *bssid);
 	int (*ether_send)(void *ctx, const u8 *dest, u16 proto, const u8 *buf,
 			  size_t len);
@@ -79,6 +78,17 @@
 	WPA_PARAM_RSN_ENABLED
 };
 
+struct rsn_supp_config {
+	void *network_ctx;
+	int peerkey_enabled;
+	int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
+	int proactive_key_caching;
+	int eap_workaround;
+	void *eap_conf_ctx;
+	const u8 *ssid;
+	size_t ssid_len;
+};
+
 #ifndef CONFIG_NO_WPA
 
 struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx);
@@ -89,7 +99,7 @@
 void wpa_sm_set_pmk_from_pmksa(struct wpa_sm *sm);
 void wpa_sm_set_fast_reauth(struct wpa_sm *sm, int fast_reauth);
 void wpa_sm_set_scard_ctx(struct wpa_sm *sm, void *scard_ctx);
-void wpa_sm_set_config(struct wpa_sm *sm, struct wpa_ssid *config);
+void wpa_sm_set_config(struct wpa_sm *sm, struct rsn_supp_config *config);
 void wpa_sm_set_own_addr(struct wpa_sm *sm, const u8 *addr);
 void wpa_sm_set_ifname(struct wpa_sm *sm, const char *ifname,
 		       const char *bridge_ifname);
@@ -156,7 +166,7 @@
 }
 
 static inline void wpa_sm_set_config(struct wpa_sm *sm,
-				     struct wpa_ssid *config)
+				     struct rsn_supp_config *config)
 {
 }
 

Modified: wpasupplicant/trunk/src/rsn_supp/wpa_ft.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa_ft.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa_ft.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa_ft.c Fri Feb  1 14:38:48 2008
@@ -16,7 +16,6 @@
 
 #include "common.h"
 #include "wpa.h"
-#include "config_ssid.h"
 #include "wpa_i.h"
 #include "wpa_ie.h"
 #include "aes_wrap.h"
@@ -28,14 +27,9 @@
 		      const struct wpa_eapol_key *key,
 		      struct wpa_ptk *ptk)
 {
-	struct wpa_ssid *ssid = sm->cur_ssid;
 	u8 pmk_r1_name[WPA_PMK_NAME_LEN];
 	u8 ptk_name[WPA_PMK_NAME_LEN];
 	const u8 *anonce = key->key_nonce;
-	if (ssid == NULL) {
-		wpa_printf(MSG_DEBUG, "FT: No SSID known for key derivation");
-		return -1;
-	}
 
 	if (sm->xxkey_len == 0) {
 		wpa_printf(MSG_DEBUG, "FT: XXKey not available for key "
@@ -43,8 +37,8 @@
 		return -1;
 	}
 
-	wpa_derive_pmk_r0(sm->xxkey, sm->xxkey_len, ssid->ssid,
-			  ssid->ssid_len, sm->mobility_domain,
+	wpa_derive_pmk_r0(sm->xxkey, sm->xxkey_len, sm->ssid,
+			  sm->ssid_len, sm->mobility_domain,
 			  sm->r0kh_id, sm->r0kh_id_len, sm->own_addr,
 			  sm->pmk_r0, sm->pmk_r0_name);
 	wpa_hexdump_key(MSG_DEBUG, "FT: PMK-R0", sm->pmk_r0, PMK_LEN);
@@ -248,19 +242,18 @@
 
 	if (kck) {
 		/*
-		 * IEEE 802.11r/D5.0, 11A.7.4
+		 * IEEE 802.11r/D9.0, 11A.8.4
 		 * MIC shall be calculated over:
-		 * STA MAC address
+		 * non-AP STA MAC address
 		 * Target AP MAC address
 		 * Transaction seq number (5 for ReassocReq, 3 otherwise)
 		 * RSN IE
 		 * MDIE
 		 * FTIE (with MIC field set to 0)
-		 * RIC (if present)
+		 * RIC-Request (if present)
 		 */
 		ftie->mic_control[1] = 3; /* Information element count */
-		if (wpa_ft_mic(kck, sm->pairwise_cipher == WPA_CIPHER_CCMP,
-			       sm->own_addr, target_ap, 5,
+		if (wpa_ft_mic(kck, sm->own_addr, target_ap, 5,
 			       ((u8 *) mdie) - 2, 2 + sizeof(*mdie),
 			       ((u8 *) ftie) - 2, 2 + *ftie_len,
 			       (u8 *) rsnie, 2 + rsnie->len, NULL, 0,
@@ -671,8 +664,7 @@
 		return -1;
 	}
 
-	if (wpa_ft_mic(sm->ptk.kck, sm->pairwise_cipher == WPA_CIPHER_CCMP,
-		       sm->own_addr, sm->bssid, 6,
+	if (wpa_ft_mic(sm->ptk.kck, sm->own_addr, sm->bssid, 6,
 		       parse.mdie - 2, parse.mdie_len + 2,
 		       parse.ftie - 2, parse.ftie_len + 2,
 		       parse.rsn - 2, parse.rsn_len + 2, NULL, 0,

Modified: wpasupplicant/trunk/src/rsn_supp/wpa_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa_i.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa_i.h (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa_i.h Fri Feb  1 14:38:48 2008
@@ -52,7 +52,14 @@
 	void *scard_ctx; /* context for smartcard callbacks */
 	int fast_reauth; /* whether EAP fast re-authentication is enabled */
 
-	struct wpa_ssid *cur_ssid;
+	void *network_ctx;
+	int peerkey_enabled;
+	int allowed_pairwise_cipher; /* bitfield of WPA_CIPHER_* */
+	int proactive_key_caching;
+	int eap_workaround;
+	void *eap_conf_ctx;
+	u8 ssid[32];
+	size_t ssid_len;
 
 	u8 own_addr[ETH_ALEN];
 	const char *ifname;
@@ -147,10 +154,10 @@
 				seq, seq_len, key, key_len);
 }
 
-static inline struct wpa_ssid * wpa_sm_get_ssid(struct wpa_sm *sm)
-{
-	WPA_ASSERT(sm->ctx->get_ssid);
-	return sm->ctx->get_ssid(sm->ctx->ctx);
+static inline void * wpa_sm_get_network_ctx(struct wpa_sm *sm)
+{
+	WPA_ASSERT(sm->ctx->get_network_ctx);
+	return sm->ctx->get_network_ctx(sm->ctx->ctx);
 }
 
 static inline int wpa_sm_get_bssid(struct wpa_sm *sm, u8 *bssid)

Modified: wpasupplicant/trunk/src/rsn_supp/wpa_ie.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/src/rsn_supp/wpa_ie.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/src/rsn_supp/wpa_ie.c (original)
+++ wpasupplicant/trunk/src/rsn_supp/wpa_ie.c Fri Feb  1 14:38:48 2008
@@ -16,7 +16,6 @@
 
 #include "common.h"
 #include "wpa.h"
-#include "config_ssid.h"
 #include "pmksa_cache.h"
 #include "ieee802_11_defs.h"
 #include "wpa_i.h"

Modified: wpasupplicant/trunk/wpa_supplicant/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ChangeLog?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ChangeLog (original)
+++ wpasupplicant/trunk/wpa_supplicant/ChangeLog Fri Feb  1 14:38:48 2008
@@ -1,4 +1,24 @@
 ChangeLog for wpa_supplicant
+
+????-??-?? - v0.6.3
+	* removed 'nai' and 'eappsk' network configuration variables that were
+	  previously used for configuring user identity and key for EAP-PSK,
+	  EAP-PAX, EAP-SAKE, and EAP-GPSK. 'identity' field is now used as the
+	  replacement for 'nai' (if old configuration used a separate
+	  'identity' value, that would now be configured as
+	  'anonymous_identity'). 'password' field is now used as the
+	  replacement for 'eappsk' (it can also be set using hexstring to
+	  present random binary data)
+	* removed '-w' command line parameter (wait for interface to be added,
+	  if needed); cleaner way of handling this functionality is to use an
+	  external mechanism (e.g., hotplug scripts) that start wpa_supplicant
+	  when an interface is added
+	* updated FT support to use the latest draft, IEEE 802.11r/D9.0
+	* added ctrl_iface monitor event (CTRL-EVENT-SCAN-RESULTS) for
+	  indicating when new scan results become available
+	* added new ctrl_iface command, BSS, to allow scan results to be
+	  fetched without hitting the message size limits (this command
+	  can be used to iterate through the scan results one BSS at the time)
 
 2008-01-01 - v0.6.2
 	* added support for Makefile builds to include debug-log-to-a-file

Modified: wpasupplicant/trunk/wpa_supplicant/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/Makefile?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/Makefile (original)
+++ wpasupplicant/trunk/wpa_supplicant/Makefile Fri Feb  1 14:38:48 2008
@@ -6,7 +6,6 @@
 CFLAGS = -MMD -O2 -Wall -g
 endif
 
-CFLAGS += -I.
 CFLAGS += -I../src
 CFLAGS += -I../src/crypto
 CFLAGS += -I../src/utils
@@ -314,9 +313,11 @@
 ifeq ($(CONFIG_EAP_MSCHAPV2), dyn)
 CFLAGS += -DEAP_MSCHAPv2_DYNAMIC
 EAPDYN += ../src/eap_peer/eap_mschapv2.so
+EAPDYN += ../src/eap_peer/mschapv2.so
 else
 CFLAGS += -DEAP_MSCHAPv2
 OBJS += ../src/eap_peer/eap_mschapv2.o
+OBJS += ../src/eap_peer/mschapv2.o
 OBJS_h += ../src/eap_server/eap_mschapv2.o
 endif
 MS_FUNCS=y
@@ -472,20 +473,6 @@
 CFLAGS += -DEAP_GPSK_SHA256
 endif
 NEED_SHA256=y
-endif
-
-ifdef CONFIG_EAP_WSC
-# EAP-WSC
-ifeq ($(CONFIG_EAP_WSC), dyn)
-CFLAGS += -DEAP_WSC_DYNAMIC
-EAPDYN += ../src/eap_peer/eap_wsc.so
-else
-CFLAGS += -DEAP_WSC
-OBJS += ../src/eap_peer/eap_wsc.o ../src/eap_common/eap_wsc_common.o
-OBJS += ../src/wps/wps.o
-OBJS_h += ../src/eap_server/eap_wsc.o
-endif
-CONFIG_IEEE8021X_EAPOL=y
 endif
 
 ifdef CONFIG_EAP_IKEV2
@@ -498,6 +485,8 @@
 CFLAGS += -DEAP_IKEV2
 OBJS += ../src/eap_peer/eap_ikev2.o ../src/eap_peer/ikev2.o
 OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
+OBJS_h += ../src/eap_server/eap_ikev2.o
+OBJS_h += ../src/eap_server/ikev2.o
 endif
 CONFIG_IEEE8021X_EAPOL=y
 NEED_DH_GROUPS=y
@@ -1050,10 +1039,6 @@
 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
 		-Deap_peer_sake_register=eap_peer_method_dynamic_init
 
-eap_wsc.so: ../src/eap_peer/eap_wsc.c ../src/eap_common/eap_wsc_common.c ../src/wps/wps.c
-	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
-		-Deap_peer_wsc_register=eap_peer_method_dynamic_init
-
 eap_ikev2.so: ../src/eap_peer/eap_ikev2.c ../src/eap_peer/ikev2.c ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.c
 	$(CC) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
 		-Deap_peer_ikev2_register=eap_peer_method_dynamic_init

Modified: wpasupplicant/trunk/wpa_supplicant/README
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/README?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/README (original)
+++ wpasupplicant/trunk/wpa_supplicant/README Fri Feb  1 14:38:48 2008
@@ -1,7 +1,7 @@
 WPA Supplicant
 ==============
 
-Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi> and contributors
+Copyright (c) 2003-2008, Jouni Malinen <j at w1.fi> and contributors
 All Rights Reserved.
 
 This program is dual-licensed under both the GPL version 2 and BSD
@@ -530,10 +530,9 @@
 
 In most common cases, wpa_supplicant is started with
 
-wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
-
-This makes the process fork into background and wait for the wlan0
-interface if it is not available at startup time.
+wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
+
+This makes the process fork into background.
 
 The easiest way to debug problems, and to get debug log for bug
 reports, is to start wpa_supplicant on foreground with debugging
@@ -907,10 +906,6 @@
 completed before data frames can be exchanged, so wpa_supplicant
 should be started before DHCP client.
 
-Command line option '-w' can be used if wpa_supplicant is started
-before the wireless LAN interface is present (e.g., before inserting
-the PC Card) or is not yet up.
-
 For example, following small changes to pcmcia-cs scripts can be used
 to enable WPA support:
 
@@ -921,7 +916,7 @@
 /etc/pcmcia/wireless:
 
     if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
-	/usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf \
+	/usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf \
 		-i$DEVICE
     fi
 
@@ -933,9 +928,7 @@
     fi
 
 This will make cardmgr start wpa_supplicant when the card is plugged
-in. wpa_supplicant will wait until the interface is set up--either
-when a static IP address is configured or when DHCP client is
-started--and will then negotiate keys with the AP.
+in.
 
 
 

Modified: wpasupplicant/trunk/wpa_supplicant/README-Windows.txt
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/README-Windows.txt?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/README-Windows.txt (original)
+++ wpasupplicant/trunk/wpa_supplicant/README-Windows.txt Fri Feb  1 14:38:48 2008
@@ -1,7 +1,7 @@
 wpa_supplicant for Windows
 ==========================
 
-Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi> and
+Copyright (c) 2003-2008, Jouni Malinen <j at w1.fi> and
 contributors
 All Rights Reserved.
 

Modified: wpasupplicant/trunk/wpa_supplicant/config.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/config.c Fri Feb  1 14:38:48 2008
@@ -74,13 +74,14 @@
 		if (hlen & 1)
 			return NULL;
 		tlen = hlen / 2;
-		str = os_malloc(tlen);
+		str = os_malloc(tlen + 1);
 		if (str == NULL)
 			return NULL;
 		if (hexstr2bin(value, str, tlen)) {
 			os_free(str);
 			return NULL;
 		}
+		str[tlen] = '\0';
 		*len = tlen;
 		return (char *) str;
 	}
@@ -944,7 +945,7 @@
 
 	wpa_hexdump(MSG_MSGDUMP, "eap methods",
 		    (u8 *) methods, num_methods * sizeof(*methods));
-	ssid->eap_methods = methods;
+	ssid->eap.eap_methods = methods;
 	return errors ? -1 : 0;
 }
 
@@ -954,7 +955,7 @@
 {
 	int i, ret;
 	char *buf, *pos, *end;
-	const struct eap_method_type *eap_methods = ssid->eap_methods;
+	const struct eap_method_type *eap_methods = ssid->eap.eap_methods;
 	const char *name;
 
 	if (eap_methods == NULL)
@@ -1003,10 +1004,10 @@
 		wpa_hexdump_ascii(MSG_MSGDUMP, data->name,
 				  (u8 *) tmp, res_len);
 
-		os_free(ssid->password);
-		ssid->password = (u8 *) tmp;
-		ssid->password_len = res_len;
-		ssid->flags &= ~WPA_CONFIG_FLAGS_PASSWORD_NTHASH;
+		os_free(ssid->eap.password);
+		ssid->eap.password = (u8 *) tmp;
+		ssid->eap.password_len = res_len;
+		ssid->eap.flags &= ~EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
 
 		return 0;
 	}
@@ -1031,10 +1032,10 @@
 
 	wpa_hexdump_key(MSG_MSGDUMP, data->name, hash, 16);
 
-	os_free(ssid->password);
-	ssid->password = hash;
-	ssid->password_len = 16;
-	ssid->flags |= WPA_CONFIG_FLAGS_PASSWORD_NTHASH;
+	os_free(ssid->eap.password);
+	ssid->eap.password = hash;
+	ssid->eap.password_len = 16;
+	ssid->eap.flags |= EAP_CONFIG_FLAGS_PASSWORD_NTHASH;
 
 	return 0;
 }
@@ -1045,12 +1046,12 @@
 {
 	char *buf;
 
-	if (ssid->password == NULL)
-		return NULL;
-
-	if (!(ssid->flags & WPA_CONFIG_FLAGS_PASSWORD_NTHASH)) {
+	if (ssid->eap.password == NULL)
+		return NULL;
+
+	if (!(ssid->eap.flags & EAP_CONFIG_FLAGS_PASSWORD_NTHASH)) {
 		return wpa_config_write_string(
-			ssid->password, ssid->password_len);
+			ssid->eap.password, ssid->eap.password_len);
 	}
 
 	buf = os_malloc(5 + 32 + 1);
@@ -1058,7 +1059,7 @@
 		return NULL;
 
 	os_memcpy(buf, "hash:", 5);
-	wpa_snprintf_hex(buf + 5, 32 + 1, ssid->password, 16);
+	wpa_snprintf_hex(buf + 5, 32 + 1, ssid->eap.password, 16);
 
 	return buf;
 }
@@ -1182,17 +1183,23 @@
 /* STR: Define a string variable for an ASCII string; f = field name */
 #ifdef NO_CONFIG_WRITE
 #define _STR(f) #f, wpa_config_parse_str, OFFSET(f)
+#define _STRe(f) #f, wpa_config_parse_str, OFFSET(eap.f)
 #else /* NO_CONFIG_WRITE */
 #define _STR(f) #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(f)
+#define _STRe(f) #f, wpa_config_parse_str, wpa_config_write_str, OFFSET(eap.f)
 #endif /* NO_CONFIG_WRITE */
 #define STR(f) _STR(f), NULL, NULL, NULL, 0
+#define STRe(f) _STRe(f), NULL, NULL, NULL, 0
 #define STR_KEY(f) _STR(f), NULL, NULL, NULL, 1
+#define STR_KEYe(f) _STRe(f), NULL, NULL, NULL, 1
 
 /* STR_LEN: Define a string variable with a separate variable for storing the
  * data length. Unlike STR(), this can be used to store arbitrary binary data
  * (i.e., even nul termination character). */
 #define _STR_LEN(f) _STR(f), OFFSET(f ## _len)
+#define _STR_LENe(f) _STRe(f), OFFSET(eap.f ## _len)
 #define STR_LEN(f) _STR_LEN(f), NULL, NULL, 0
+#define STR_LENe(f) _STR_LENe(f), NULL, NULL, 0
 #define STR_LEN_KEY(f) _STR_LEN(f), NULL, NULL, 1
 
 /* STR_RANGE: Like STR_LEN(), but with minimum and maximum allowed length
@@ -1203,13 +1210,17 @@
 
 #ifdef NO_CONFIG_WRITE
 #define _INT(f) #f, wpa_config_parse_int, OFFSET(f), (void *) 0
+#define _INTe(f) #f, wpa_config_parse_int, OFFSET(eap.f), (void *) 0
 #else /* NO_CONFIG_WRITE */
 #define _INT(f) #f, wpa_config_parse_int, wpa_config_write_int, \
 	OFFSET(f), (void *) 0
+#define _INTe(f) #f, wpa_config_parse_int, wpa_config_write_int, \
+	OFFSET(eap.f), (void *) 0
 #endif /* NO_CONFIG_WRITE */
 
 /* INT: Define an integer variable */
 #define INT(f) _INT(f), NULL, NULL, 0
+#define INTe(f) _INTe(f), NULL, NULL, 0
 
 /* INT_RANGE: Define an integer variable with allowed value range */
 #define INT_RANGE(f, min, max) _INT(f), (void *) (min), (void *) (max), 0
@@ -1260,34 +1271,32 @@
 	{ FUNC(auth_alg) },
 #ifdef IEEE8021X_EAPOL
 	{ FUNC(eap) },
-	{ STR_LEN(identity) },
-	{ STR_LEN(anonymous_identity) },
-	{ STR_RANGE_KEY(eappsk, EAP_PSK_LEN_MIN, EAP_PSK_LEN_MAX) },
-	{ STR_LEN(nai) },
+	{ STR_LENe(identity) },
+	{ STR_LENe(anonymous_identity) },
 	{ FUNC(password) },
-	{ STR(ca_cert) },
-	{ STR(ca_path) },
-	{ STR(client_cert) },
-	{ STR(private_key) },
-	{ STR_KEY(private_key_passwd) },
-	{ STR(dh_file) },
-	{ STR(subject_match) },
-	{ STR(altsubject_match) },
-	{ STR(ca_cert2) },
-	{ STR(ca_path2) },
-	{ STR(client_cert2) },
-	{ STR(private_key2) },
-	{ STR_KEY(private_key2_passwd) },
-	{ STR(dh_file2) },
-	{ STR(subject_match2) },
-	{ STR(altsubject_match2) },
-	{ STR(phase1) },
-	{ STR(phase2) },
-	{ STR(pcsc) },
-	{ STR_KEY(pin) },
-	{ STR(engine_id) },
-	{ STR(key_id) },
-	{ INT(engine) },
+	{ STRe(ca_cert) },
+	{ STRe(ca_path) },
+	{ STRe(client_cert) },
+	{ STRe(private_key) },
+	{ STR_KEYe(private_key_passwd) },
+	{ STRe(dh_file) },
+	{ STRe(subject_match) },
+	{ STRe(altsubject_match) },
+	{ STRe(ca_cert2) },
+	{ STRe(ca_path2) },
+	{ STRe(client_cert2) },
+	{ STRe(private_key2) },
+	{ STR_KEYe(private_key2_passwd) },
+	{ STRe(dh_file2) },
+	{ STRe(subject_match2) },
+	{ STRe(altsubject_match2) },
+	{ STRe(phase1) },
+	{ STRe(phase2) },
+	{ STRe(pcsc) },
+	{ STR_KEYe(pin) },
+	{ STRe(engine_id) },
+	{ STRe(key_id) },
+	{ INTe(engine) },
 	{ INT(eapol_flags) },
 #endif /* IEEE8021X_EAPOL */
 	{ FUNC_KEY(wep_key0) },
@@ -1298,8 +1307,8 @@
 	{ INT(priority) },
 #ifdef IEEE8021X_EAPOL
 	{ INT(eap_workaround) },
-	{ STR(pac_file) },
-	{ INT(fragment_size) },
+	{ STRe(pac_file) },
+	{ INTe(fragment_size) },
 #endif /* IEEE8021X_EAPOL */
 	{ INT_RANGE(mode, 0, 1) },
 	{ INT_RANGE(proactive_key_caching, 0, 1) },
@@ -1415,6 +1424,43 @@
 }
 
 
+#ifdef IEEE8021X_EAPOL
+static void eap_peer_config_free(struct eap_peer_config *eap)
+{
+	os_free(eap->eap_methods);
+	os_free(eap->identity);
+	os_free(eap->anonymous_identity);
+	os_free(eap->password);
+	os_free(eap->ca_cert);
+	os_free(eap->ca_path);
+	os_free(eap->client_cert);
+	os_free(eap->private_key);
+	os_free(eap->private_key_passwd);
+	os_free(eap->dh_file);
+	os_free(eap->subject_match);
+	os_free(eap->altsubject_match);
+	os_free(eap->ca_cert2);
+	os_free(eap->ca_path2);
+	os_free(eap->client_cert2);
+	os_free(eap->private_key2);
+	os_free(eap->private_key2_passwd);
+	os_free(eap->dh_file2);
+	os_free(eap->subject_match2);
+	os_free(eap->altsubject_match2);
+	os_free(eap->phase1);
+	os_free(eap->phase2);
+	os_free(eap->pcsc);
+	os_free(eap->pin);
+	os_free(eap->engine_id);
+	os_free(eap->key_id);
+	os_free(eap->otp);
+	os_free(eap->pending_req_otp);
+	os_free(eap->pac_file);
+	os_free(eap->new_password);
+}
+#endif /* IEEE8021X_EAPOL */
+
+
 /**
  * wpa_config_free_ssid - Free network/ssid configuration data
  * @ssid: Configuration data for the network
@@ -1427,38 +1473,7 @@
 	os_free(ssid->ssid);
 	os_free(ssid->passphrase);
 #ifdef IEEE8021X_EAPOL
-	os_free(ssid->eap_methods);
-	os_free(ssid->identity);
-	os_free(ssid->anonymous_identity);
-	os_free(ssid->eappsk);
-	os_free(ssid->nai);
-	os_free(ssid->password);
-	os_free(ssid->ca_cert);
-	os_free(ssid->ca_path);
-	os_free(ssid->client_cert);
-	os_free(ssid->private_key);
-	os_free(ssid->private_key_passwd);
-	os_free(ssid->dh_file);
-	os_free(ssid->subject_match);
-	os_free(ssid->altsubject_match);
-	os_free(ssid->ca_cert2);
-	os_free(ssid->ca_path2);
-	os_free(ssid->client_cert2);
-	os_free(ssid->private_key2);
-	os_free(ssid->private_key2_passwd);
-	os_free(ssid->dh_file2);
-	os_free(ssid->subject_match2);
-	os_free(ssid->altsubject_match2);
-	os_free(ssid->phase1);
-	os_free(ssid->phase2);
-	os_free(ssid->pcsc);
-	os_free(ssid->pin);
-	os_free(ssid->engine_id);
-	os_free(ssid->key_id);
-	os_free(ssid->otp);
-	os_free(ssid->pending_req_otp);
-	os_free(ssid->pac_file);
-	os_free(ssid->new_password);
+	eap_peer_config_free(&ssid->eap);
 #endif /* IEEE8021X_EAPOL */
 	os_free(ssid->id_str);
 	os_free(ssid);
@@ -1609,7 +1624,7 @@
 #ifdef IEEE8021X_EAPOL
 	ssid->eapol_flags = DEFAULT_EAPOL_FLAGS;
 	ssid->eap_workaround = DEFAULT_EAP_WORKAROUND;
-	ssid->fragment_size = DEFAULT_FRAGMENT_SIZE;
+	ssid->eap.fragment_size = DEFAULT_FRAGMENT_SIZE;
 #endif /* IEEE8021X_EAPOL */
 }
 

Modified: wpasupplicant/trunk/wpa_supplicant/config.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/config.h Fri Feb  1 14:38:48 2008
@@ -24,7 +24,6 @@
 #define DEFAULT_FAST_REAUTH 1
 
 #include "config_ssid.h"
-#include "config_blob.h"
 
 
 /**
@@ -266,6 +265,12 @@
 void wpa_config_update_psk(struct wpa_ssid *ssid);
 int wpa_config_add_prio_network(struct wpa_config *config,
 				struct wpa_ssid *ssid);
+const struct wpa_config_blob * wpa_config_get_blob(struct wpa_config *config,
+						   const char *name);
+void wpa_config_set_blob(struct wpa_config *config,
+			 struct wpa_config_blob *blob);
+void wpa_config_free_blob(struct wpa_config_blob *blob);
+int wpa_config_remove_blob(struct wpa_config *config, const char *name);
 
 struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
 					   const char *driver_param);

Modified: wpasupplicant/trunk/wpa_supplicant/config_file.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config_file.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config_file.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/config_file.c Fri Feb  1 14:38:48 2008
@@ -714,7 +714,9 @@
 
 #define STR(t) write_str(f, #t, ssid)
 #define INT(t) write_int(f, #t, ssid->t, 0)
+#define INTe(t) write_int(f, #t, ssid->eap.t, 0)
 #define INT_DEF(t, def) write_int(f, #t, ssid->t, def)
+#define INT_DEFe(t, def) write_int(f, #t, ssid->eap.t, def)
 
 	STR(ssid);
 	INT(scan_ssid);
@@ -729,8 +731,6 @@
 	write_eap(f, ssid);
 	STR(identity);
 	STR(anonymous_identity);
-	STR(eappsk);
-	STR(nai);
 	STR(password);
 	STR(ca_cert);
 	STR(ca_path);
@@ -754,7 +754,7 @@
 	STR(pin);
 	STR(engine_id);
 	STR(key_id);
-	INT(engine);
+	INTe(engine);
 	INT_DEF(eapol_flags, DEFAULT_EAPOL_FLAGS);
 #endif /* IEEE8021X_EAPOL */
 	for (i = 0; i < 4; i++)
@@ -764,7 +764,7 @@
 #ifdef IEEE8021X_EAPOL
 	INT_DEF(eap_workaround, DEFAULT_EAP_WORKAROUND);
 	STR(pac_file);
-	INT_DEF(fragment_size, DEFAULT_FRAGMENT_SIZE);
+	INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
 #endif /* IEEE8021X_EAPOL */
 	INT(mode);
 	INT(proactive_key_caching);

Modified: wpasupplicant/trunk/wpa_supplicant/config_ssid.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config_ssid.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config_ssid.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/config_ssid.h Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant / Network configuration structures
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -16,10 +16,9 @@
 #define CONFIG_SSID_H
 
 #include "defs.h"
+#include "eap_peer/eap_config.h"
 
 #define MAX_SSID_LEN 32
-#define EAP_PSK_LEN_MIN 16
-#define EAP_PSK_LEN_MAX 32
 
 
 #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
@@ -176,410 +175,6 @@
 	int scan_ssid;
 
 #ifdef IEEE8021X_EAPOL
-
-	/**
-	 * identity - EAP Identity
-	 */
-	u8 *identity;
-
-	/**
-	 * identity_len - EAP Identity length
-	 */
-	size_t identity_len;
-
-	/**
-	 * anonymous_identity -  Anonymous EAP Identity
-	 *
-	 * This field is used for unencrypted use with EAP types that support
-	 * different tunnelled identity, e.g., EAP-TTLS, in order to reveal the
-	 * real identity (identity field) only to the authentication server.
-	 */
-	u8 *anonymous_identity;
-
-	/**
-	 * anonymous_identity_len - Length of anonymous_identity
-	 */
-	size_t anonymous_identity_len;
-
-	/**
-	 * eappsk - EAP-PSK/PAX/SAKE pre-shared key
-	 */
-	u8 *eappsk;
-
-	/**
-	 * eappsk_len - EAP-PSK/PAX/SAKE pre-shared key length
-	 *
-	 * This field is always 16 for the current version of EAP-PSK/PAX and
-	 * 32 for EAP-SAKE.
-	 */
-	size_t eappsk_len;
-
-	/**
-	 * nai - User NAI (for EAP-PSK/PAX/SAKE)
-	 */
-	u8 *nai;
-
-	/**
-	 * nai_len - Length of nai field
-	 */
-	size_t nai_len;
-
-	/**
-	 * password - Password string for EAP
-	 *
-	 * This field can include either the plaintext password (default
-	 * option) or a NtPasswordHash (16-byte MD4 hash of the unicode
-	 * presentation of the password) if flags field has
-	 * WPA_CONFIG_FLAGS_PASSWORD_NTHASH bit set to 1. NtPasswordHash can
-	 * only be used with authentication mechanism that use this hash as the
-	 * starting point for operation: MSCHAP and MSCHAPv2 (EAP-MSCHAPv2,
-	 * EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP).
-	 */
-	u8 *password;
-
-	/**
-	 * password_len - Length of password field
-	 */
-	size_t password_len;
-
-	/**
-	 * ca_cert - File path to CA certificate file (PEM/DER)
-	 *
-	 * This file can have one or more trusted CA certificates. If ca_cert
-	 * and ca_path are not included, server certificate will not be
-	 * verified. This is insecure and a trusted CA certificate should
-	 * always be configured when using EAP-TLS/TTLS/PEAP. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 *
-	 * On Windows, trusted CA certificates can be loaded from the system
-	 * certificate store by setting this to cert_store://<name>, e.g.,
-	 * ca_cert="cert_store://CA" or ca_cert="cert_store://ROOT".
-	 * Note that when running wpa_supplicant as an application, the user
-	 * certificate store (My user account) is used, whereas computer store
-	 * (Computer account) is used when running wpasvc as a service.
-	 */
-	u8 *ca_cert;
-
-	/**
-	 * ca_path - Directory path for CA certificate files (PEM)
-	 *
-	 * This path may contain multiple CA certificates in OpenSSL format.
-	 * Common use for this is to point to system trusted CA list which is
-	 * often installed into directory like /etc/ssl/certs. If configured,
-	 * these certificates are added to the list of trusted CAs. ca_cert
-	 * may also be included in that case, but it is not required.
-	 */
-	u8 *ca_path;
-
-	/**
-	 * client_cert - File path to client certificate file (PEM/DER)
-	 *
-	 * This field is used with EAP method that use TLS authentication.
-	 * Usually, this is only configured for EAP-TLS, even though this could
-	 * in theory be used with EAP-TTLS and EAP-PEAP, too. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *client_cert;
-
-	/**
-	 * private_key - File path to client private key file (PEM/DER/PFX)
-	 *
-	 * When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
-	 * commented out. Both the private key and certificate will be read
-	 * from the PKCS#12 file in this case. Full path to the file should be
-	 * used since working directory may change when wpa_supplicant is run
-	 * in the background.
-	 *
-	 * Windows certificate store can be used by leaving client_cert out and
-	 * configuring private_key in one of the following formats:
-	 *
-	 * cert://substring_to_match
-	 *
-	 * hash://certificate_thumbprint_in_hex
-	 *
-	 * For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
-	 *
-	 * Note that when running wpa_supplicant as an application, the user
-	 * certificate store (My user account) is used, whereas computer store
-	 * (Computer account) is used when running wpasvc as a service.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *private_key;
-
-	/**
-	 * private_key_passwd - Password for private key file
-	 *
-	 * If left out, this will be asked through control interface.
-	 */
-	u8 *private_key_passwd;
-
-	/**
-	 * dh_file - File path to DH/DSA parameters file (in PEM format)
-	 *
-	 * This is an optional configuration file for setting parameters for an
-	 * ephemeral DH key exchange. In most cases, the default RSA
-	 * authentication does not use this configuration. However, it is
-	 * possible setup RSA to use ephemeral DH key exchange. In addition,
-	 * ciphers with DSA keys always use ephemeral DH keys. This can be used
-	 * to achieve forward secrecy. If the file is in DSA parameters format,
-	 * it will be automatically converted into DH params. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *dh_file;
-
-	/**
-	 * subject_match - Constraint for server certificate subject
-	 *
-	 * This substring is matched against the subject of the authentication
-	 * server certificate. If this string is set, the server sertificate is
-	 * only accepted if it contains this string in the subject. The subject
-	 * string is in following format:
-	 *
-	 * /C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as at n.example.com
-	 */
-	u8 *subject_match;
-
-	/**
-	 * altsubject_match - Constraint for server certificate alt. subject
-	 *
-	 * Semicolon separated string of entries to be matched against the
-	 * alternative subject name of the authentication server certificate.
-	 * If this string is set, the server sertificate is only accepted if it
-	 * contains one of the entries in an alternative subject name
-	 * extension.
-	 *
-	 * altSubjectName string is in following format: TYPE:VALUE
-	 *
-	 * Example: EMAIL:server at example.com
-	 * Example: DNS:server.example.com;DNS:server2.example.com
-	 *
-	 * Following types are supported: EMAIL, DNS, URI
-	 */
-	u8 *altsubject_match;
-
-	/**
-	 * ca_cert2 - File path to CA certificate file (PEM/DER) (Phase 2)
-	 *
-	 * This file can have one or more trusted CA certificates. If ca_cert2
-	 * and ca_path2 are not included, server certificate will not be
-	 * verified. This is insecure and a trusted CA certificate should
-	 * always be configured. Full path to the file should be used since
-	 * working directory may change when wpa_supplicant is run in the
-	 * background.
-	 *
-	 * This field is like ca_cert, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *ca_cert2;
-
-	/**
-	 * ca_path2 - Directory path for CA certificate files (PEM) (Phase 2)
-	 *
-	 * This path may contain multiple CA certificates in OpenSSL format.
-	 * Common use for this is to point to system trusted CA list which is
-	 * often installed into directory like /etc/ssl/certs. If configured,
-	 * these certificates are added to the list of trusted CAs. ca_cert
-	 * may also be included in that case, but it is not required.
-	 *
-	 * This field is like ca_path, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication.
-	 */
-	u8 *ca_path2;
-
-	/**
-	 * client_cert2 - File path to client certificate file
-	 *
-	 * This field is like client_cert, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *client_cert2;
-
-	/**
-	 * private_key2 - File path to client private key file
-	 *
-	 * This field is like private_key, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *private_key2;
-
-	/**
-	 * private_key2_passwd -  Password for private key file
-	 *
-	 * This field is like private_key_passwd, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication.
-	 */
-	u8 *private_key2_passwd;
-
-	/**
-	 * dh_file2 - File path to DH/DSA parameters file (in PEM format)
-	 *
-	 * This field is like dh_file, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
-	 * file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 *
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	u8 *dh_file2;
-
-	/**
-	 * subject_match2 - Constraint for server certificate subject
-	 *
-	 * This field is like subject_match, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication.
-	 */
-	u8 *subject_match2;
-
-	/**
-	 * altsubject_match2 - Constraint for server certificate alt. subject
-	 *
-	 * This field is like altsubject_match, but used for phase 2 (inside
-	 * EAP-TTLS/PEAP/FAST tunnel) authentication.
-	 */
-	u8 *altsubject_match2;
-
-	/**
-	 * eap_methods - Allowed EAP methods
-	 *
-	 * (vendor=EAP_VENDOR_IETF,method=EAP_TYPE_NONE) terminated list of
-	 * allowed EAP methods or %NULL if all methods are accepted.
-	 */
-	struct eap_method_type *eap_methods;
-
-	/**
-	 * phase1 - Phase 1 (outer authentication) parameters
-	 *
-	 * String with field-value pairs, e.g., "peapver=0" or
-	 * "peapver=1 peaplabel=1".
-	 *
-	 * 'peapver' can be used to force which PEAP version (0 or 1) is used.
-	 *
-	 * 'peaplabel=1' can be used to force new label, "client PEAP
-	 * encryption",	to be used during key derivation when PEAPv1 or newer.
-	 *
-	 * Most existing PEAPv1 implementation seem to be using the old label,
-	 * "client EAP encryption", and wpa_supplicant is now using that as the
-	 * default value.
-	 *
-	 * Some servers, e.g., Radiator, may require peaplabel=1 configuration
-	 * to interoperate with PEAPv1; see eap_testing.txt for more details.
-	 *
-	 * 'peap_outer_success=0' can be used to terminate PEAP authentication
-	 * on tunneled EAP-Success. This is required with some RADIUS servers
-	 * that implement draft-josefsson-pppext-eap-tls-eap-05.txt (e.g.,
-	 * Lucent NavisRadius v4.4.0 with PEAP in "IETF Draft 5" mode).
-	 *
-	 * include_tls_length=1 can be used to force wpa_supplicant to include
-	 * TLS Message Length field in all TLS messages even if they are not
-	 * fragmented.
-	 *
-	 * sim_min_num_chal=3 can be used to configure EAP-SIM to require three
-	 * challenges (by default, it accepts 2 or 3).
-	 *
-	 * result_ind=1 can be used to enable EAP-SIM and EAP-AKA to use
-	 * protected result indication.
-	 *
-	 * fast_provisioning option can be used to enable in-line provisioning
-	 * of EAP-FAST credentials (PAC):
-	 * 0 = disabled,
-	 * 1 = allow unauthenticated provisioning,
-	 * 2 = allow authenticated provisioning,
-	 * 3 = allow both unauthenticated and authenticated provisioning
-	 *
-	 * fast_max_pac_list_len=<num> option can be used to set the maximum
-	 * number of PAC entries to store in a PAC list (default: 10).
-	 *
-	 * fast_pac_format=binary option can be used to select binary format
-	 * for storing PAC entires in order to save some space (the default
-	 * text format uses about 2.5 times the size of minimal binary format).
-	 */
-	char *phase1;
-
-	/**
-	 * phase2 - Phase2 (inner authentication with TLS tunnel) parameters
-	 *
-	 * String with field-value pairs, e.g., "auth=MSCHAPV2" for EAP-PEAP or
-	 * "autheap=MSCHAPV2 autheap=MD5" for EAP-TTLS.
-	 */
-	char *phase2;
-
-	/**
-	 * pcsc - Parameters for PC/SC smartcard interface for USIM and GSM SIM
-	 *
-	 * This field is used to configure PC/SC smartcard interface.
-	 * Currently, the only configuration is whether this field is %NULL (do
-	 * not use PC/SC) or non-NULL (e.g., "") to enable PC/SC.
-	 *
-	 * This field is used for EAP-SIM and EAP-AKA.
-	 */
-	char *pcsc;
-
-	/**
-	 * pin - PIN for USIM, GSM SIM, and smartcards
-	 *
-	 * This field is used to configure PIN for SIM and smartcards for
-	 * EAP-SIM and EAP-AKA. In addition, this is used with EAP-TLS if a
-	 * smartcard is used for private key operations.
-	 *
-	 * If left out, this will be asked through control interface.
-	 */
-	char *pin;
-
-	/**
-	 * engine - Enable OpenSSL engine (e.g., for smartcard access)
-	 *
-	 * This is used if private key operations for EAP-TLS are performed
-	 * using a smartcard.
-	 */
-	int engine;
-
-	/**
-	 * engine_id - Engine ID for OpenSSL engine
-	 *
-	 * "opensc" to select OpenSC engine or "pkcs11" to select PKCS#11
-	 * engine.
-	 *
-	 * This is used if private key operations for EAP-TLS are performed
-	 * using a smartcard.
-	 */
-	char *engine_id;
-
-	/**
-	 * key_id - Key ID for OpenSSL engine
-	 *
-	 * This is used if private key operations for EAP-TLS are performed
-	 * using a smartcard.
-	 */
-	char *key_id;
-
 #define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0)
 #define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1)
 	/**
@@ -587,6 +182,10 @@
 	 */
 	int eapol_flags;
 
+	/**
+	 * eap - EAP peer configuration for this network
+	 */
+	struct eap_peer_config eap;
 #endif /* IEEE8021X_EAPOL */
 
 #define NUM_WEP_KEYS 4
@@ -634,78 +233,6 @@
 #ifdef IEEE8021X_EAPOL
 
 	/**
-	 * otp - One-time-password
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when OTP is entered through the control interface.
-	 */
-	u8 *otp;
-
-	/**
-	 * otp_len - Length of the otp field
-	 */
-	size_t otp_len;
-
-	/**
-	 * pending_req_identity - Whether there is a pending identity request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	int pending_req_identity;
-
-	/**
-	 * pending_req_password - Whether there is a pending password request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	int pending_req_password;
-
-	/**
-	 * pending_req_pin - Whether there is a pending PIN request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	int pending_req_pin;
-
-	/**
-	 * pending_req_new_password - Pending password update request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	int pending_req_new_password;
-
-	/**
-	 * pending_req_passphrase - Pending passphrase request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	int pending_req_passphrase;
-
-	/**
-	 * pending_req_otp - Whether there is a pending OTP request
-	 *
-	 * This field should not be set in configuration step. It is only used
-	 * internally when control interface is used to request needed
-	 * information.
-	 */
-	char *pending_req_otp;
-
-	/**
-	 * pending_req_otp_len - Length of the pending OTP request
-	 */
-	size_t pending_req_otp_len;
-
-	/**
 	 * leap - Number of EAP methods using LEAP
 	 *
 	 * This field should be set to 1 if LEAP is enabled. This is used to
@@ -734,18 +261,6 @@
 	 * workarounds with eap_workaround = 0.
 	 */
 	unsigned int eap_workaround;
-
-	/**
-	 * pac_file - File path or blob name for the PAC entries (EAP-FAST)
-	 *
-	 * wpa_supplicant will need to be able to create this file and write
-	 * updates to it when PAC is being provisioned or refreshed. Full path
-	 * to the file should be used since working directory may change when
-	 * wpa_supplicant is run in the background.
-	 * Alternatively, a named configuration blob can be used by setting
-	 * this to blob://<blob name>.
-	 */
-	char *pac_file;
 
 #endif /* IEEE8021X_EAPOL */
 
@@ -765,32 +280,6 @@
 	 */
 	int mode;
 
-#ifdef IEEE8021X_EAPOL
-
-	/**
-	 * mschapv2_retry - MSCHAPv2 retry in progress
-	 *
-	 * This field is used internally by EAP-MSCHAPv2 and should not be set
-	 * as part of configuration.
-	 */
-	int mschapv2_retry;
-
-	/**
-	 * new_password - New password for password update
-	 *
-	 * This field is used during MSCHAPv2 password update. This is normally
-	 * requested from the user through the control interface and not set
-	 * from configuration.
-	 */
-	u8 *new_password;
-
-	/**
-	 * new_password_len - Length of new_password field
-	 */
-	size_t new_password_len;
-
-#endif /* IEEE8021X_EAPOL */
-
 	/**
 	 * disabled - Whether this network is currently disabled
 	 *
@@ -810,21 +299,6 @@
 	 * 1 = enabled
 	 */
 	int peerkey;
-
-#ifdef IEEE8021X_EAPOL
-
-	/**
-	 * fragment_size - Maximum EAP fragment size in bytes (default 1398)
-	 *
-	 * This value limits the fragment size for EAP methods that support
-	 * fragmentation (e.g., EAP-TLS and EAP-PEAP). This value should be set
-	 * small enough to make the EAP messages fit in MTU of the network
-	 * interface used for EAPOL. The default value is suitable for most
-	 * cases.
-	 */
-	int fragment_size;
-
-#endif /* IEEE8021X_EAPOL */
 
 	/**
 	 * id_str - Network identifier string for external scripts
@@ -860,17 +334,6 @@
 	 * will be used instead of this configured value.
 	 */
 	int frequency;
-
-#define WPA_CONFIG_FLAGS_PASSWORD_NTHASH BIT(0)
-	/**
-	 * flags - Network configuration flags (bitfield)
-	 *
-	 * This variable is used for internal flags to describe further details
-	 * for the network parameters.
-	 * bit 0 = password is represented as a 16-byte NtPasswordHash value
-	 *         instead of plaintext password
-	 */
-	u32 flags;
 };
 
 #endif /* CONFIG_SSID_H */

Modified: wpasupplicant/trunk/wpa_supplicant/config_winreg.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/config_winreg.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/config_winreg.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/config_winreg.c Fri Feb  1 14:38:48 2008
@@ -726,7 +726,9 @@
 
 #define STR(t) write_str(netw, #t, ssid)
 #define INT(t) write_int(netw, #t, ssid->t, 0)
+#define INTe(t) write_int(netw, #t, ssid->eap.t, 0)
 #define INT_DEF(t, def) write_int(netw, #t, ssid->t, def)
+#define INT_DEFe(t, def) write_int(netw, #t, ssid->eap.t, def)
 
 	STR(ssid);
 	INT(scan_ssid);
@@ -741,8 +743,6 @@
 	write_eap(netw, ssid);
 	STR(identity);
 	STR(anonymous_identity);
-	STR(eappsk);
-	STR(nai);
 	STR(password);
 	STR(ca_cert);
 	STR(ca_path);
@@ -766,7 +766,7 @@
 	STR(pin);
 	STR(engine_id);
 	STR(key_id);
-	INT(engine);
+	INTe(engine);
 	INT_DEF(eapol_flags, DEFAULT_EAPOL_FLAGS);
 #endif /* IEEE8021X_EAPOL */
 	for (i = 0; i < 4; i++)
@@ -776,7 +776,7 @@
 #ifdef IEEE8021X_EAPOL
 	INT_DEF(eap_workaround, DEFAULT_EAP_WORKAROUND);
 	STR(pac_file);
-	INT_DEF(fragment_size, DEFAULT_FRAGMENT_SIZE);
+	INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
 #endif /* IEEE8021X_EAPOL */
 	INT(mode);
 	INT(proactive_key_caching);

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface.c Fri Feb  1 14:38:48 2008
@@ -80,6 +80,7 @@
 					     char *addr)
 {
 	u8 bssid[ETH_ALEN];
+	struct wpa_ssid *ssid = wpa_s->current_ssid;
 
 	if (hwaddr_aton(addr, bssid)) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE PREAUTH: invalid address "
@@ -89,7 +90,7 @@
 
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE PREAUTH " MACSTR, MAC2STR(bssid));
 	rsn_preauth_deinit(wpa_s->wpa);
-	if (rsn_preauth_init(wpa_s->wpa, bssid, wpa_s->current_ssid))
+	if (rsn_preauth_init(wpa_s->wpa, bssid, ssid ? &ssid->eap : NULL))
 		return -1;
 
 	return 0;
@@ -143,6 +144,7 @@
 	char *pos, *id_pos;
 	int id;
 	struct wpa_ssid *ssid;
+	struct eap_peer_config *eap;
 
 	pos = os_strchr(rsp, '-');
 	if (pos == NULL)
@@ -164,45 +166,46 @@
 			   "to update", id);
 		return -1;
 	}
+	eap = &ssid->eap;
 
 	if (os_strcmp(rsp, "IDENTITY") == 0) {
-		os_free(ssid->identity);
-		ssid->identity = (u8 *) os_strdup(pos);
-		ssid->identity_len = os_strlen(pos);
-		ssid->pending_req_identity = 0;
+		os_free(eap->identity);
+		eap->identity = (u8 *) os_strdup(pos);
+		eap->identity_len = os_strlen(pos);
+		eap->pending_req_identity = 0;
 		if (ssid == wpa_s->current_ssid)
 			wpa_s->reassociate = 1;
 	} else if (os_strcmp(rsp, "PASSWORD") == 0) {
-		os_free(ssid->password);
-		ssid->password = (u8 *) os_strdup(pos);
-		ssid->password_len = os_strlen(pos);
-		ssid->pending_req_password = 0;
+		os_free(eap->password);
+		eap->password = (u8 *) os_strdup(pos);
+		eap->password_len = os_strlen(pos);
+		eap->pending_req_password = 0;
 		if (ssid == wpa_s->current_ssid)
 			wpa_s->reassociate = 1;
 	} else if (os_strcmp(rsp, "NEW_PASSWORD") == 0) {
-		os_free(ssid->new_password);
-		ssid->new_password = (u8 *) os_strdup(pos);
-		ssid->new_password_len = os_strlen(pos);
-		ssid->pending_req_new_password = 0;
+		os_free(eap->new_password);
+		eap->new_password = (u8 *) os_strdup(pos);
+		eap->new_password_len = os_strlen(pos);
+		eap->pending_req_new_password = 0;
 		if (ssid == wpa_s->current_ssid)
 			wpa_s->reassociate = 1;
 	} else if (os_strcmp(rsp, "PIN") == 0) {
-		os_free(ssid->pin);
-		ssid->pin = os_strdup(pos);
-		ssid->pending_req_pin = 0;
+		os_free(eap->pin);
+		eap->pin = os_strdup(pos);
+		eap->pending_req_pin = 0;
 		if (ssid == wpa_s->current_ssid)
 			wpa_s->reassociate = 1;
 	} else if (os_strcmp(rsp, "OTP") == 0) {
-		os_free(ssid->otp);
-		ssid->otp = (u8 *) os_strdup(pos);
-		ssid->otp_len = os_strlen(pos);
-		os_free(ssid->pending_req_otp);
-		ssid->pending_req_otp = NULL;
-		ssid->pending_req_otp_len = 0;
+		os_free(eap->otp);
+		eap->otp = (u8 *) os_strdup(pos);
+		eap->otp_len = os_strlen(pos);
+		os_free(eap->pending_req_otp);
+		eap->pending_req_otp = NULL;
+		eap->pending_req_otp_len = 0;
 	} else if (os_strcmp(rsp, "PASSPHRASE") == 0) {
-		os_free(ssid->private_key_passwd);
-		ssid->private_key_passwd = (u8 *) os_strdup(pos);
-		ssid->pending_req_passphrase = 0;
+		os_free(eap->private_key_passwd);
+		eap->private_key_passwd = (u8 *) os_strdup(pos);
+		eap->pending_req_passphrase = 0;
 		if (ssid == wpa_s->current_ssid)
 			wpa_s->reassociate = 1;
 	} else {
@@ -644,7 +647,21 @@
 	int id;
 	struct wpa_ssid *ssid;
 
-	/* cmd: "<network id>" */
+	/* cmd: "<network id>" or "all" */
+	if (os_strcmp(cmd, "all") == 0) {
+		wpa_printf(MSG_DEBUG, "CTRL_IFACE: ENABLE_NETWORK all");
+		ssid = wpa_s->conf->ssid;
+		while (ssid) {
+			if (ssid == wpa_s->current_ssid && ssid->disabled)
+				wpa_s->reassociate = 1;
+			ssid->disabled = 0;
+			ssid = ssid->next;
+		}
+		if (wpa_s->reassociate)
+			wpa_supplicant_req_scan(wpa_s, 0, 0);
+		return 0;
+	}
+
 	id = atoi(cmd);
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE: ENABLE_NETWORK id=%d", id);
 
@@ -674,7 +691,20 @@
 	int id;
 	struct wpa_ssid *ssid;
 
-	/* cmd: "<network id>" */
+	/* cmd: "<network id>" or "all" */
+	if (os_strcmp(cmd, "all") == 0) {
+		wpa_printf(MSG_DEBUG, "CTRL_IFACE: DISABLE_NETWORK all");
+		ssid = wpa_s->conf->ssid;
+		while (ssid) {
+			ssid->disabled = 1;
+			ssid = ssid->next;
+		}
+		if (wpa_s->current_ssid)
+			wpa_supplicant_disassociate(wpa_s,
+				                    WLAN_REASON_DEAUTH_LEAVING);
+		return 0;
+	}
+
 	id = atoi(cmd);
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE: DISABLE_NETWORK id=%d", id);
 
@@ -720,7 +750,23 @@
 	int id;
 	struct wpa_ssid *ssid;
 
-	/* cmd: "<network id>" */
+	/* cmd: "<network id>" or "all" */
+	if (os_strcmp(cmd, "all") == 0) {
+		wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
+		ssid = wpa_s->conf->ssid;
+		while (ssid) {
+			id = ssid->id;
+			ssid = ssid->next;
+			wpa_config_remove_network(wpa_s->conf, id);
+		}
+		if (wpa_s->current_ssid) {
+			eapol_sm_invalidate_cached_session(wpa_s->eapol);
+			wpa_supplicant_disassociate(wpa_s,
+				                    WLAN_REASON_DEAUTH_LEAVING);
+		}
+		return 0;
+	}
+
 	id = atoi(cmd);
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK id=%d", id);
 
@@ -1172,6 +1218,122 @@
 		   field);
 
 	return -1;
+}
+
+
+static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
+					 const char *cmd, char *buf,
+					 size_t buflen)
+{
+	u8 bssid[ETH_ALEN];
+	int next = 0;
+	int first = 0;
+	size_t i;
+	struct wpa_scan_results *results;
+	struct wpa_scan_res *bss;
+	int ret;
+	char *pos, *end;
+	const u8 *ie, *ie2;
+
+	if (os_strcmp(cmd, "first") == 0) {
+		first = 1;
+	} else if (os_strncmp(cmd, "next ", 5) == 0) {
+		next = 1;
+		if (hwaddr_aton(cmd + 5, bssid))
+			return -1;
+	} else {
+		if (hwaddr_aton(cmd, bssid))
+			return -1;
+	}
+
+	results = wpa_s->scan_res;
+	if (results == NULL)
+		return 0;
+
+	for (i = 0; i < results->num; i++) {
+		if (first)
+			break;
+
+		if (os_memcmp(bssid, results->res[i]->bssid, ETH_ALEN) == 0) {
+			if (next)
+				first = 1; /* pick next */
+			else
+				break;
+		}
+	}
+
+	if (i >= results->num)
+		return 0; /* no match found */
+
+	bss = results->res[i];
+	pos = buf;
+	end = buf + buflen;
+	ret = snprintf(pos, end - pos,
+		       "bssid=" MACSTR "\n"
+		       "freq=%d\n"
+		       "beacon_int=%d\n"
+		       "capabilities=0x%04x\n"
+		       "qual=%d\n"
+		       "noise=%d\n"
+		       "level=%d\n"
+		       "tsf=%016llu\n"
+		       "ie=",
+		       MAC2STR(bss->bssid), bss->freq, bss->beacon_int,
+		       bss->caps, bss->qual, bss->noise, bss->level, bss->tsf);
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	ie = (const u8 *) (bss + 1);
+	for (i = 0; i < bss->ie_len; i++) {
+		ret = snprintf(pos, end - pos, "%02x", *ie++);
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+
+	ret = snprintf(pos, end - pos, "\n");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	ret = os_snprintf(pos, end - pos, "flags=");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+	if (ie)
+		pos = wpa_supplicant_ie_txt(pos, end, "WPA", ie, 2 + ie[1]);
+	ie2 = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+	if (ie2)
+		pos = wpa_supplicant_ie_txt(pos, end, "WPA2", ie2, 2 + ie2[1]);
+	if (!ie && !ie2 && bss->caps & IEEE80211_CAP_PRIVACY) {
+		ret = os_snprintf(pos, end - pos, "[WEP]");
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+	if (bss->caps & IEEE80211_CAP_IBSS) {
+		ret = os_snprintf(pos, end - pos, "[IBSS]");
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+
+	ret = snprintf(pos, end - pos, "\n");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
+	ret = os_snprintf(pos, end - pos, "ssid=%s\n",
+			  ie ? wpa_ssid_txt(ie + 2, ie[1]) : "");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	return pos - buf;
 }
 
 
@@ -1325,6 +1487,9 @@
 	} else if (os_strcmp(buf, "INTERFACES") == 0) {
 		reply_len = wpa_supplicant_global_iface_interfaces(
 			wpa_s->global, reply, reply_size);
+	} else if (os_strncmp(buf, "BSS ", 4) == 0) {
+		reply_len = wpa_supplicant_ctrl_iface_bss(
+			wpa_s, buf + 4, reply, reply_size);
 	} else {
 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
 		reply_len = 16;

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus.c Fri Feb  1 14:38:48 2008
@@ -536,6 +536,10 @@
 			reply = wpas_dbus_iface_set_ap_scan(message, wpa_s);
 		else if (!strcmp(method, "state"))
 			reply = wpas_dbus_iface_get_state(message, wpa_s);
+		else if (!strcmp(method, "setBlobs"))
+			reply = wpas_dbus_iface_set_blobs(message, wpa_s);
+		else if (!strcmp(method, "removeBlobs"))
+			reply = wpas_dbus_iface_remove_blobs(message, wpa_s);
 	}
 
 	/* If the message was handled, send back the reply */

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.c Fri Feb  1 14:38:48 2008
@@ -431,16 +431,6 @@
 			goto error;
 	}
 
-	ie = wpa_scan_get_vendor_ie(res, WPS_IE_VENDOR_TYPE);
-	if (ie) {
-		const char *wps_ie_data;
-		len = 2 + ie[1];
-		wps_ie_data = (const char *) &ie;
-		if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpsie",
-						     wps_ie_data, len))
-			goto error;
-	}
-
 	if (res->freq) {
 		if (!wpa_dbus_dict_append_int32(&iter_dict, "frequency",
 						res->freq))
@@ -1225,3 +1215,129 @@
 
 	return reply;
 }
+
+
+/**
+ * wpas_dbus_iface_set_blobs - Store named binary blobs (ie, for certificates)
+ * @message: Pointer to incoming dbus message
+ * @global: %wpa_supplicant global data structure
+ * Returns: A dbus message containing a UINT32 indicating success (1) or
+ *          failure (0)
+ *
+ * Asks wpa_supplicant to internally store a one or more binary blobs.
+ */
+DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
+					struct wpa_supplicant *wpa_s)
+{
+	DBusMessage *reply = NULL;
+	struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING };
+	DBusMessageIter	iter, iter_dict;
+
+	dbus_message_iter_init(message, &iter);
+
+	if (!wpa_dbus_dict_open_read(&iter, &iter_dict))
+		return wpas_dbus_new_invalid_opts_error(message, NULL);
+
+	while (wpa_dbus_dict_has_dict_entry(&iter_dict)) {
+		struct wpa_config_blob *blob;
+
+		if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) {
+			reply = wpas_dbus_new_invalid_opts_error(message,
+								 NULL);
+			break;
+		}
+
+		if (entry.type != DBUS_TYPE_ARRAY ||
+		    entry.array_type != DBUS_TYPE_BYTE) {
+			reply = wpas_dbus_new_invalid_opts_error(
+				message, "Byte array expected.");
+			break;
+		}
+
+		if ((entry.array_len <= 0) || (entry.array_len > 65536) ||
+		    !strlen(entry.key)) {
+			reply = wpas_dbus_new_invalid_opts_error(
+				message, "Invalid array size.");
+			break;
+		}
+
+		blob = os_zalloc(sizeof(*blob));
+		if (blob == NULL) {
+			reply = dbus_message_new_error(
+				message, WPAS_ERROR_ADD_ERROR,
+				"Not enough memory to add blob.");
+			break;
+		}
+		blob->data = os_zalloc(entry.array_len);
+		if (blob->data == NULL) {
+			reply = dbus_message_new_error(
+				message, WPAS_ERROR_ADD_ERROR,
+				"Not enough memory to add blob data.");
+			os_free(blob);
+			break;
+		}
+
+		blob->name = os_strdup(entry.key);
+		blob->len = entry.array_len;
+		os_memcpy(blob->data, (u8 *) entry.bytearray_value,
+				entry.array_len);
+		if (blob->name == NULL || blob->data == NULL) {
+			wpa_config_free_blob(blob);
+			reply = dbus_message_new_error(
+				message, WPAS_ERROR_ADD_ERROR,
+				"Error adding blob.");
+			break;
+		}
+
+		/* Success */
+		wpa_config_remove_blob(wpa_s->conf, blob->name);
+		wpa_config_set_blob(wpa_s->conf, blob);
+		wpa_dbus_dict_entry_clear(&entry);
+	}
+	wpa_dbus_dict_entry_clear(&entry);
+
+	return reply ? reply : wpas_dbus_new_success_reply(message);
+}
+
+
+/**
+ * wpas_dbus_iface_remove_blob - Remove named binary blobs
+ * @message: Pointer to incoming dbus message
+ * @global: %wpa_supplicant global data structure
+ * Returns: A dbus message containing a UINT32 indicating success (1) or
+ *          failure (0)
+ *
+ * Asks wpa_supplicant to remove one or more previously stored binary blobs.
+ */
+DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
+					  struct wpa_supplicant *wpa_s)
+{
+	DBusMessageIter iter, array;
+	char *err_msg = NULL;
+
+	dbus_message_iter_init(message, &iter);
+
+	if ((dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) ||
+	    (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_STRING))
+		return wpas_dbus_new_invalid_opts_error(message, NULL);
+
+	dbus_message_iter_recurse(&iter, &array);
+	while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) {
+		const char *name;
+
+		dbus_message_iter_get_basic(&array, &name);
+		if (!strlen(name))
+			err_msg = "Invalid blob name.";
+
+		if (wpa_config_remove_blob(wpa_s->conf, name) != 0)
+			err_msg = "Error removing blob.";
+		dbus_message_iter_next(&array);
+	}
+
+	if (err_msg) {
+		return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR,
+					      err_msg);
+	}
+
+	return wpas_dbus_new_success_reply(message);
+}

Modified: wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/ctrl_iface_dbus_handlers.h Fri Feb  1 14:38:48 2008
@@ -71,6 +71,12 @@
 DBusMessage * wpas_dbus_iface_get_state(DBusMessage *message,
 					struct wpa_supplicant *wpa_s);
 
+DBusMessage * wpas_dbus_iface_set_blobs(DBusMessage *message,
+				        struct wpa_supplicant *wpa_s);
+
+DBusMessage * wpas_dbus_iface_remove_blobs(DBusMessage *message,
+					   struct wpa_supplicant *wpa_s);
+
 #endif /* CONFIG_CTRL_IFACE_DBUS */
 
 #endif /* CTRL_IFACE_DBUS_HANDLERS_H */

Modified: wpasupplicant/trunk/wpa_supplicant/defconfig
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/defconfig?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/defconfig (original)
+++ wpasupplicant/trunk/wpa_supplicant/defconfig Fri Feb  1 14:38:48 2008
@@ -163,9 +163,6 @@
 
 # EAP-TNC and related Trusted Network Connect support (experimental)
 #CONFIG_EAP_TNC=y
-
-# EAP-WSC for Wi-Fi Protected Setup
-#CONFIG_EAP_WSC=y
 
 # EAP-IKEv2
 #CONFIG_EAP_IKEV2=y

Modified: wpasupplicant/trunk/wpa_supplicant/doc/ctrl_iface.doxygen
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/ctrl_iface.doxygen?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/ctrl_iface.doxygen (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/ctrl_iface.doxygen Fri Feb  1 14:38:48 2008
@@ -284,6 +284,41 @@
 (note: fields are separated with tabs)
 
 
+\subsection ctrl_iface_BSS BSS
+
+Get detailed per-BSS scan results. \c BSS command can be used to
+iterate through scan results one BSS at a time and to fetch all
+information from the found BSSes. This provides access to the same
+data that is available through \c SCAN_RESULTS but in a way that
+avoids problems with large number of scan results not fitting in the
+ctrl_iface messages.
+
+There are three subcommands for the \c BSS command: "BSS first"
+requests information for the first BSS in the scan results table, "BSS
+<BSSID>" requests information for the given BSS (based on BSSID in
+00:01:02:03:04:05 format), and "BSS next <previous BSSID>" requests
+information for the BSS following the specified BSS (to allow
+iteration through the scan results).
+
+BSS information is presented in following format. Please note that new
+fields may be added to this field=value data, so the ctrl_iface user
+should be prepared to ignore values it does not understand.
+
+\verbatim
+bssid=00:09:5b:95:e0:4e
+freq=2412
+beacon_int=0
+capabilities=0x0011
+qual=51
+noise=161
+level=212
+tsf=0000000000000000
+ie=000b6a6b6d2070726976617465010180dd180050f20101000050f20401000050f20401000050f2020000
+ssid=jkm private
+\endverbatim
+
+
+
 \subsection ctrl_iface_SELECT_NETWORK SELECT_NETWORK <network id>
 
 Select a network (disable others). Network id can be received from the
@@ -293,13 +328,15 @@
 \subsection ctrl_iface_ENABLE_NETWORK ENABLE_NETWORK <network id>
 
 Enable a network. Network id can be received from the
-\c LIST_NETWORKS command output.
+\c LIST_NETWORKS command output. Special network id \c all can be
+used to enable all network.
 
 
 \subsection ctrl_iface_DISABLE_NETWORK DISABLE_NETWORK <network id>
 
 Disable a network. Network id can be received from the
-\c LIST_NETWORKS command output.
+\c LIST_NETWORKS command output. Special network id \c all can be
+used to disable all network.
 
 
 \subsection ctrl_iface_ADD_NETWORK ADD_NETWORK
@@ -313,7 +350,8 @@
 \subsection ctrl_iface_REMOVE_NETWORK REMOVE_NETWORK <network id>
 
 Remove a network. Network id can be received from the
-\c LIST_NETWORKS command output.
+\c LIST_NETWORKS command output. Special network id \c all can be
+used to remove all network.
 
 
 \subsection ctrl_iface_SET_NETWORK SET_NETWORK <network id> <variable> <value>

Modified: wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.sgml?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.sgml (original)
+++ wpasupplicant/trunk/wpa_supplicant/doc/docbook/wpa_supplicant.sgml Fri Feb  1 14:38:48 2008
@@ -12,7 +12,7 @@
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>wpa_supplicant</command>
-      <arg>-BddfhKLqqtuvwW</arg>
+      <arg>-BddfhKLqqtuvW</arg>
       <arg>-i<replaceable>ifname</replaceable></arg>
       <arg>-c<replaceable>config file</replaceable></arg>
       <arg>-D<replaceable>driver</replaceable></arg>
@@ -67,10 +67,7 @@
     <para>Before wpa_supplicant can do its work, the network interface
     must be available.  That means that the physical device must be
     present and enabled, and the driver for the device must have be
-    loaded.  Note, however, that the '-w' option of the wpa_supplicant
-    daemon instructs the daemon to continue running and to wait for
-    the interface to become available.  Without the '-w' option, the
-    daemon will exit immediately if the device is not already
+    loaded. The daemon will exit immediately if the device is not already
     available.</para>
 
     <para>After <command>wpa_supplicant</command> has configured the
@@ -454,15 +451,6 @@
       </varlistentry>
 
       <varlistentry>
-	<term>-w</term>
-	<listitem>
-	  <para>Wait for interface to be added, if needed.  Normally,
-	  <command>wpa_supplicant</command> will exit if the interface
-	  is not there yet.</para>
-	</listitem>
-      </varlistentry>
-
-      <varlistentry>
 	<term>-W</term>
 	<listitem>
 	  <para>Wait for a control interface monitor before starting.</para>
@@ -485,11 +473,10 @@
     started with:</para>
 
 <blockquote><programlisting>
-wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -iwlan0
+wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
 </programlisting></blockquote>
 
-    <para>This makes the process fork into background and wait for the wlan0
-    interface if it is not available at startup time.</para>
+    <para>This makes the process fork into background.</para>
 
     <para>The easiest way to debug problems, and to get debug log for
     bug reports, is to start <command>wpa_supplicant</command> on
@@ -754,7 +741,7 @@
 
     <blockquote><programlisting>
 if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
-    /usr/local/bin/wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -i$DEVICE
+    /usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf -i$DEVICE
 fi
     </programlisting></blockquote>
 
@@ -771,10 +758,7 @@
 
     <para>This will make <command>cardmgr</command> start
     <command>wpa_supplicant</command> when the card is plugged
-    in. <command>wpa_supplicant</command> will wait until the
-    interface is set up--either when a static IP address is configured
-    or when DHCP client is started--and will then negotiate keys with
-    the AP.</para>
+    in.</para>
   </refsect1>
 
   <refsect1>

Modified: wpasupplicant/trunk/wpa_supplicant/eap_testing.txt
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/eap_testing.txt?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/eap_testing.txt (original)
+++ wpasupplicant/trunk/wpa_supplicant/eap_testing.txt Fri Feb  1 14:38:48 2008
@@ -100,6 +100,7 @@
 EAP-FAST/TLS(auth)	-   -   -   -   -   -   -   -   -   -   -   +
 LEAP			+   -   +   +   +   +   F   +6  -   +   -   +
 EAP-TNC			+9  -   -   -   -   +   -   -   -   -   -   -
+EAP-IKEv2		+10 -   -   -   -   -   -   -   -   -   +   -
 
 1) PEAPv1 required new label, "client PEAP encryption" instead of "client EAP
    encryption", during key derivation (requires phase1="peaplabel=1" in the
@@ -116,6 +117,8 @@
    though server reported v0 as the highest supported version)
 9) only EAP-TTLS/EAP-TNC tested, i.e., test did not include proper sequence of
    client authentication followed by TNC inside the tunnel
+10) worked only with special compatibility code to match the IKEv2 server
+    implementation
 
 
 Automated tests:

Modified: wpasupplicant/trunk/wpa_supplicant/eapol_test.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/eapol_test.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/eapol_test.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/eapol_test.c Fri Feb  1 14:38:48 2008
@@ -331,7 +331,7 @@
 	eapol_conf.required_keys = 0;
 	eapol_conf.fast_reauth = wpa_s->conf->fast_reauth;
 	eapol_conf.workaround = ssid->eap_workaround;
-	eapol_sm_notify_config(wpa_s->eapol, ssid, &eapol_conf);
+	eapol_sm_notify_config(wpa_s->eapol, &ssid->eap, &eapol_conf);
 	eapol_sm_register_scard_ctx(wpa_s->eapol, wpa_s->scard);
 
 

Modified: wpasupplicant/trunk/wpa_supplicant/events.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/events.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/events.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/events.c Fri Feb  1 14:38:48 2008
@@ -30,6 +30,7 @@
 #include "ctrl_iface_dbus.h"
 #include "ieee802_11_defs.h"
 #include "blacklist.h"
+#include "wpas_glue.h"
 
 
 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
@@ -68,7 +69,7 @@
 	if (wpa_s->current_ssid && wpa_s->current_ssid != ssid)
 		eapol_sm_invalidate_cached_session(wpa_s->eapol);
 	wpa_s->current_ssid = ssid;
-	wpa_sm_set_config(wpa_s->wpa, wpa_s->current_ssid);
+	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
 	wpa_supplicant_initiate_eapol(wpa_s);
 
 	return 0;
@@ -183,14 +184,14 @@
 #ifdef IEEE8021X_EAPOL
 	int aka = 0, sim = 0, type;
 
-	if (ssid->pcsc == NULL || wpa_s->scard != NULL)
+	if (ssid->eap.pcsc == NULL || wpa_s->scard != NULL)
 		return 0;
 
-	if (ssid->eap_methods == NULL) {
+	if (ssid->eap.eap_methods == NULL) {
 		sim = 1;
 		aka = 1;
 	} else {
-		struct eap_method_type *eap = ssid->eap_methods;
+		struct eap_method_type *eap = ssid->eap.eap_methods;
 		while (eap->vendor != EAP_VENDOR_IETF ||
 		       eap->method != EAP_TYPE_NONE) {
 			if (eap->vendor == EAP_VENDOR_IETF) {
@@ -543,6 +544,8 @@
 		timeout = 1;
 		goto req_scan;
 	}
+
+	wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
 
 	wpa_supplicant_dbus_notify_scan_results(wpa_s);
 
@@ -862,7 +865,7 @@
 			break;
 		wpa_s->interface_removed = 0;
 		wpa_printf(MSG_DEBUG, "Configured interface was added.");
-		if (wpa_supplicant_driver_init(wpa_s, 1) < 0) {
+		if (wpa_supplicant_driver_init(wpa_s) < 0) {
 			wpa_printf(MSG_INFO, "Failed to initialize the driver "
 				   "after interface was added.");
 		}

Modified: wpasupplicant/trunk/wpa_supplicant/main.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/main.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/main.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/main.c Fri Feb  1 14:38:48 2008
@@ -81,7 +81,6 @@
 	       "  -u = enable DBus control interface\n"
 #endif /* CONFIG_CTRL_IFACE_DBUS */
 	       "  -v = show version\n"
-	       "  -w = wait for interface to be added, if needed\n"
 	       "  -W = wait for a control interface monitor before starting\n"
 	       "  -N = start describing new interface\n");
 
@@ -147,7 +146,7 @@
 	wpa_supplicant_fd_workaround();
 
 	for (;;) {
-		c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qtuvwW");
+		c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qtuvW");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -220,9 +219,6 @@
 			printf("%s\n", wpa_supplicant_version);
 			exitcode = 0;
 			goto out;
-		case 'w':
-			params.wait_for_interface++;
-			break;
 		case 'W':
 			params.wait_for_monitor++;
 			break;

Modified: wpasupplicant/trunk/wpa_supplicant/mlme.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/mlme.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/mlme.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/mlme.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - Client mode MLME
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, Jouni Malinen <j at w1.fi>
  * Copyright (c) 2004, Instant802 Networks, Inc.
  * Copyright (c) 2005-2006, Devicescape Software, Inc.
  *
@@ -63,6 +63,8 @@
 	int channel;
 	int freq;
 	int rssi;
+	u8 *ie;
+	size_t ie_len;
 	u8 *wpa_ie;
 	size_t wpa_ie_len;
 	u8 *rsn_ie;
@@ -806,7 +808,7 @@
 	u8 *esupp_rates = NULL;
 	int i;
 
-	buf = os_malloc(sizeof(*mgmt) + 200);
+	buf = os_malloc(sizeof(*mgmt) + 200 + wpa_s->mlme.extra_probe_ie_len);
 	if (buf == NULL) {
 		wpa_printf(MSG_DEBUG, "MLME: failed to allocate buffer for "
 			   "probe request");
@@ -854,7 +856,13 @@
 			len++;
 			supp_rates[1]++;
 		}
-		*pos = rate->rate / 5;
+		*pos++ = rate->rate / 5;
+	}
+
+	if (wpa_s->mlme.extra_probe_ie) {
+		os_memcpy(pos, wpa_s->mlme.extra_probe_ie,
+			  wpa_s->mlme.extra_probe_ie_len);
+		len += wpa_s->mlme.extra_probe_ie_len;
 	}
 
 	ieee80211_sta_tx(wpa_s, buf, len);
@@ -1384,6 +1392,7 @@
 			       struct ieee80211_sta_bss *bss)
 {
 	__ieee80211_bss_hash_del(wpa_s, bss);
+	os_free(bss->ie);
 	os_free(bss->wpa_ie);
 	os_free(bss->rsn_ie);
 	os_free(bss->wmm_ie);
@@ -1417,7 +1426,8 @@
 	int channel, invalid = 0, clen;
 	struct ieee80211_sta_bss *bss;
 	u64 timestamp;
-	u8 *pos;
+	u8 *pos, *ie_pos;
+	size_t ie_len;
 
 	if (!beacon && os_memcmp(mgmt->da, wpa_s->own_addr, ETH_ALEN))
 		return; /* ignore ProbeResp to foreign address */
@@ -1457,8 +1467,9 @@
 	}
 #endif
 
-	if (ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen,
-				   &elems) == ParseFailed)
+	ie_pos = mgmt->u.beacon.variable;
+	ie_len = len - baselen;
+	if (ieee802_11_parse_elems(ie_pos, ie_len, &elems) == ParseFailed)
 		invalid = 1;
 
 #if 0 /* FIX */
@@ -1549,6 +1560,16 @@
 
 	bss->beacon_int = le_to_host16(mgmt->u.beacon.beacon_int);
 	bss->capability = le_to_host16(mgmt->u.beacon.capab_info);
+
+	if (bss->ie == NULL || bss->ie_len < ie_len) {
+		os_free(bss->ie);
+		bss->ie = os_malloc(ie_len);
+	}
+	if (bss->ie) {
+		os_memcpy(bss->ie, ie_pos, ie_len);
+		bss->ie_len = ie_len;
+	}
+
 	if (elems.ssid && elems.ssid_len <= MAX_SSID_LEN) {
 		os_memcpy(bss->ssid, elems.ssid, elems.ssid_len);
 		bss->ssid_len = elems.ssid_len;
@@ -2483,15 +2504,16 @@
 	if (params->wpa_ie == NULL || params->wpa_ie_len == 0) {
 		wpa_s->mlme.extra_ie = NULL;
 		wpa_s->mlme.extra_ie_len = 0;
-		return 0;
-	}
-	wpa_s->mlme.extra_ie = os_malloc(params->wpa_ie_len);
-	if (wpa_s->mlme.extra_ie == NULL) {
-		wpa_s->mlme.extra_ie_len = 0;
-		return -1;
-	}
-	os_memcpy(wpa_s->mlme.extra_ie, params->wpa_ie, params->wpa_ie_len);
-	wpa_s->mlme.extra_ie_len = params->wpa_ie_len;
+	} else {
+		wpa_s->mlme.extra_ie = os_malloc(params->wpa_ie_len);
+		if (wpa_s->mlme.extra_ie == NULL) {
+			wpa_s->mlme.extra_ie_len = 0;
+			return -1;
+		}
+		os_memcpy(wpa_s->mlme.extra_ie, params->wpa_ie,
+			  params->wpa_ie_len);
+		wpa_s->mlme.extra_ie_len = params->wpa_ie_len;
+	}
 
 	wpa_s->mlme.key_mgmt = params->key_mgmt_suite;
 
@@ -2710,45 +2732,42 @@
 }
 
 
-int ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s,
-				   struct wpa_scan_result *results,
-				   size_t max_size)
+struct wpa_scan_results *
+ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s)
 {
 	size_t ap_num = 0;
-	struct wpa_scan_result *r;
+	struct wpa_scan_results *res;
+	struct wpa_scan_res *r;
 	struct ieee80211_sta_bss *bss;
 
-	os_memset(results, 0, max_size * sizeof(struct wpa_scan_result));
+	res = os_zalloc(sizeof(*res));
+	for (bss = wpa_s->mlme.sta_bss_list; bss; bss = bss->next)
+		ap_num++;
+	res->res = os_zalloc(ap_num * sizeof(struct wpa_scan_res *));
+	if (res->res == NULL) {
+		os_free(res);
+		return NULL;
+	}
+
 	for (bss = wpa_s->mlme.sta_bss_list; bss; bss = bss->next) {
-		r = &results[ap_num];
+		r = os_zalloc(sizeof(*r) + bss->ie_len);
+		if (r == NULL)
+			break;
 		os_memcpy(r->bssid, bss->bssid, ETH_ALEN);
-		os_memcpy(r->ssid, bss->ssid, bss->ssid_len);
-		r->ssid_len = bss->ssid_len;
-		if (bss->wpa_ie && bss->wpa_ie_len < SSID_MAX_WPA_IE_LEN) {
-			os_memcpy(r->wpa_ie, bss->wpa_ie, bss->wpa_ie_len);
-			r->wpa_ie_len = bss->wpa_ie_len;
-		}
-		if (bss->rsn_ie && bss->rsn_ie_len < SSID_MAX_WPA_IE_LEN) {
-			os_memcpy(r->rsn_ie, bss->rsn_ie, bss->rsn_ie_len);
-			r->rsn_ie_len = bss->rsn_ie_len;
-		}
 		r->freq = bss->freq;
+		r->beacon_int = bss->beacon_int;
 		r->caps = bss->capability;
 		r->level = bss->rssi;
-#ifdef CONFIG_IEEE80211R
-		if (bss->mdie && bss->mdie_len <= sizeof(r->mdie)) {
-			r->mdie_present = 1;
-			os_memcpy(r->mdie, bss->mdie, bss->mdie_len);
-		} else
-			r->mdie_present = 0;
-#endif /* CONFIG_IEEE80211R */
-
-		ap_num++;
-		if (ap_num >= max_size)
-			break;
-	}
-
-	return ap_num;
+		r->tsf = bss->timestamp;
+		if (bss->ie) {
+			r->ie_len = bss->ie_len;
+			os_memcpy(r + 1, bss->ie, bss->ie_len);
+		}
+
+		res->res[res->num++] = r;
+	}
+
+	return res;
 }
 
 
@@ -2913,6 +2932,8 @@
 	eloop_cancel_timeout(ieee80211_sta_scan_timer, wpa_s, NULL);
 	os_free(wpa_s->mlme.extra_ie);
 	wpa_s->mlme.extra_ie = NULL;
+	os_free(wpa_s->mlme.extra_probe_ie);
+	wpa_s->mlme.extra_probe_ie = NULL;
 	os_free(wpa_s->mlme.assocreq_ies);
 	wpa_s->mlme.assocreq_ies = NULL;
 	os_free(wpa_s->mlme.assocresp_ies);
@@ -3006,3 +3027,24 @@
 }
 
 #endif /* CONFIG_IEEE80211R */
+
+
+int ieee80211_sta_set_probe_req_ie(struct wpa_supplicant *wpa_s, const u8 *ies,
+				   size_t ies_len)
+{
+	os_free(wpa_s->mlme.extra_probe_ie);
+	wpa_s->mlme.extra_probe_ie = NULL;
+	wpa_s->mlme.extra_probe_ie_len = 0;
+
+	if (ies == NULL)
+		return 0;
+
+	wpa_s->mlme.extra_probe_ie = os_malloc(ies_len);
+	if (wpa_s->mlme.extra_probe_ie == NULL)
+		return -1;
+
+	os_memcpy(wpa_s->mlme.extra_probe_ie, ies, ies_len);
+	wpa_s->mlme.extra_probe_ie_len = ies_len;
+
+	return 0;
+}

Modified: wpasupplicant/trunk/wpa_supplicant/mlme.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/mlme.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/mlme.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/mlme.h Fri Feb  1 14:38:48 2008
@@ -35,14 +35,15 @@
 				    size_t num_hw_features);
 void ieee80211_sta_rx(struct wpa_supplicant *wpa_s, const u8 *buf, size_t len,
 		      struct ieee80211_rx_status *rx_status);
-int ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s,
-				   struct wpa_scan_result *results,
-				   size_t max_size);
+struct wpa_scan_results *
+ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s);
 int ieee80211_sta_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md,
 				const u8 *ies, size_t ies_len);
 int ieee80211_sta_send_ft_action(struct wpa_supplicant *wpa_s, u8 action,
 				 const u8 *target_ap,
 				 const u8 *ies, size_t ies_len);
+int ieee80211_sta_set_probe_req_ie(struct wpa_supplicant *wpa_s, const u8 *ies,
+				   size_t ies_len);
 
 #else /* CONFIG_CLIENT_MLME */
 
@@ -98,12 +99,10 @@
 {
 }
 
-static inline int
-ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s,
-			       struct wpa_scan_result *results,
-			       size_t max_size)
+static inline struct wpa_scan_results *
+ieee80211_sta_get_scan_results(struct wpa_supplicant *wpa_s)
 {
-	return -1;
+	return NULL;
 }
 
 static inline int
@@ -121,6 +120,13 @@
 	return -1;
 }
 
+static inline int
+ieee80211_sta_set_probe_req_ie(struct wpa_supplicant *wpa_s, const u8 *ies,
+			       size_t ies_len)
+{
+	return -1;
+}
+
 #endif /* CONFIG_CLIENT_MLME */
 
 #endif /* MLME_H */

Modified: wpasupplicant/trunk/wpa_supplicant/preauth_test.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/preauth_test.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/preauth_test.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/preauth_test.c Fri Feb  1 14:38:48 2008
@@ -124,7 +124,7 @@
 }
 
 
-static struct wpa_ssid * _wpa_supplicant_get_ssid(void *wpa_s)
+static void * wpa_supplicant_get_network_ctx(void *wpa_s)
 {
 	return wpa_supplicant_get_ssid(wpa_s);
 }
@@ -258,7 +258,7 @@
 	ctx->deauthenticate = _wpa_supplicant_deauthenticate;
 	ctx->disassociate = _wpa_supplicant_disassociate;
 	ctx->set_key = wpa_supplicant_set_key;
-	ctx->get_ssid = _wpa_supplicant_get_ssid;
+	ctx->get_network_ctx = wpa_supplicant_get_network_ctx;
 	ctx->get_bssid = wpa_supplicant_get_bssid;
 	ctx->ether_send = wpa_ether_send;
 	ctx->get_beacon_ie = wpa_supplicant_get_beacon_ie;
@@ -361,7 +361,7 @@
 	if (wpa_supplicant_scard_init(&wpa_s, wpa_s.conf->ssid))
 		return -1;
 
-	if (rsn_preauth_init(wpa_s.wpa, bssid, wpa_s.conf->ssid))
+	if (rsn_preauth_init(wpa_s.wpa, bssid, &wpa_s.conf->ssid->eap))
 		return -1;
 
 	eloop_register_timeout(30, 0, eapol_test_timeout, &preauth_test, NULL);

Modified: wpasupplicant/trunk/wpa_supplicant/scan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/scan.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/scan.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/scan.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - Scanning
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -19,6 +19,7 @@
 #include "config.h"
 #include "wpa_supplicant_i.h"
 #include "mlme.h"
+#include "uuid.h"
 
 
 static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
@@ -45,8 +46,10 @@
 	struct wpa_supplicant *wpa_s = eloop_ctx;
 	struct wpa_ssid *ssid;
 	int enabled, scan_req = 0, ret;
+	const u8 *extra_ie = NULL;
+	size_t extra_ie_len = 0;
 
-	if (wpa_s->disconnected)
+	if (wpa_s->disconnected && !wpa_s->scan_req)
 		return;
 
 	enabled = 0;
@@ -142,12 +145,15 @@
 	}
 
 	if (wpa_s->use_client_mlme) {
+		ieee80211_sta_set_probe_req_ie(wpa_s, extra_ie, extra_ie_len);
 		ret = ieee80211_sta_req_scan(wpa_s, ssid ? ssid->ssid : NULL,
 					     ssid ? ssid->ssid_len : 0);
 	} else {
+		wpa_drv_set_probe_req_ie(wpa_s, extra_ie, extra_ie_len);
 		ret = wpa_drv_scan(wpa_s, ssid ? ssid->ssid : NULL,
 				   ssid ? ssid->ssid_len : 0);
 	}
+
 	if (ret) {
 		wpa_printf(MSG_WARNING, "Failed to initiate AP scan.");
 		wpa_supplicant_req_scan(wpa_s, 10, 0);

Modified: wpasupplicant/trunk/wpa_supplicant/todo.txt
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/todo.txt?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/todo.txt (original)
+++ wpasupplicant/trunk/wpa_supplicant/todo.txt Fri Feb  1 14:38:48 2008
@@ -32,9 +32,6 @@
 - use doc/docbook/*.sgml and docbook2{txt,html,pdf} to replace README and
   web pages including the same information.. i.e., have this information only
   in one page; how to build a PDF file with all the SGML included?
-- test wait-for-interface and daemonize combinations with number of driver
-  interfaces
-  * 'test' worked with WPA-PSK
 - EAP-POTP/RSA SecurID profile (RFC 4793)
 - document wpa_gui build and consider adding it to 'make install'
 - test madwifi with pairwise=TKIP group=WEP104
@@ -91,7 +88,7 @@
   requiring every TLS wrapper to implement all functions
 - add support for encrypted configuration fields (e.g., password, psk,
   passphrase, pin)
-- wpa_gui: add support for setting and showing priority, id_str, auth_alg
+- wpa_gui: add support for setting and showing priority, auth_alg
   (open/shared for static WEP)
 
 - cleanup TLS/PEAP/TTLS/FAST fragmentation: both the handshake and Appl. Data

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_cli.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_cli.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_cli.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_cli.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - command line interface for wpa_supplicant daemon
- * Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2004-2008, 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
@@ -31,7 +31,7 @@
 
 static const char *wpa_cli_version =
 "wpa_cli v" VERSION_STR "\n"
-"Copyright (c) 2004-2007, Jouni Malinen <j at w1.fi> and contributors";
+"Copyright (c) 2004-2008, Jouni Malinen <j at w1.fi> and contributors";
 
 
 static const char *wpa_cli_license =
@@ -126,6 +126,7 @@
 "disconnected\n"
 "  scan = request new BSS scan\n"
 "  scan_results = get latest scan results\n"
+"  bss <<first> | <bssid> | <next bssid>> = get detailed scan result info\n"
 "  get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = "
 "get capabilies\n"
 "  ap_scan <value> = set ap_scan parameter\n"
@@ -891,6 +892,28 @@
 				    char *argv[])
 {
 	return wpa_ctrl_command(ctrl, "SCAN_RESULTS");
+}
+
+
+static int wpa_cli_cmd_bss(struct wpa_ctrl *ctrl, int argc, char *argv[])
+{
+	char cmd[64];
+	int res;
+
+	if (argc < 1 || argc > 2) {
+		printf("Invalid BSS command: need either one or two "
+		       "arguments\n");
+		return -1;
+	}
+
+	res = os_snprintf(cmd, sizeof(cmd), "BSS %s%s%s", argv[0],
+			  (argc == 2) ? " " : "",
+			  (argc == 2) ? argv[1] : "");
+	if (res < 0 || (size_t) res >= sizeof(cmd))
+		return -1;
+	cmd[sizeof(cmd) - 1] = '\0';
+
+	return wpa_ctrl_command(ctrl, cmd);
 }
 
 
@@ -1061,6 +1084,7 @@
 	{ "reconnect", wpa_cli_cmd_reconnect },
 	{ "scan", wpa_cli_cmd_scan },
 	{ "scan_results", wpa_cli_cmd_scan_results },
+	{ "bss", wpa_cli_cmd_bss },
 	{ "get_capability", wpa_cli_cmd_get_capability },
 	{ "reconfigure", wpa_cli_cmd_reconfigure },
 	{ "terminate", wpa_cli_cmd_terminate },

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp Fri Feb  1 14:38:48 2008
@@ -92,6 +92,8 @@
 	authChanged(auth);
 	encrSelect->setCurrentIndex(encr);
 
+	wepEnabled(auth == AUTH_NONE && encr == 1);
+
 	getEapCapa();
 }
 
@@ -134,10 +136,26 @@
 
 	if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
 		if (psklen < 8 || psklen > 64) {
-			QMessageBox::warning(this, "wpa_gui",
+			QMessageBox::warning(this, "WPA Pre-Shared Key Error",
 					     "WPA-PSK requires a passphrase "
 					     "of 8 to 63 characters\n"
 					     "or 64 hex digit PSK");
+			pskEdit->setFocus();
+			return;
+		}
+	}
+
+	if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
+		QRegExp rx("^(\\w|-)+$");
+		if (rx.indexIn(idstrEdit->text()) < 0) {
+			QMessageBox::warning(this, "Network ID Error",
+					     "Network ID String contains "
+					     "non-word characters.\n"
+					     "It must be a simple string, "
+					     "without spaces, containing\n"
+					     "only characters in this range: "
+					     "[A-Za-z0-9_-]\n");
+			idstrEdit->setFocus();
 			return;
 		}
 	}
@@ -162,11 +180,6 @@
 
 	setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(),
 			true);
-
-	if (idstrEdit->isEnabled())
-		setNetworkParam(id, "id_str",
-				idstrEdit->text().toAscii().constData(),
-				true);
 
 	const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
 	switch (auth) {
@@ -249,6 +262,18 @@
 	else if (wep3Radio->isEnabled() && wep3Radio->isChecked())
 		setNetworkParam(id, "wep_tx_keyidx", "3", false);
 
+	if (idstrEdit->isEnabled())
+		setNetworkParam(id, "id_str",
+				idstrEdit->text().toAscii().constData(),
+				true);
+
+	if (prioritySpinBox->isEnabled()) {
+		QString prio;
+		prio = prio.setNum(prioritySpinBox->value());
+		setNetworkParam(id, "priority", prio.toAscii().constData(),
+				false);
+	}
+
 	snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id);
 	reply_len = sizeof(reply);
 	wpagui->ctrlRequest(cmd, reply, &reply_len);
@@ -368,17 +393,6 @@
 		ssidEdit->setText(reply + 1);
 	}
 
-	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
-	reply_len = sizeof(reply) - 1;
-	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 &&
-	    reply_len >= 2 && reply[0] == '"') {
-		reply[reply_len] = '\0';
-		pos = strchr(reply + 1, '"');
-		if (pos)
-			*pos = '\0';
-		idstrEdit->setText(reply + 1);
-	}
-
 	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
 	reply_len = sizeof(reply) - 1;
 	int wpa = 0;
@@ -409,7 +423,7 @@
 	reply_len = sizeof(reply) - 1;
 	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
 		reply[reply_len] = '\0';
-		if (strstr(reply, "CCMP"))
+		if (strstr(reply, "CCMP") && auth != AUTH_NONE)
 			encr = 1;
 		else if (strstr(reply, "TKIP"))
 			encr = 0;
@@ -538,6 +552,25 @@
 		}
 	}
 
+	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
+	reply_len = sizeof(reply) - 1;
+	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 &&
+	    reply_len >= 2 && reply[0] == '"') {
+		reply[reply_len] = '\0';
+		pos = strchr(reply + 1, '"');
+		if (pos)
+			*pos = '\0';
+		idstrEdit->setText(reply + 1);
+	}
+
+	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d priority", network_id);
+	reply_len = sizeof(reply) - 1;
+	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1)
+	{
+		reply[reply_len] = '\0';
+		prioritySpinBox->setValue(atoi(reply));
+	}
+
 	authSelect->setCurrentIndex(auth);
 	authChanged(auth);
 	encrSelect->setCurrentIndex(encr);

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/networkconfig.ui Fri Feb  1 14:38:48 2008
@@ -1,374 +1,400 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>NetworkConfig</class>
-  <widget class="QDialog" name="NetworkConfig" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>380</width>
-        <height>430</height>
-      </rect>
-    </property>
-    <property name="windowTitle" >
-      <string>NetworkConfig</string>
-    </property>
-    <layout class="QGridLayout" >
-      <item row="1" column="3" >
-        <widget class="QPushButton" name="cancelButton" >
-          <property name="text" >
-            <string>Cancel</string>
-          </property>
-        </widget>
-      </item>
-      <item rowspan="1" row="0" column="0" colspan="4" >
-        <widget class="QFrame" name="frame9" >
-          <property name="frameShape" >
-            <enum>StyledPanel</enum>
-          </property>
-          <property name="frameShadow" >
-            <enum>Raised</enum>
-          </property>
-          <layout class="QGridLayout" >
-            <item row="0" column="0" >
-              <widget class="QLabel" name="textLabel0" >
-                <property name="text" >
-                  <string>SSID</string>
-                </property>
-              </widget>
-            </item>
-            <item row="0" column="1" >
-              <widget class="QLineEdit" name="ssidEdit" >
-                <property name="text" >
-                  <string/>
-                </property>
-                <property name="toolTip" stdset="0" >
-                  <string>Network name (Service Set IDentifier)</string>
-                </property>
-              </widget>
-            </item>
-            <item row="1" column="0" >
-              <widget class="QLabel" name="textLabel1" >
-                <property name="text" >
-                  <string>Network ID</string>
-                </property>
-              </widget>
-            </item>
-            <item row="1" column="1" >
-              <widget class="QLineEdit" name="idstrEdit" >
-                <property name="text" >
-                  <string/>
-                </property>
-                <property name="toolTip" stdset="0" >
-                  <string>Network Identification String</string>
-                </property>
-              </widget>
-            </item>
-            <item row="2" column="0" >
-              <widget class="QLabel" name="textLabel2" >
-                <property name="text" >
-                  <string>Authentication</string>
-                </property>
-              </widget>
-            </item>
-            <item row="2" column="1" >
-              <widget class="QComboBox" name="authSelect" >
-                <item>
-                  <property name="text" >
-                    <string>Plaintext or static WEP</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>IEEE 802.1X</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>WPA-Personal (PSK)</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>WPA-Enterprise (EAP)</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>WPA2-Personal (PSK)</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>WPA2-Enterprise (EAP)</string>
-                  </property>
-                </item>
-              </widget>
-            </item>
-            <item row="3" column="0" >
-              <widget class="QLabel" name="textLabel3" >
-                <property name="text" >
-                  <string>Encryption</string>
-                </property>
-              </widget>
-            </item>
-            <item row="3" column="1" >
-              <widget class="QComboBox" name="encrSelect" >
-                <item>
-                  <property name="text" >
-                    <string>None</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>WEP</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>TKIP</string>
-                  </property>
-                </item>
-                <item>
-                  <property name="text" >
-                    <string>CCMP</string>
-                  </property>
-                </item>
-              </widget>
-            </item>
-            <item row="4" column="0" >
-              <widget class="QLabel" name="textLabel4" >
-                <property name="text" >
-                  <string>PSK</string>
-                </property>
-              </widget>
-            </item>
-            <item row="4" column="1" >
-              <widget class="QLineEdit" name="pskEdit" >
-                <property name="enabled" >
-                  <bool>false</bool>
-                </property>
-                <property name="echoMode" >
-                  <enum>QLineEdit::Password</enum>
-                </property>
-                <property name="toolTip" stdset="0" >
-                  <string>WPA/WPA2 pre-shared key or passphrase</string>
-                </property>
-                <property name="whatsThis" stdset="0" >
-                  <string/>
-                </property>
-              </widget>
-            </item>
-            <item row="5" column="0" >
-              <widget class="QLabel" name="textLabel5" >
-                <property name="text" >
-                  <string>EAP method</string>
-                </property>
-              </widget>
-            </item>
-            <item row="5" column="1" >
-              <widget class="QComboBox" name="eapSelect" >
-                <property name="enabled" >
-                  <bool>false</bool>
-                </property>
-              </widget>
-            </item>
-            <item row="6" column="0" >
-              <widget class="QLabel" name="textLabel6" >
-                <property name="text" >
-                  <string>Identity</string>
-                </property>
-              </widget>
-            </item>
-            <item row="6" column="1" >
-              <widget class="QLineEdit" name="identityEdit" >
-                <property name="enabled" >
-                  <bool>false</bool>
-                </property>
-                <property name="toolTip" stdset="0" >
-                  <string>Username/Identity for EAP methods</string>
-                </property>
-              </widget>
-            </item>
-            <item row="7" column="0" >
-              <widget class="QLabel" name="textLabel7" >
-                <property name="text" >
-                  <string>Password</string>
-                </property>
-              </widget>
-            </item>
-            <item row="7" column="1" >
-              <widget class="QLineEdit" name="passwordEdit" >
-                <property name="enabled" >
-                  <bool>false</bool>
-                </property>
-                <property name="echoMode" >
-                  <enum>QLineEdit::Password</enum>
-                </property>
-                <property name="toolTip" stdset="0" >
-                  <string>Password for EAP methods</string>
-                </property>
-              </widget>
-            </item>
-            <item row="8" column="0" >
-              <widget class="QLabel" name="textLabel1_2" >
-                <property name="text" >
-                  <string>CA certificate</string>
-                </property>
-              </widget>
-            </item>
-            <item row="8" column="1" >
-              <widget class="QLineEdit" name="cacertEdit" >
-                <property name="enabled" >
-                  <bool>false</bool>
-                </property>
-              </widget>
-            </item>
-            <item rowspan="1" row="9" column="0" colspan="2" >
-              <widget class="QGroupBox" name="buttonGroup1" >
-                <property name="enabled" >
-                  <bool>true</bool>
-                </property>
-                <property name="title" >
-                  <string>WEP keys</string>
-                </property>
-                <layout class="QGridLayout" >
-                  <item row="0" column="0" >
-                    <widget class="QRadioButton" name="wep0Radio" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                      <property name="text" >
-                        <string>key 0</string>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="1" column="0" >
-                    <widget class="QRadioButton" name="wep1Radio" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                      <property name="text" >
-                        <string>key 1</string>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="3" column="0" >
-                    <widget class="QRadioButton" name="wep3Radio" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                      <property name="text" >
-                        <string>key 3</string>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="2" column="0" >
-                    <widget class="QRadioButton" name="wep2Radio" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                      <property name="text" >
-                        <string>key 2</string>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="0" column="1" >
-                    <widget class="QLineEdit" name="wep0Edit" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="1" column="1" >
-                    <widget class="QLineEdit" name="wep1Edit" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="2" column="1" >
-                    <widget class="QLineEdit" name="wep2Edit" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                    </widget>
-                  </item>
-                  <item row="3" column="1" >
-                    <widget class="QLineEdit" name="wep3Edit" >
-                      <property name="enabled" >
-                        <bool>false</bool>
-                      </property>
-                    </widget>
-                  </item>
-                </layout>
-              </widget>
-            </item>
-          </layout>
-        </widget>
+<ui version="4.0" >
+ <class>NetworkConfig</class>
+ <widget class="QDialog" name="NetworkConfig" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>410</width>
+    <height>510</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>NetworkConfig</string>
+  </property>
+  <layout class="QGridLayout" >
+   <item row="1" column="3" >
+    <widget class="QPushButton" name="cancelButton" >
+     <property name="text" >
+      <string>Cancel</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="4" >
+    <widget class="QFrame" name="frame9" >
+     <property name="frameShape" >
+      <enum>QFrame::NoFrame</enum>
+     </property>
+     <property name="frameShadow" >
+      <enum>QFrame::Plain</enum>
+     </property>
+     <layout class="QGridLayout" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="ssidLabel" >
+        <property name="text" >
+         <string>SSID</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="QLineEdit" name="ssidEdit" >
+        <property name="toolTip" >
+         <string>Network name (Service Set IDentifier)</string>
+        </property>
+        <property name="text" >
+         <string/>
+        </property>
+       </widget>
       </item>
       <item row="1" column="0" >
-        <spacer name="spacer5" >
-          <property name="sizeHint" >
-            <size>
-              <width>130</width>
-              <height>20</height>
-            </size>
-          </property>
-          <property name="sizeType" >
-            <enum>Expanding</enum>
-          </property>
-          <property name="orientation" >
-            <enum>Horizontal</enum>
-          </property>
-        </spacer>
+       <widget class="QLabel" name="authLabel" >
+        <property name="text" >
+         <string>Authentication</string>
+        </property>
+       </widget>
       </item>
       <item row="1" column="1" >
-        <widget class="QPushButton" name="addButton" >
-          <property name="text" >
-            <string>Add</string>
-          </property>
-        </widget>
-      </item>
-      <item row="1" column="2" >
-        <widget class="QPushButton" name="removeButton" >
-          <property name="enabled" >
-            <bool>false</bool>
-          </property>
-          <property name="text" >
-            <string>Remove</string>
-          </property>
-        </widget>
-      </item>
-    </layout>
-  </widget>
-  <layoutdefault spacing="6" margin="11" />
-  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
-  <tabstops>
-    <tabstop>ssidEdit</tabstop>
-    <tabstop>idstrEdit</tabstop>
-    <tabstop>authSelect</tabstop>
-    <tabstop>encrSelect</tabstop>
-    <tabstop>pskEdit</tabstop>
-    <tabstop>eapSelect</tabstop>
-    <tabstop>identityEdit</tabstop>
-    <tabstop>passwordEdit</tabstop>
-    <tabstop>cacertEdit</tabstop>
-    <tabstop>wep0Radio</tabstop>
-    <tabstop>wep1Radio</tabstop>
-    <tabstop>wep2Radio</tabstop>
-    <tabstop>wep3Radio</tabstop>
-    <tabstop>wep0Edit</tabstop>
-    <tabstop>wep1Edit</tabstop>
-    <tabstop>wep2Edit</tabstop>
-    <tabstop>wep3Edit</tabstop>
-    <tabstop>addButton</tabstop>
-    <tabstop>removeButton</tabstop>
-    <tabstop>cancelButton</tabstop>
-  </tabstops>
-  <includes>
-    <include location="global" >qtreewidget.h</include>
-  </includes>
+       <widget class="QComboBox" name="authSelect" >
+        <item>
+         <property name="text" >
+          <string>Plaintext or static WEP</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>IEEE 802.1X</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>WPA-Personal (PSK)</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>WPA-Enterprise (EAP)</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>WPA2-Personal (PSK)</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>WPA2-Enterprise (EAP)</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="2" column="0" >
+       <widget class="QLabel" name="encrLabel" >
+        <property name="text" >
+         <string>Encryption</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1" >
+       <widget class="QComboBox" name="encrSelect" >
+        <item>
+         <property name="text" >
+          <string>None</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>WEP</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>TKIP</string>
+         </property>
+        </item>
+        <item>
+         <property name="text" >
+          <string>CCMP</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="3" column="0" >
+       <widget class="QLabel" name="pskLabel" >
+        <property name="text" >
+         <string>PSK</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1" >
+       <widget class="QLineEdit" name="pskEdit" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+        <property name="toolTip" >
+         <string>WPA/WPA2 pre-shared key or passphrase</string>
+        </property>
+        <property name="whatsThis" >
+         <string/>
+        </property>
+        <property name="echoMode" >
+         <enum>QLineEdit::Password</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0" >
+       <widget class="QLabel" name="eapLabel" >
+        <property name="text" >
+         <string>EAP method</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1" >
+       <widget class="QComboBox" name="eapSelect" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="0" >
+       <widget class="QLabel" name="identityLabel" >
+        <property name="text" >
+         <string>Identity</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="1" >
+       <widget class="QLineEdit" name="identityEdit" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+        <property name="toolTip" >
+         <string>Username/Identity for EAP methods</string>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="0" >
+       <widget class="QLabel" name="passwordLabel" >
+        <property name="text" >
+         <string>Password</string>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="1" >
+       <widget class="QLineEdit" name="passwordEdit" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+        <property name="toolTip" >
+         <string>Password for EAP methods</string>
+        </property>
+        <property name="echoMode" >
+         <enum>QLineEdit::Password</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="7" column="0" >
+       <widget class="QLabel" name="cacertLabel" >
+        <property name="text" >
+         <string>CA certificate</string>
+        </property>
+       </widget>
+      </item>
+      <item row="7" column="1" >
+       <widget class="QLineEdit" name="cacertEdit" >
+        <property name="enabled" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="8" column="0" colspan="2" >
+       <widget class="QGroupBox" name="wepBox" >
+        <property name="enabled" >
+         <bool>true</bool>
+        </property>
+        <property name="title" >
+         <string>WEP keys</string>
+        </property>
+        <layout class="QGridLayout" >
+         <item row="0" column="0" >
+          <widget class="QRadioButton" name="wep0Radio" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>key 0</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0" >
+          <widget class="QRadioButton" name="wep1Radio" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>key 1</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0" >
+          <widget class="QRadioButton" name="wep3Radio" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>key 3</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0" >
+          <widget class="QRadioButton" name="wep2Radio" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>key 2</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1" >
+          <widget class="QLineEdit" name="wep0Edit" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1" >
+          <widget class="QLineEdit" name="wep1Edit" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1" >
+          <widget class="QLineEdit" name="wep2Edit" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1" >
+          <widget class="QLineEdit" name="wep3Edit" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item row="9" column="0" colspan="2" >
+       <widget class="QGroupBox" name="optionalSettingsBox" >
+        <property name="enabled" >
+         <bool>true</bool>
+        </property>
+        <property name="title" >
+         <string>Optional Settings</string>
+        </property>
+        <layout class="QGridLayout" >
+         <item row="0" column="1" >
+          <widget class="QLineEdit" name="idstrEdit" >
+           <property name="toolTip" >
+            <string>Network Identification String</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="3" >
+          <widget class="QSpinBox" name="prioritySpinBox" >
+           <property name="toolTip" >
+            <string>Network Priority</string>
+           </property>
+           <property name="maximum" >
+            <number>10000</number>
+           </property>
+           <property name="singleStep" >
+            <number>10</number>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0" >
+          <widget class="QLabel" name="idstrLabel" >
+           <property name="text" >
+            <string>IDString</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="2" >
+          <widget class="QLabel" name="priorityLabel" >
+           <property name="text" >
+            <string>Priority</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QPushButton" name="addButton" >
+     <property name="text" >
+      <string>Add</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="2" >
+    <widget class="QPushButton" name="removeButton" >
+     <property name="enabled" >
+      <bool>false</bool>
+     </property>
+     <property name="text" >
+      <string>Remove</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <tabstops>
+  <tabstop>ssidEdit</tabstop>
+  <tabstop>authSelect</tabstop>
+  <tabstop>encrSelect</tabstop>
+  <tabstop>pskEdit</tabstop>
+  <tabstop>eapSelect</tabstop>
+  <tabstop>identityEdit</tabstop>
+  <tabstop>passwordEdit</tabstop>
+  <tabstop>cacertEdit</tabstop>
+  <tabstop>wep0Radio</tabstop>
+  <tabstop>wep0Edit</tabstop>
+  <tabstop>wep1Radio</tabstop>
+  <tabstop>wep1Edit</tabstop>
+  <tabstop>wep2Radio</tabstop>
+  <tabstop>wep2Edit</tabstop>
+  <tabstop>wep3Radio</tabstop>
+  <tabstop>wep3Edit</tabstop>
+  <tabstop>idstrEdit</tabstop>
+  <tabstop>prioritySpinBox</tabstop>
+  <tabstop>addButton</tabstop>
+  <tabstop>removeButton</tabstop>
+  <tabstop>cancelButton</tabstop>
+ </tabstops>
+ <includes>
+  <include location="global" >qtreewidget.h</include>
+ </includes>
+ <resources/>
+ <connections/>
 </ui>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.cpp Fri Feb  1 14:38:48 2008
@@ -38,7 +38,6 @@
 
 ScanResults::~ScanResults()
 {
-	delete timer;
 }
 
 
@@ -52,46 +51,48 @@
 {
 	wpagui = _wpagui;
 	updateResults();
-    
-	timer = new QTimer(this);
-	connect(timer, SIGNAL(timeout()), SLOT(getResults()));
-	timer->setSingleShot(FALSE);
-	timer->start(10000);
 }
 
 
 void ScanResults::updateResults()
 {
-	char reply[8192];
+	char reply[2048];
 	size_t reply_len;
     
-	if (wpagui == NULL)
-		return;
+	scanResultsWidget->clear();
+	QString cmd("BSS first");
 
-	reply_len = sizeof(reply) - 1;
-	if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
-		return;
-	reply[reply_len] = '\0';
+	while (wpagui) {
+		reply_len = sizeof(reply) - 1;
+		if (wpagui->ctrlRequest(cmd.toAscii().constData(), reply,
+		    &reply_len) < 0)
+			break;
+		reply[reply_len] = '\0';
 
-	scanResultsWidget->clear();
+		QString bss(reply);
+		if (bss.isEmpty() || bss.startsWith("FAIL"))
+			break;
 
-	QString res(reply);
-	QStringList lines = res.split(QChar('\n'));
-	bool first = true;
-	for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++)
-	{
-		if (first) {
-			first = false;
-			continue;
+		QString ssid, bssid, freq, signal, flags;
+
+		QStringList lines = bss.split(QRegExp("\\n"));
+		for (QStringList::Iterator it = lines.begin();
+		     it != lines.end(); it++) {
+			int pos = (*it).indexOf('=') + 1;
+			if (pos < 1)
+				continue;
+
+			if ((*it).startsWith("bssid="))
+				bssid = (*it).mid(pos);
+			else if ((*it).startsWith("freq="))
+				freq = (*it).mid(pos);
+			else if ((*it).startsWith("qual="))
+				signal = (*it).mid(pos);
+			else if ((*it).startsWith("flags="))
+				flags = (*it).mid(pos);
+			else if ((*it).startsWith("ssid="))
+				ssid = (*it).mid(pos);
 		}
-
-		QStringList cols = (*it).split(QChar('\t'));
-		QString ssid, bssid, freq, signal, flags;
-		bssid = cols.count() > 0 ? cols[0] : "";
-		freq = cols.count() > 1 ? cols[1] : "";
-		signal = cols.count() > 2 ? cols[2] : "";
-		flags = cols.count() > 3 ? cols[3] : "";
-		ssid = cols.count() > 4 ? cols[4] : "";
 
 		QTreeWidgetItem *item = new QTreeWidgetItem(scanResultsWidget);
 		if (item) {
@@ -101,6 +102,12 @@
 			item->setText(3, signal);
 			item->setText(4, flags);
 		}
+
+		if (bssid.isEmpty())
+			break;
+
+		cmd = "BSS next ";
+		cmd.append(bssid);
 	}
 }
 

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/scanresults.h Fri Feb  1 14:38:48 2008
@@ -41,7 +41,6 @@
 
 private:
 	WpaGui *wpagui;
-	QTimer *timer;
 };
 
 #endif /* SCANRESULTS_H */

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.cpp Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * wpa_gui - WpaGui class
- * Copyright (c) 2005-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2005-2008, 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
@@ -18,6 +18,7 @@
 #endif
 
 #include <QMessageBox>
+#include <QCloseEvent>
 
 #include "wpagui.h"
 #include "dirent.h"
@@ -32,24 +33,48 @@
 
 	(void) statusBar();
 
+	connect(fileEventHistoryAction, SIGNAL(triggered()), this,
+		SLOT(eventHistory()));
+	connect(fileSaveConfigAction, SIGNAL(triggered()), this,
+		SLOT(saveConfig()));
+	connect(fileExitAction, SIGNAL(triggered()), this, SLOT(close()));
+	connect(networkAddAction, SIGNAL(triggered()), this,
+		SLOT(addNetwork()));
+	connect(networkEditAction, SIGNAL(triggered()), this,
+		SLOT(editSelectedNetwork()));
+	connect(networkRemoveAction, SIGNAL(triggered()), this,
+		SLOT(removeSelectedNetwork()));
+	connect(networkEnableAllAction, SIGNAL(triggered()), this,
+		SLOT(enableAllNetworks()));
+	connect(networkDisableAllAction, SIGNAL(triggered()), this,
+		SLOT(disableAllNetworks()));
+	connect(networkRemoveAllAction, SIGNAL(triggered()), this,
+		SLOT(removeAllNetworks()));
 	connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex()));
 	connect(helpContentsAction, SIGNAL(triggered()), this,
 		SLOT(helpContents()));
 	connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout()));
-	connect(fileExitAction, SIGNAL(triggered()), this, SLOT(exitApp()));
 	connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect()));
 	connect(scanButton, SIGNAL(clicked()), this, SLOT(scan()));
 	connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB()));
-	connect(fileEventHistoryAction, SIGNAL(triggered()), this,
-		SLOT(eventHistory()));
+	connect(adapterSelect, SIGNAL(activated(const QString&)), this,
+		SLOT(selectAdapter(const QString&)));
 	connect(networkSelect, SIGNAL(activated(const QString&)), this,
 		SLOT(selectNetwork(const QString&)));
-	connect(fileEdit_networkAction, SIGNAL(triggered()), this,
-		SLOT(editNetwork()));
-	connect(fileAdd_NetworkAction, SIGNAL(triggered()), this,
-		SLOT(addNetwork()));
-	connect(adapterSelect, SIGNAL(activated(const QString&)), this,
-		SLOT(selectAdapter(const QString&)));
+	connect(addNetworkButton, SIGNAL(clicked()), this, SLOT(addNetwork()));
+	connect(editNetworkButton, SIGNAL(clicked()), this,
+		SLOT(editListedNetwork()));
+	connect(removeNetworkButton, SIGNAL(clicked()), this,
+		SLOT(removeListedNetwork()));
+	connect(networkList, SIGNAL(itemSelectionChanged()), this,
+		SLOT(updateNetworkDisabledStatus()));
+	connect(enableRadioButton, SIGNAL(toggled(bool)), this,
+		SLOT(enableListedNetwork(bool)));
+	connect(disableRadioButton, SIGNAL(toggled(bool)), this,
+		SLOT(disableListedNetwork(bool)));
+	connect(scanNetworkButton, SIGNAL(clicked()), this, SLOT(scan()));
+	connect(networkList, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
+		this, SLOT(editListedNetwork()));
 
 	eh = NULL;
 	scanres = NULL;
@@ -427,12 +452,17 @@
 	char buf[2048], *start, *end, *id, *ssid, *bssid, *flags;
 	size_t len;
 	int first_active = -1;
-	bool selected = false;
+	int was_selected = -1;
+	bool current = false;
 
 	if (!networkMayHaveChanged)
 		return;
 
+	if (networkList->currentRow() >= 0)
+		was_selected = networkList->currentRow();
+
 	networkSelect->clear();
+	networkList->clear();
 
 	if (ctrl_conn == NULL)
 		return;
@@ -476,11 +506,12 @@
 		network.append(": ");
 		network.append(ssid);
 		networkSelect->addItem(network);
+		networkList->addItem(network);
 
 		if (strstr(flags, "[CURRENT]")) {
 			networkSelect->setCurrentIndex(networkSelect->count() -
 						      1);
-			selected = true;
+			current = true;
 		} else if (first_active < 0 &&
 			   strstr(flags, "[DISABLED]") == NULL)
 			first_active = networkSelect->count() - 1;
@@ -490,9 +521,21 @@
 		start = end + 1;
 	}
 
-	if (!selected && first_active >= 0)
+	if (networkSelect->count() > 1)
+		networkSelect->addItem("Select any network");
+
+	if (!current && first_active >= 0)
 		networkSelect->setCurrentIndex(first_active);
 
+	if (was_selected >= 0 && networkList->count() > 0) {
+		if (was_selected < networkList->count())
+			networkList->setCurrentRow(was_selected);
+		else
+			networkList->setCurrentRow(networkList->count() - 1);
+	}
+	else
+		networkList->setCurrentRow(networkSelect->currentIndex());
+
 	networkMayHaveChanged = false;
 }
 
@@ -512,7 +555,7 @@
 void WpaGui::helpAbout()
 {
 	QMessageBox::about(this, "wpa_gui for wpa_supplicant",
-			   "Copyright (c) 2003-2007,\n"
+			   "Copyright (c) 2003-2008,\n"
 			   "Jouni Malinen <j at w1.fi>\n"
 			   "and contributors.\n"
 			   "\n"
@@ -665,6 +708,8 @@
 
 	if (str_match(pos, WPA_CTRL_REQ))
 		processCtrlReq(pos + strlen(WPA_CTRL_REQ));
+	else if (str_match(pos, WPA_EVENT_SCAN_RESULTS) && scanres)
+		scanres->updateResults();
 }
 
 
@@ -716,37 +761,118 @@
 	char reply[10];
 	size_t reply_len = sizeof(reply);
 
-	int pos = cmd.indexOf(':');
-	if (pos < 0) {
-		printf("Invalid selectNetwork '%s'\n",
-		       cmd.toAscii().constData());
-		return;
-	}
-	cmd.truncate(pos);
+	if (cmd.startsWith("Select any")) {
+		cmd = "any";
+	} else {
+		int pos = cmd.indexOf(':');
+		if (pos < 0) {
+			printf("Invalid selectNetwork '%s'\n",
+			       cmd.toAscii().constData());
+			return;
+		}
+		cmd.truncate(pos);
+	}
 	cmd.prepend("SELECT_NETWORK ");
 	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
-}
-
-
-void WpaGui::editNetwork()
-{
-	QString sel(networkSelect->currentText());
-	int pos = sel.indexOf(':');
-	if (pos < 0) {
-		printf("Invalid selectNetwork '%s'\n",
-		       sel.toAscii().constData());
-		return;
-	}
-	sel.truncate(pos);
+	triggerUpdate();
+}
+
+
+void WpaGui::enableNetwork(const QString &sel)
+{
+	QString cmd(sel);
+	char reply[10];
+	size_t reply_len = sizeof(reply);
+
+	if (!cmd.startsWith("all")) {
+		int pos = cmd.indexOf(':');
+		if (pos < 0) {
+			printf("Invalid enableNetwork '%s'\n",
+			       cmd.toAscii().constData());
+			return;
+		}
+		cmd.truncate(pos);
+	}
+	cmd.prepend("ENABLE_NETWORK ");
+	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
+	triggerUpdate();
+}
+
+
+void WpaGui::disableNetwork(const QString &sel)
+{
+	QString cmd(sel);
+	char reply[10];
+	size_t reply_len = sizeof(reply);
+
+	if (!cmd.startsWith("all")) {
+		int pos = cmd.indexOf(':');
+		if (pos < 0) {
+			printf("Invalid disableNetwork '%s'\n",
+			       cmd.toAscii().constData());
+			return;
+		}
+		cmd.truncate(pos);
+	}
+	cmd.prepend("DISABLE_NETWORK ");
+	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
+	triggerUpdate();
+}
+
+
+void WpaGui::editNetwork(const QString &sel)
+{
+	QString cmd(sel);
+	int id = -1;
+
+	if (!cmd.startsWith("Select any")) {
+		int pos = sel.indexOf(':');
+		if (pos < 0) {
+			printf("Invalid editNetwork '%s'\n",
+			       cmd.toAscii().constData());
+			return;
+		}
+		cmd.truncate(pos);
+		id = cmd.toInt();
+	}
 
 	NetworkConfig *nc = new NetworkConfig();
 	if (nc == NULL)
 		return;
 	nc->setWpaGui(this);
 
-	nc->paramsFromConfig(sel.toInt());
+	if (id >= 0)
+		nc->paramsFromConfig(id);
+	else
+		nc->newNetwork();
+
 	nc->show();
 	nc->exec();
+}
+
+
+void WpaGui::editSelectedNetwork()
+{
+	if (networkSelect->count() < 1) {
+		QMessageBox::information(this, "No Networks",
+			                 "There are no networks to edit.\n");
+		return;
+	}
+	QString sel(networkSelect->currentText());
+	editNetwork(sel);
+}
+
+
+void WpaGui::editListedNetwork()
+{
+	if (networkList->currentRow() < 0) {
+		QMessageBox::information(this, "Select A Network",
+					 "Select a network from the list to"
+					 " edit it.\n");
+		return;
+	}
+	QString sel(networkList->currentItem()->text());
+	editNetwork(sel);
 }
 
 
@@ -767,6 +893,170 @@
 	nc->newNetwork();
 	nc->show();
 	nc->exec();
+}
+
+
+void WpaGui::removeNetwork(const QString &sel)
+{
+	QString cmd(sel);
+	char reply[10];
+	size_t reply_len = sizeof(reply);
+
+	if (cmd.startsWith("Select any"))
+		return;
+
+	if (!cmd.startsWith("all")) {
+		int pos = cmd.indexOf(':');
+		if (pos < 0) {
+			printf("Invalid removeNetwork '%s'\n",
+			       cmd.toAscii().constData());
+			return;
+		}
+		cmd.truncate(pos);
+	}
+	cmd.prepend("REMOVE_NETWORK ");
+	ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
+	triggerUpdate();
+}
+
+
+void WpaGui::removeSelectedNetwork()
+{
+	if (networkSelect->count() < 1) {
+		QMessageBox::information(this, "No Networks",
+			                 "There are no networks to remove.\n");
+		return;
+	}
+	QString sel(networkSelect->currentText());
+	removeNetwork(sel);
+}
+
+
+void WpaGui::removeListedNetwork()
+{
+	if (networkList->currentRow() < 0) {
+		QMessageBox::information(this, "Select A Network",
+					 "Select a network from the list to"
+					 " remove it.\n");
+		return;
+	}
+	QString sel(networkList->currentItem()->text());
+	removeNetwork(sel);
+}
+
+
+void WpaGui::enableAllNetworks()
+{
+	QString sel("all");
+	enableNetwork(sel);
+}
+
+
+void WpaGui::disableAllNetworks()
+{
+	QString sel("all");
+	disableNetwork(sel);
+}
+
+
+void WpaGui::removeAllNetworks()
+{
+	QString sel("all");
+	removeNetwork(sel);
+}
+
+
+int WpaGui::getNetworkDisabled(const QString &sel)
+{
+	QString cmd(sel);
+	char reply[10];
+	size_t reply_len = sizeof(reply) - 1;
+	int pos = cmd.indexOf(':');
+	if (pos < 0) {
+		printf("Invalid getNetworkDisabled '%s'\n",
+		       cmd.toAscii().constData());
+		return -1;
+	}
+	cmd.truncate(pos);
+	cmd.prepend("GET_NETWORK ");
+	cmd.append(" disabled");
+
+	if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) >= 0
+	    && reply_len >= 1) {
+		reply[reply_len] = '\0';
+		if (!str_match(reply, "FAIL"))
+			return atoi(reply);
+	}
+
+	return -1;
+}
+
+
+void WpaGui::updateNetworkDisabledStatus()
+{
+	if (networkList->currentRow() < 0)
+		return;
+
+	QString sel(networkList->currentItem()->text());
+
+	switch (getNetworkDisabled(sel)) {
+	case 0:
+		if (!enableRadioButton->isChecked())
+			enableRadioButton->setChecked(true);
+		return;
+	case 1:
+		if (!disableRadioButton->isChecked())
+			disableRadioButton->setChecked(true);
+		return;
+	}
+}
+
+
+void WpaGui::enableListedNetwork(bool enabled)
+{
+	if (networkList->currentRow() < 0 || !enabled)
+		return;
+
+	QString sel(networkList->currentItem()->text());
+
+	if (getNetworkDisabled(sel) == 1)
+		enableNetwork(sel);
+}
+
+
+void WpaGui::disableListedNetwork(bool disabled)
+{
+	if (networkList->currentRow() < 0 || !disabled)
+		return;
+
+	QString sel(networkList->currentItem()->text());
+
+	if (getNetworkDisabled(sel) == 0)
+		disableNetwork(sel);
+}
+
+
+void WpaGui::saveConfig()
+{
+	char buf[10];
+	size_t len;
+
+	len = sizeof(buf) - 1;
+	ctrlRequest("SAVE_CONFIG", buf, &len);
+
+	buf[len] = '\0';
+
+	if (str_match(buf, "FAIL"))
+		QMessageBox::warning(this, "Failed to save configuration",
+			             "The configuration could not be saved.\n"
+				     "\n"
+				     "The update_config=1 configuration option\n"
+				     "must be used for configuration saving to\n"
+				     "be permitted.\n");
+	else
+		QMessageBox::information(this, "Saved configuration",
+			                 "The current configuration was saved."
+					 "\n");
 }
 
 
@@ -780,7 +1070,7 @@
 }
 
 
-void WpaGui::exitApp()
+void WpaGui::closeEvent(QCloseEvent *event)
 {
 	if (eh) {
 		eh->close();
@@ -800,5 +1090,5 @@
 		udr = NULL;
 	}
 
-	close();
-}
+	event->accept();
+}

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.h Fri Feb  1 14:38:48 2008
@@ -32,6 +32,11 @@
 
 	virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
 	virtual void triggerUpdate();
+	virtual void editNetwork(const QString &sel);
+	virtual void removeNetwork(const QString &sel);
+	virtual void enableNetwork(const QString &sel);
+	virtual void disableNetwork(const QString &sel);
+	virtual int getNetworkDisabled(const QString &sel);
 
 public slots:
 	virtual void parse_argv();
@@ -49,13 +54,23 @@
 	virtual void receiveMsgs();
 	virtual void connectB();
 	virtual void selectNetwork(const QString &sel);
-	virtual void editNetwork();
+	virtual void editSelectedNetwork();
+	virtual void editListedNetwork();
+	virtual void removeSelectedNetwork();
+	virtual void removeListedNetwork();
 	virtual void addNetwork();
+	virtual void enableAllNetworks();
+	virtual void disableAllNetworks();
+	virtual void removeAllNetworks();
+	virtual void saveConfig();
 	virtual void selectAdapter(const QString &sel);
-	virtual void exitApp();
+	virtual void updateNetworkDisabledStatus();
+	virtual void enableListedNetwork(bool);
+	virtual void disableListedNetwork(bool);
 
 protected slots:
 	virtual void languageChange();
+	virtual void closeEvent(QCloseEvent *event);
 
 private:
 	ScanResults *scanres;

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui-qt4/wpagui.ui Fri Feb  1 14:38:48 2008
@@ -1,318 +1,419 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>WpaGui</class>
-  <widget class="QMainWindow" name="WpaGui" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>279</width>
-        <height>308</height>
-      </rect>
+<ui version="4.0" >
+ <class>WpaGui</class>
+ <widget class="QMainWindow" name="WpaGui" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>345</width>
+    <height>330</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>wpa_gui</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QLabel" name="adapterLabel" >
+      <property name="text" >
+       <string>Adapter:</string>
+      </property>
+     </widget>
+    </item>
+    <item row="0" column="1" >
+     <widget class="QComboBox" name="adapterSelect" />
+    </item>
+    <item row="1" column="0" >
+     <widget class="QLabel" name="networkLabel" >
+      <property name="text" >
+       <string>Network:</string>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="1" >
+     <widget class="QComboBox" name="networkSelect" />
+    </item>
+    <item row="2" column="0" colspan="2" >
+     <widget class="QTabWidget" name="wpaguiTab" >
+      <property name="currentIndex" >
+       <number>0</number>
+      </property>
+      <widget class="QWidget" name="statusTab" >
+       <attribute name="title" >
+        <string>Current Status</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" colspan="5" >
+         <widget class="QFrame" name="frame3" >
+          <property name="frameShape" >
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Plain</enum>
+          </property>
+          <layout class="QGridLayout" >
+           <item row="0" column="0" >
+            <widget class="QLabel" name="statusLabel" >
+             <property name="text" >
+              <string>Status:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0" >
+            <widget class="QLabel" name="lastMessageLabel" >
+             <property name="text" >
+              <string>Last message:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0" >
+            <widget class="QLabel" name="authenticationLabel" >
+             <property name="text" >
+              <string>Authentication:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="3" column="0" >
+            <widget class="QLabel" name="encryptionLabel" >
+             <property name="text" >
+              <string>Encryption:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="4" column="0" >
+            <widget class="QLabel" name="ssidLabel" >
+             <property name="text" >
+              <string>SSID:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="5" column="0" >
+            <widget class="QLabel" name="bssidLabel" >
+             <property name="text" >
+              <string>BSSID:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="6" column="0" >
+            <widget class="QLabel" name="ipAddressLabel" >
+             <property name="text" >
+              <string>IP address:</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1" >
+            <widget class="QLabel" name="textStatus" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1" colspan="3" >
+            <widget class="QLabel" name="textLastMessage" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1" >
+            <widget class="QLabel" name="textAuthentication" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="3" column="1" >
+            <widget class="QLabel" name="textEncryption" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="4" column="1" >
+            <widget class="QLabel" name="textSsid" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="5" column="1" >
+            <widget class="QLabel" name="textBssid" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+           <item row="6" column="1" >
+            <widget class="QLabel" name="textIpAddress" >
+             <property name="text" >
+              <string/>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="1" column="0" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>40</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="1" column="1" >
+         <widget class="QPushButton" name="connectButton" >
+          <property name="text" >
+           <string>Connect</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2" >
+         <widget class="QPushButton" name="disconnectButton" >
+          <property name="text" >
+           <string>Disconnect</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3" >
+         <widget class="QPushButton" name="scanButton" >
+          <property name="text" >
+           <string>Scan</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="4" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>40</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="networkconfigTab" >
+       <attribute name="title" >
+        <string>Manage Networks</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" colspan="5" >
+         <widget class="QListWidget" name="networkList" >
+          <property name="selectionRectVisible" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="1" column="0" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>61</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="1" column="1" >
+         <widget class="QRadioButton" name="enableRadioButton" >
+          <property name="text" >
+           <string>Enabled</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2" >
+         <widget class="QPushButton" name="editNetworkButton" >
+          <property name="text" >
+           <string>Edit</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3" >
+         <widget class="QPushButton" name="removeNetworkButton" >
+          <property name="text" >
+           <string>Remove</string>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="1" column="4" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>61</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="2" column="1" >
+         <widget class="QRadioButton" name="disableRadioButton" >
+          <property name="text" >
+           <string>Disabled</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2" >
+         <widget class="QPushButton" name="addNetworkButton" >
+          <property name="text" >
+           <string>Add</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="3" >
+         <widget class="QPushButton" name="scanNetworkButton" >
+          <property name="text" >
+           <string>Scan</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="MenuBar" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>345</width>
+     <height>24</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="fileMenu" >
+    <property name="title" >
+     <string>&amp;File</string>
     </property>
-    <property name="windowTitle" >
-      <string>wpa_gui</string>
+    <addaction name="fileEventHistoryAction" />
+    <addaction name="fileSaveConfigAction" />
+    <addaction name="separator" />
+    <addaction name="fileExitAction" />
+   </widget>
+   <widget class="QMenu" name="networkMenu" >
+    <property name="title" >
+     <string>&amp;Network</string>
     </property>
-    <widget class="QWidget" >
-      <layout class="QGridLayout" >
-        <item rowspan="1" row="0" column="0" colspan="2" >
-          <widget class="QLabel" name="textLabel16" >
-            <property name="text" >
-              <string>Adapter:</string>
-            </property>
-          </widget>
-        </item>
-        <item rowspan="1" row="0" column="2" colspan="2" >
-          <widget class="QComboBox" name="adapterSelect" />
-        </item>
-        <item rowspan="1" row="1" column="0" colspan="2" >
-          <widget class="QLabel" name="textLabel8" >
-            <property name="text" >
-              <string>Network:</string>
-            </property>
-          </widget>
-        </item>
-        <item rowspan="1" row="1" column="2" colspan="2" >
-          <widget class="QComboBox" name="networkSelect" />
-        </item>
-        <item rowspan="1" row="2" column="0" colspan="4" >
-          <widget class="QFrame" name="frame3" >
-            <property name="frameShape" >
-              <enum>StyledPanel</enum>
-            </property>
-            <property name="frameShadow" >
-              <enum>Raised</enum>
-            </property>
-            <layout class="QGridLayout" >
-              <item row="0" column="0" >
-                <widget class="QLabel" name="textLabel1" >
-                  <property name="text" >
-                    <string>Status:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="1" column="0" >
-                <widget class="QLabel" name="textLabel2" >
-                  <property name="text" >
-                    <string>Last message:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="2" column="0" >
-                <widget class="QLabel" name="textLabel3" >
-                  <property name="text" >
-                    <string>Authentication:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="3" column="0" >
-                <widget class="QLabel" name="textLabel4" >
-                  <property name="text" >
-                    <string>Encryption:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="4" column="0" >
-                <widget class="QLabel" name="textLabel5" >
-                  <property name="text" >
-                    <string>SSID:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="5" column="0" >
-                <widget class="QLabel" name="textLabel6" >
-                  <property name="text" >
-                    <string>BSSID:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="6" column="0" >
-                <widget class="QLabel" name="textLabel7" >
-                  <property name="text" >
-                    <string>IP address:</string>
-                  </property>
-                </widget>
-              </item>
-              <item row="0" column="1" >
-                <widget class="QLabel" name="textStatus" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item rowspan="1" row="1" column="1" colspan="3" >
-                <widget class="QLabel" name="textLastMessage" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item row="2" column="1" >
-                <widget class="QLabel" name="textAuthentication" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item row="3" column="1" >
-                <widget class="QLabel" name="textEncryption" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item row="4" column="1" >
-                <widget class="QLabel" name="textSsid" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item row="5" column="1" >
-                <widget class="QLabel" name="textBssid" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-              <item row="6" column="1" >
-                <widget class="QLabel" name="textIpAddress" >
-                  <property name="text" >
-                    <string/>
-                  </property>
-                </widget>
-              </item>
-            </layout>
-          </widget>
-        </item>
-        <item row="3" column="0" >
-          <spacer name="spacer7" >
-            <property name="sizeHint" >
-              <size>
-                <width>16</width>
-                <height>16</height>
-              </size>
-            </property>
-            <property name="sizeType" >
-              <enum>Expanding</enum>
-            </property>
-            <property name="orientation" >
-              <enum>Horizontal</enum>
-            </property>
-          </spacer>
-        </item>
-        <item row="3" column="1" >
-          <widget class="QPushButton" name="connectButton" >
-            <property name="text" >
-              <string>Connect</string>
-            </property>
-          </widget>
-        </item>
-        <item row="3" column="2" >
-          <widget class="QPushButton" name="disconnectButton" >
-            <property name="text" >
-              <string>Disconnect</string>
-            </property>
-          </widget>
-        </item>
-        <item row="3" column="3" >
-          <widget class="QPushButton" name="scanButton" >
-            <property name="text" >
-              <string>Scan</string>
-            </property>
-          </widget>
-        </item>
-      </layout>
-    </widget>
-    <widget class="QMenuBar" name="MenuBar" >
-      <widget class="QMenu" name="fileMenu" >
-        <property name="title" >
-          <string>&amp;File</string>
-        </property>
-        <addaction name="separator" />
-        <addaction name="fileEventHistoryAction" />
-        <addaction name="fileAdd_NetworkAction" />
-        <addaction name="fileEdit_networkAction" />
-        <addaction name="separator" />
-        <addaction name="fileExitAction" />
-      </widget>
-      <widget class="QMenu" name="helpMenu" >
-        <property name="title" >
-          <string>&amp;Help</string>
-        </property>
-        <addaction name="helpContentsAction" />
-        <addaction name="helpIndexAction" />
-        <addaction name="separator" />
-        <addaction name="helpAboutAction" />
-      </widget>
-      <addaction name="fileMenu" />
-      <addaction name="helpMenu" />
-    </widget>
-    <action name="fileExitAction" >
-      <property name="name" stdset="0" >
-        <string>fileExitAction</string>
-      </property>
-      <property name="iconText" >
-        <string>Exit</string>
-      </property>
-      <property name="text" >
-        <string>E&amp;xit</string>
-      </property>
-      <property name="shortcut" >
-        <string>Ctrl+Q</string>
-      </property>
-    </action>
-    <action name="helpContentsAction" >
-      <property name="name" stdset="0" >
-        <string>helpContentsAction</string>
-      </property>
-      <property name="enabled" >
-        <bool>false</bool>
-      </property>
-      <property name="iconText" >
-        <string>Contents</string>
-      </property>
-      <property name="text" >
-        <string>&amp;Contents...</string>
-      </property>
-      <property name="shortcut" >
-        <string/>
-      </property>
-    </action>
-    <action name="helpIndexAction" >
-      <property name="name" stdset="0" >
-        <string>helpIndexAction</string>
-      </property>
-      <property name="enabled" >
-        <bool>false</bool>
-      </property>
-      <property name="iconText" >
-        <string>Index</string>
-      </property>
-      <property name="text" >
-        <string>&amp;Index...</string>
-      </property>
-      <property name="shortcut" >
-        <string/>
-      </property>
-    </action>
-    <action name="helpAboutAction" >
-      <property name="name" stdset="0" >
-        <string>helpAboutAction</string>
-      </property>
-      <property name="iconText" >
-        <string>About</string>
-      </property>
-      <property name="text" >
-        <string>&amp;About</string>
-      </property>
-      <property name="shortcut" >
-        <string/>
-      </property>
-    </action>
-    <action name="fileEventHistoryAction" >
-      <property name="name" stdset="0" >
-        <string>fileEventHistoryAction</string>
-      </property>
-      <property name="iconText" >
-        <string>Event History</string>
-      </property>
-      <property name="text" >
-        <string>Event &amp;History</string>
-      </property>
-    </action>
-    <action name="fileAdd_NetworkAction" >
-      <property name="name" stdset="0" >
-        <string>fileAdd_NetworkAction</string>
-      </property>
-      <property name="iconText" >
-        <string>Add Network</string>
-      </property>
-      <property name="text" >
-        <string>&amp;Add Network</string>
-      </property>
-    </action>
-    <action name="fileEdit_networkAction" >
-      <property name="name" stdset="0" >
-        <string>fileEdit_networkAction</string>
-      </property>
-      <property name="iconText" >
-        <string>Edit Network</string>
-      </property>
-      <property name="text" >
-        <string>&amp;Edit Network</string>
-      </property>
-    </action>
+    <addaction name="networkAddAction" />
+    <addaction name="networkEditAction" />
+    <addaction name="networkRemoveAction" />
+    <addaction name="separator" />
+    <addaction name="networkEnableAllAction" />
+    <addaction name="networkDisableAllAction" />
+    <addaction name="networkRemoveAllAction" />
+   </widget>
+   <widget class="QMenu" name="helpMenu" >
+    <property name="title" >
+     <string>&amp;Help</string>
+    </property>
+    <addaction name="helpContentsAction" />
+    <addaction name="helpIndexAction" />
+    <addaction name="separator" />
+    <addaction name="helpAboutAction" />
+   </widget>
+   <addaction name="fileMenu" />
+   <addaction name="networkMenu" />
+   <addaction name="helpMenu" />
   </widget>
-  <layoutdefault spacing="6" margin="11" />
-  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
-  <includes>
-    <include location="global" >qtimer.h</include>
-    <include location="global" >qsocketnotifier.h</include>
-    <include location="local" >wpamsg.h</include>
-    <include location="local" >eventhistory.h</include>
-    <include location="local" >scanresults.h</include>
-  </includes>
+  <action name="fileEventHistoryAction" >
+   <property name="text" >
+    <string>Event &amp;History</string>
+   </property>
+  </action>
+  <action name="fileSaveConfigAction" >
+   <property name="text" >
+    <string>&amp;Save Configuration</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+S</string>
+   </property>
+  </action>
+  <action name="fileExitAction" >
+   <property name="text" >
+    <string>E&amp;xit</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+Q</string>
+   </property>
+  </action>
+  <action name="networkAddAction" >
+   <property name="text" >
+    <string>&amp;Add</string>
+   </property>
+  </action>
+  <action name="networkEditAction" >
+   <property name="text" >
+    <string>&amp;Edit</string>
+   </property>
+  </action>
+  <action name="networkRemoveAction" >
+   <property name="text" >
+    <string>&amp;Remove</string>
+   </property>
+  </action>
+  <action name="networkEnableAllAction" >
+   <property name="text" >
+    <string>E&amp;nable All</string>
+   </property>
+  </action>
+  <action name="networkDisableAllAction" >
+   <property name="text" >
+    <string>&amp;Disable All</string>
+   </property>
+  </action>
+  <action name="networkRemoveAllAction" >
+   <property name="text" >
+    <string>Re&amp;move All</string>
+   </property>
+  </action>
+  <action name="helpContentsAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="text" >
+    <string>&amp;Contents...</string>
+   </property>
+  </action>
+  <action name="helpIndexAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="text" >
+    <string>&amp;Index...</string>
+   </property>
+  </action>
+  <action name="helpAboutAction" >
+   <property name="text" >
+    <string>&amp;About</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <includes>
+  <include location="global" >qtimer.h</include>
+  <include location="global" >qsocketnotifier.h</include>
+  <include location="local" >wpamsg.h</include>
+  <include location="local" >eventhistory.h</include>
+  <include location="local" >scanresults.h</include>
+ </includes>
+ <resources/>
+ <connections/>
 </ui>

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui/networkconfig.ui.h Fri Feb  1 14:38:48 2008
@@ -360,7 +360,7 @@
     reply_len = sizeof(reply) - 1;
     if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
 	reply[reply_len] = '\0';
-	if (strstr(reply, "CCMP"))
+	if (strstr(reply, "CCMP") && auth != AUTH_NONE)
 	    encr = 1;
 	else if (strstr(reply, "TKIP"))
 	    encr = 0;

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_gui/wpagui.ui.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_gui/wpagui.ui.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_gui/wpagui.ui.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_gui/wpagui.ui.h Fri Feb  1 14:38:48 2008
@@ -466,7 +466,7 @@
 void WpaGui::helpAbout()
 {
     QMessageBox::about(this, "wpa_gui for wpa_supplicant",
-		       "Copyright (c) 2003-2005,\n"
+		       "Copyright (c) 2003-2008,\n"
 		       "Jouni Malinen <j at w1.fi>\n"
 		       "and contributors.\n"
 		       "\n"

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.c Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -41,7 +41,7 @@
 
 const char *wpa_supplicant_version =
 "wpa_supplicant v" VERSION_STR "\n"
-"Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi> and contributors";
+"Copyright (c) 2003-2008, Jouni Malinen <j at w1.fi> and contributors";
 
 const char *wpa_supplicant_license =
 "This program is free software. You can distribute it and/or modify it\n"
@@ -285,7 +285,7 @@
 	eapol_conf.eap_disabled = wpa_s->key_mgmt != WPA_KEY_MGMT_IEEE8021X &&
 		wpa_s->key_mgmt != WPA_KEY_MGMT_FT_IEEE8021X &&
 		wpa_s->key_mgmt != WPA_KEY_MGMT_IEEE8021X_NO_WPA;
-	eapol_sm_notify_config(wpa_s->eapol, ssid, &eapol_conf);
+	eapol_sm_notify_config(wpa_s->eapol, &ssid->eap, &eapol_conf);
 #endif /* IEEE8021X_EAPOL */
 }
 
@@ -1112,7 +1112,7 @@
 		eapol_sm_invalidate_cached_session(wpa_s->eapol);
 	}
 	wpa_s->current_ssid = ssid;
-	wpa_sm_set_config(wpa_s->wpa, wpa_s->current_ssid);
+	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
 	wpa_supplicant_initiate_eapol(wpa_s);
 }
 
@@ -1190,11 +1190,7 @@
 		return -1;
 	}
 
-	if (wpa_s->use_client_mlme) {
-		num = ieee80211_sta_get_scan_results(wpa_s, results,
-						     SCAN_AP_LIMIT);
-	} else
-		num = wpa_drv_get_scan_results(wpa_s, results, SCAN_AP_LIMIT);
+	num = wpa_drv_get_scan_results(wpa_s, results, SCAN_AP_LIMIT);
 	wpa_printf(MSG_DEBUG, "Scan results: %d", num);
 	if (num < 0) {
 		wpa_printf(MSG_DEBUG, "Failed to get scan results");
@@ -1300,7 +1296,15 @@
 {
 	int ret;
 
-	if (wpa_s->use_client_mlme || wpa_s->driver->get_scan_results2 == NULL)
+	if (wpa_s->use_client_mlme) {
+		wpa_scan_results_free(wpa_s->scan_res);
+		wpa_s->scan_res = ieee80211_sta_get_scan_results(wpa_s);
+		if (wpa_s->scan_res == NULL) {
+			wpa_printf(MSG_DEBUG, "Failed to get scan results");
+			ret = -1;
+		} else
+			ret = 0;
+	} else if (wpa_s->driver->get_scan_results2 == NULL)
 		ret = wpa_supplicant_get_scan_results_old(wpa_s);
 	else {
 		wpa_scan_results_free(wpa_s->scan_res);
@@ -1468,39 +1472,45 @@
 }
 
 
+void wpa_supplicant_sta_free_hw_features(struct wpa_hw_modes *hw_features,
+					 size_t num_hw_features)
+{
+	ieee80211_sta_free_hw_features(hw_features, num_hw_features);
+}
+
+
+void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
+			   struct ieee80211_rx_status *rx_status)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	ieee80211_sta_rx(wpa_s, buf, len, rx_status);
+}
+
+
 /**
  * wpa_supplicant_driver_init - Initialize driver interface parameters
  * @wpa_s: Pointer to wpa_supplicant data
- * @wait_for_interface: 0 = do not wait for the interface (reports a failure if
- * the interface is not present), 1 = wait until the interface is available
  * Returns: 0 on success, -1 on failure
  *
  * This function is called to initialize driver interface parameters.
  * wpa_drv_init() must have been called before this function to initialize the
  * driver interface.
  */
-int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
-			       int wait_for_interface)
+int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 {
 	static int interface_count = 0;
 
-	for (;;) {
-		if (wpa_s->driver->send_eapol) {
-			const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
-			if (addr)
-				os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
-			break;
-		}
+	if (wpa_s->driver->send_eapol) {
+		const u8 *addr = wpa_drv_get_mac_addr(wpa_s);
+		if (addr)
+			os_memcpy(wpa_s->own_addr, addr, ETH_ALEN);
+	} else {
 		wpa_s->l2 = l2_packet_init(wpa_s->ifname,
 					   wpa_drv_get_mac_addr(wpa_s),
 					   ETH_P_EAPOL,
 					   wpa_supplicant_rx_eapol, wpa_s, 0);
-		if (wpa_s->l2)
-			break;
-		else if (!wait_for_interface)
+		if (wpa_s->l2 == NULL)
 			return -1;
-		wpa_printf(MSG_DEBUG, "Waiting for interface..");
-		os_sleep(5, 0);
 	}
 
 	if (wpa_s->l2 && l2_packet_get_own_addr(wpa_s->l2, wpa_s->own_addr)) {
@@ -1668,17 +1678,13 @@
 }
 
 
-static int wpa_supplicant_init_iface2(struct wpa_supplicant *wpa_s,
-				      int wait_for_interface)
+static int wpa_supplicant_init_iface2(struct wpa_supplicant *wpa_s)
 {
 	const char *ifname;
 	struct wpa_driver_capa capa;
 
 	wpa_printf(MSG_DEBUG, "Initializing interface (2) '%s'",
 		   wpa_s->ifname);
-
-	if (wpa_supplicant_init_eapol(wpa_s) < 0)
-		return -1;
 
 	/* RSNA Supplicant Key Management - INITIALIZE */
 	eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
@@ -1713,7 +1719,6 @@
 			  wpa_s->bridge_ifname[0] ? wpa_s->bridge_ifname :
 			  NULL);
 	wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
-	wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
 
 	if (wpa_s->conf->dot11RSNAConfigPMKLifetime &&
 	    wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,
@@ -1739,10 +1744,14 @@
 		return -1;
 	}
 
-	if (wpa_supplicant_driver_init(wpa_s, wait_for_interface) < 0) {
-		return -1;
-	}
+	if (wpa_supplicant_driver_init(wpa_s) < 0)
+		return -1;
+
 	wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
+
+	if (wpa_supplicant_init_eapol(wpa_s) < 0)
+		return -1;
+	wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
 
 	wpa_s->ctrl_iface = wpa_supplicant_ctrl_iface_init(wpa_s);
 	if (wpa_s->ctrl_iface == NULL) {
@@ -1825,8 +1834,7 @@
 		return NULL;
 
 	if (wpa_supplicant_init_iface(wpa_s, iface) ||
-	    wpa_supplicant_init_iface2(wpa_s,
-				       global->params.wait_for_interface)) {
+	    wpa_supplicant_init_iface2(wpa_s)) {
 		wpa_printf(MSG_DEBUG, "Failed to add interface %s",
 			   iface->ifname);
 		wpa_supplicant_deinit_iface(wpa_s);
@@ -1940,7 +1948,6 @@
 	if (global == NULL)
 		return NULL;
 	global->params.daemonize = params->daemonize;
-	global->params.wait_for_interface = params->wait_for_interface;
 	global->params.wait_for_monitor = params->wait_for_monitor;
 	global->params.dbus_ctrl_interface = params->dbus_ctrl_interface;
 	if (params->pid_file)
@@ -1976,12 +1983,6 @@
 		}
 	}
 
-	if (global->params.wait_for_interface && global->params.daemonize &&
-	    wpa_supplicant_daemon(global->params.pid_file)) {
-		wpa_supplicant_deinit(global);
-		return NULL;
-	}
-
 	return global;
 }
 
@@ -1999,7 +2000,7 @@
 {
 	struct wpa_supplicant *wpa_s;
 
-	if (!global->params.wait_for_interface && global->params.daemonize &&
+	if (global->params.daemonize &&
 	    wpa_supplicant_daemon(global->params.pid_file))
 		return -1;
 

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.conf
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.conf?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.conf (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant.conf Fri Feb  1 14:38:48 2008
@@ -292,6 +292,8 @@
 #	If not set, all compiled in methods are allowed.
 #
 # identity: Identity string for EAP
+#	This field is also used to configure user NAI for
+#	EAP-PSK/PAX/SAKE/GPSK.
 # anonymous_identity: Anonymous identity string for EAP (to be used as the
 #	unencrypted identity with EAP types that support different tunnelled
 #	identity, e.g., EAP-TTLS)
@@ -299,7 +301,10 @@
 #	plaintext password (using ASCII or hex string) or a NtPasswordHash
 #	(16-byte MD4 hash of password) in hash:<32 hex digits> format.
 #	NtPasswordHash can only be used when the password is for MSCHAPv2 or
-#	MSCHAP (EAP-MSCHAPv2, EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP)
+#	MSCHAP (EAP-MSCHAPv2, EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP).
+#	EAP-PSK (128-bit PSK), EAP-PAX (128-bit PSK), and EAP-SAKE (256-bit
+#	PSK) is also configured using this field. For EAP-GPSK, this is a
+	variable length PSK.
 # ca_cert: File path to CA certificate file (PEM/DER). This file can have one
 #	or more trusted CA certificates. If ca_cert and ca_path are not
 #	included, server certificate will not be verified. This is insecure and
@@ -408,22 +413,6 @@
 #	interface used for EAPOL. The default value is suitable for most
 #	cases.
 #
-# EAP-PSK variables:
-# eappsk: 16-byte (128-bit, 32 hex digits) pre-shared key in hex format
-# nai: user NAI
-#
-# EAP-PAX variables:
-# eappsk: 16-byte (128-bit, 32 hex digits) pre-shared key in hex format
-#
-# EAP-SAKE variables:
-# eappsk: 32-byte (256-bit, 64 hex digits) pre-shared key in hex format
-#	(this is concatenation of Root-Secret-A and Root-Secret-B)
-# nai: user NAI (PEERID)
-#
-# EAP-GPSK variables:
-# eappsk: Pre-shared key in hex format (at least 128 bits, i.e., 32 hex digits)
-# nai: user NAI (ID_Client)
-#
 # EAP-FAST variables:
 # pac_file: File path for the PAC entries. wpa_supplicant will need to be able
 #	to create this file and write updates to it when PAC is being
@@ -589,9 +578,9 @@
 	ssid="eap-psk-test"
 	key_mgmt=WPA-EAP
 	eap=PSK
-	identity="eap_psk_user"
-	eappsk=06b4be19da289f475aa46a33cb793029
-	nai="eap_psk_user at example.com"
+	anonymous_identity="eap_psk_user"
+	password=06b4be19da289f475aa46a33cb793029
+	identity="eap_psk_user at example.com"
 }
 
 

Modified: wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpa_supplicant_i.h Fri Feb  1 14:38:48 2008
@@ -94,17 +94,6 @@
 	 * daemonize - Run %wpa_supplicant in the background
 	 */
 	int daemonize;
-
-	/**
-	 * wait_for_interface - Wait for the network interface to appear
-	 *
-	 * If set, %wpa_supplicant will wait until all the configured network
-	 * interfaces are available before starting processing. Please note
-	 * that in many cases, a better alternative would be to start
-	 * %wpa_supplicant without network interfaces and add the interfaces
-	 * dynamically whenever they become available.
-	 */
-	int wait_for_interface;
 
 	/**
 	 * wait_for_monitor - Wait for a monitor program before starting
@@ -184,6 +173,8 @@
 	u16 ap_capab, capab;
 	u8 *extra_ie; /* to be added to the end of AssocReq */
 	size_t extra_ie_len;
+	u8 *extra_probe_ie; /* to be added to the end of ProbeReq */
+	size_t extra_probe_ie_len;
 	wpa_key_mgmt key_mgmt;
 
 	/* The last AssocReq/Resp IEs */
@@ -349,8 +340,7 @@
 int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
 
 const char * wpa_supplicant_state_txt(int state);
-int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s,
-			       int wait_for_interface);
+int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
 int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
 			      struct wpa_scan_res *bss,
 			      struct wpa_ssid *ssid,
@@ -718,4 +708,13 @@
 	return -1;
 }
 
+static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
+					   const u8 *ies, size_t ies_len)
+{
+	if (wpa_s->driver->set_probe_req_ie)
+		return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies,
+						       ies_len);
+	return -1;
+}
+
 #endif /* WPA_SUPPLICANT_I_H */

Modified: wpasupplicant/trunk/wpa_supplicant/wpas_glue.c
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpas_glue.c?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpas_glue.c (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpas_glue.c Fri Feb  1 14:38:48 2008
@@ -25,6 +25,7 @@
 #include "pmksa_cache.h"
 #include "mlme.h"
 #include "ieee802_11_defs.h"
+#include "wpa_ctrl.h"
 #include "wpas_glue.h"
 
 
@@ -407,7 +408,7 @@
 }
 
 
-static struct wpa_ssid * _wpa_supplicant_get_ssid(void *wpa_s)
+static void * wpa_supplicant_get_network_ctx(void *wpa_s)
 {
 	return wpa_supplicant_get_ssid(wpa_s);
 }
@@ -481,6 +482,44 @@
 #endif /* CONFIG_IEEE80211R */
 
 #endif /* CONFIG_NO_WPA */
+
+
+#if defined(CONFIG_CTRL_IFACE) || !defined(CONFIG_NO_STDOUT_DEBUG)
+static void wpa_supplicant_eap_param_needed(void *ctx, const char *field,
+					    const char *txt)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	struct wpa_ssid *ssid = wpa_s->current_ssid;
+	char *buf;
+	size_t buflen;
+	int len;
+
+	if (ssid == NULL)
+		return;
+
+	buflen = 100 + os_strlen(txt) + ssid->ssid_len;
+	buf = os_malloc(buflen);
+	if (buf == NULL)
+		return;
+	len = os_snprintf(buf, buflen,
+			  WPA_CTRL_REQ "%s-%d:%s needed for SSID ",
+			  field, ssid->id, txt);
+	if (len < 0 || (size_t) len >= buflen) {
+		os_free(buf);
+		return;
+	}
+	if (ssid->ssid && buflen > len + ssid->ssid_len) {
+		os_memcpy(buf + len, ssid->ssid, ssid->ssid_len);
+		len += ssid->ssid_len;
+		buf[len] = '\0';
+	}
+	buf[buflen - 1] = '\0';
+	wpa_msg(wpa_s, MSG_INFO, "%s", buf);
+	os_free(buf);
+}
+#else /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
+#define wpa_supplicant_eap_param_needed NULL
+#endif /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
 
 
 int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s)
@@ -508,6 +547,7 @@
 	ctx->pkcs11_engine_path = wpa_s->conf->pkcs11_engine_path;
 	ctx->pkcs11_module_path = wpa_s->conf->pkcs11_module_path;
 #endif /* EAP_TLS_OPENSSL */
+	ctx->eap_param_needed = wpa_supplicant_eap_param_needed;
 	ctx->cb = wpa_supplicant_eapol_cb;
 	ctx->cb_ctx = wpa_s;
 	wpa_s->eapol = eapol_sm_init(ctx);
@@ -541,7 +581,7 @@
 	ctx->deauthenticate = _wpa_supplicant_deauthenticate;
 	ctx->disassociate = _wpa_supplicant_disassociate;
 	ctx->set_key = wpa_supplicant_set_key;
-	ctx->get_ssid = _wpa_supplicant_get_ssid;
+	ctx->get_network_ctx = wpa_supplicant_get_network_ctx;
 	ctx->get_bssid = wpa_supplicant_get_bssid;
 	ctx->ether_send = _wpa_ether_send;
 	ctx->get_beacon_ie = wpa_supplicant_get_beacon_ie;
@@ -569,3 +609,20 @@
 
 	return 0;
 }
+
+
+void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s,
+					struct wpa_ssid *ssid)
+{
+	struct rsn_supp_config conf;
+	if (ssid) {
+		os_memset(&conf, 0, sizeof(conf));
+		conf.peerkey_enabled = ssid->peerkey;
+		conf.allowed_pairwise_cipher = ssid->pairwise_cipher;
+		conf.eap_workaround = ssid->eap_workaround;
+		conf.eap_conf_ctx = &ssid->eap;
+		conf.ssid = ssid->ssid;
+		conf.ssid_len = ssid->ssid_len;
+	}
+	wpa_sm_set_config(wpa_s->wpa, ssid ? &conf : NULL);
+}

Modified: wpasupplicant/trunk/wpa_supplicant/wpas_glue.h
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/wpa_supplicant/wpas_glue.h?rev=1087&op=diff
==============================================================================
--- wpasupplicant/trunk/wpa_supplicant/wpas_glue.h (original)
+++ wpasupplicant/trunk/wpa_supplicant/wpas_glue.h Fri Feb  1 14:38:48 2008
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant - Glue code to setup EAPOL and RSN modules
- * Copyright (c) 2003-2007, Jouni Malinen <j at w1.fi>
+ * Copyright (c) 2003-2008, 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
@@ -17,5 +17,7 @@
 
 int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s);
 int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s);
+void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s,
+					struct wpa_ssid *ssid);
 
 #endif /* WPAS_GLUE_H */




More information about the Pkg-wpa-devel mailing list