aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJean-Michel Bachot <jean-michelx.bachot@linux.intel.com>2011-03-17 09:09:49 (GMT)
committerJouni Malinen <j@w1.fi>2011-03-17 09:09:49 (GMT)
commita9e86bfb74e1ce54f5ed350fd14f16f1e5885ca6 (patch)
treefec0d53da27301ef7377157330c20bca8a6f96d3 /wpa_supplicant/wps_supplicant.c
parent13579b987b6b190824fc2d2359be12355c4a1e15 (diff)
downloadhostap-a9e86bfb74e1ce54f5ed350fd14f16f1e5885ca6.zip
hostap-a9e86bfb74e1ce54f5ed350fd14f16f1e5885ca6.tar.gz
hostap-a9e86bfb74e1ce54f5ed350fd14f16f1e5885ca6.tar.bz2
WPS: Add secondary device types into Probe Request frames
The secondary device type list is an optional attribute in the WSC IE. Signed-off-by: Jean-Michel Bachot <jean-michelx.bachot@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 1ed403c..1dac496 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1067,6 +1067,7 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
{
struct wps_context *wps;
struct wps_registrar_config rcfg;
+ int i;
wps = os_zalloc(sizeof(*wps));
if (wps == NULL)
@@ -1098,6 +1099,22 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
os_free(wps);
return -1;
}
+
+ for (i = 0; i < MAX_SEC_DEVICE_TYPES; i++) {
+ if (wpa_s->conf->sec_device_type[i] == NULL)
+ continue;
+ if (wps_dev_type_str2bin(
+ wpa_s->conf->sec_device_type[i],
+ wps->dev.sec_dev_type[wps->dev.num_sec_dev_types])
+ < 0) {
+ wpa_printf(MSG_ERROR, "WPS: Invalid sec_device_type");
+ return -1;
+ }
+ wps->dev.num_sec_dev_types++;
+ if (wps->dev.num_sec_dev_types == WPS_SEC_DEVICE_TYPES)
+ break;
+ }
+
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ; /* TODO: config */
os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
@@ -1644,6 +1661,28 @@ void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
}
+ if (wpa_s->conf->changed_parameters & CFG_CHANGED_SEC_DEVICE_TYPE) {
+ int i;
+
+ wps->dev.num_sec_dev_types = 0;
+
+ for (i = 0; i < MAX_SEC_DEVICE_TYPES; i++) {
+ if (wpa_s->conf->sec_device_type[i] == NULL)
+ continue;
+ if (wps_dev_type_str2bin(
+ wpa_s->conf->sec_device_type[i],
+ wps->dev.sec_dev_type[
+ wps->dev.num_sec_dev_types]) < 0) {
+ wpa_printf(MSG_ERROR,
+ "WPS: Invalid sec_device_type");
+ continue;
+ }
+ wps->dev.num_sec_dev_types++;
+ if (wps->dev.num_sec_dev_types == WPS_SEC_DEVICE_TYPES)
+ break;
+ }
+ }
+
if (wpa_s->conf->changed_parameters & CFG_CHANGED_OS_VERSION)
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);