aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-11-29 11:38:03 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-29 11:38:03 (GMT)
commitb01c18a8ef0c26e4390c05defc29123e82ca3b0a (patch)
treee0296d2c2fa5d4e131b47e16a399a4320fefc60a /wpa_supplicant
parentb8a8c299c8ec0f24ec387794c104aefbef68caf3 (diff)
downloadhostap-06-b01c18a8ef0c26e4390c05defc29123e82ca3b0a.zip
hostap-06-b01c18a8ef0c26e4390c05defc29123e82ca3b0a.tar.gz
hostap-06-b01c18a8ef0c26e4390c05defc29123e82ca3b0a.tar.bz2
WPS: Set Request Type properly into WPS IE in ProbeReq/AssocReq
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/scan.c11
-rw-r--r--wpa_supplicant/wpa_supplicant.c3
-rw-r--r--wpa_supplicant/wps_supplicant.c9
-rw-r--r--wpa_supplicant/wps_supplicant.h6
4 files changed, 20 insertions, 9 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 0811d67..c7b2dbd 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -20,6 +20,7 @@
#include "wpa_supplicant_i.h"
#include "mlme.h"
#include "wps/wps.h"
+#include "wps_supplicant.h"
static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
@@ -42,7 +43,7 @@ static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
#ifdef CONFIG_WPS
-static int wpas_wps_in_use(struct wpa_config *conf)
+static int wpas_wps_in_use(struct wpa_config *conf, u8 *req_type)
{
struct wpa_ssid *ssid;
int wps = 0;
@@ -52,6 +53,7 @@ static int wpas_wps_in_use(struct wpa_config *conf)
continue;
wps = 1;
+ *req_type = wpas_wps_get_req_type(ssid);
if (!ssid->eap.phase1)
continue;
@@ -72,6 +74,9 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
const u8 *extra_ie = NULL;
size_t extra_ie_len = 0;
int wps = 0;
+#ifdef CONFIG_WPS
+ u8 req_type = 0;
+#endif /* CONFIG_WPS */
if (wpa_s->disconnected && !wpa_s->scan_req)
return;
@@ -159,7 +164,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
wpa_s->prev_scan_ssid = BROADCAST_SSID_SCAN;
#ifdef CONFIG_WPS
- wps = wpas_wps_in_use(wpa_s->conf);
+ wps = wpas_wps_in_use(wpa_s->conf, &req_type);
#endif /* CONFIG_WPS */
if (wpa_s->scan_res_tried == 0 && wpa_s->conf->ap_scan == 1 &&
@@ -176,7 +181,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
#ifdef CONFIG_WPS
if (wps) {
wps_ie = wps_build_probe_req_ie(wps == 2, &wpa_s->wps->dev,
- wpa_s->conf->uuid);
+ wpa_s->conf->uuid, req_type);
if (wps_ie) {
extra_ie = wpabuf_head(wps_ie);
extra_ie_len = wpabuf_len(wps_ie);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index ffe6729..8494412 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1012,7 +1012,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
}
#ifdef CONFIG_WPS
} else if (ssid->key_mgmt & WPA_KEY_MGMT_WPS) {
- struct wpabuf *wps_ie = wps_build_assoc_req_ie();
+ struct wpabuf *wps_ie;
+ wps_ie = wps_build_assoc_req_ie(wpas_wps_get_req_type(ssid));
if (wps_ie && wpabuf_len(wps_ie) <= sizeof(wpa_ie)) {
wpa_ie_len = wpabuf_len(wps_ie);
os_memcpy(wpa_ie, wpabuf_head(wps_ie), wpa_ie_len);
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 8a91a04..5b81d1d 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -18,6 +18,7 @@
#include "ieee802_11_defs.h"
#include "wpa_common.h"
#include "config.h"
+#include "eap_peer/eap.h"
#include "wpa_supplicant_i.h"
#include "wps/wps.h"
#include "wps/wps_defs.h"
@@ -171,9 +172,13 @@ static int wpa_supplicant_wps_cred(void *ctx,
}
-void * wpas_wps_get_cred_cb(void)
+u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
{
- return wpa_supplicant_wps_cred;
+ if (eap_is_wps_pbc_enrollee(&ssid->eap) ||
+ eap_is_wps_pin_enrollee(&ssid->eap))
+ return WPS_REQ_ENROLLEE;
+ else
+ return WPS_REQ_REGISTRAR;
}
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index caacc36..73e7258 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -20,7 +20,7 @@
int wpas_wps_init(struct wpa_supplicant *wpa_s);
void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
-void * wpas_wps_get_cred_cb(void);
+u8 wpas_wps_get_req_type(struct wpa_ssid *ssid);
#else /* CONFIG_WPS */
@@ -38,9 +38,9 @@ static inline int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
return 0;
}
-static inline void * wpas_wps_get_cred_cb(void)
+u8 wpas_wps_get_req_type(struct wpa_ssid *ssid)
{
- return NULL;
+ return 0;
}
#endif /* CONFIG_WPS */