aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-01-12 17:20:20 (GMT)
committerJouni Malinen <j@w1.fi>2008-01-12 17:20:20 (GMT)
commit9e5fdfec60c5452db7dd5250fc2c7eb351b45dfd (patch)
tree5b3fc6cc2b95a74f833e64aa44b4ea4e60826ba0 /hostapd
parente136ba74dc9bc11e22baa5d9fa5c1b8ee0d02d14 (diff)
downloadhostap-history-9e5fdfec60c5452db7dd5250fc2c7eb351b45dfd.zip
hostap-history-9e5fdfec60c5452db7dd5250fc2c7eb351b45dfd.tar.gz
hostap-history-9e5fdfec60c5452db7dd5250fc2c7eb351b45dfd.tar.bz2
WPS: Moved device attributes into a common data structure
This makes it easier to pass full set of attributes to functions and to share common functions for processing these attributes.
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/wps_hostapd.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index 29611d3..be12b77 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -173,11 +173,11 @@ int hostapd_init_wps(struct hostapd_data *hapd,
cfg.uuid = hapd->conf->uuid;
cfg.ssid = (const u8 *) hapd->conf->ssid.ssid;
cfg.ssid_len = hapd->conf->ssid.ssid_len;
- cfg.device_name = hapd->conf->device_name;
- cfg.manufacturer = hapd->conf->manufacturer;
- cfg.model_name = hapd->conf->model_name;
- cfg.model_number = hapd->conf->model_number;
- cfg.serial_number = hapd->conf->serial_number;
+ cfg.dev.device_name = hapd->conf->device_name;
+ cfg.dev.manufacturer = hapd->conf->manufacturer;
+ cfg.dev.model_name = hapd->conf->model_name;
+ cfg.dev.model_number = hapd->conf->model_number;
+ cfg.dev.serial_number = hapd->conf->serial_number;
if (hapd->conf->config_methods) {
char *m = hapd->conf->config_methods;
if (os_strstr(m, "label"))
@@ -189,7 +189,31 @@ int hostapd_init_wps(struct hostapd_data *hapd,
if (os_strstr(m, "keypad"))
cfg.config_methods |= WPS_CONFIG_KEYPAD;
}
- cfg.os_version = WPA_GET_BE32(hapd->conf->os_version);
+ if (hapd->conf->device_type) {
+ char *pos;
+ u8 oui[4];
+ /* <categ>-<OUI>-<subcateg> */
+ cfg.dev.categ = atoi(hapd->conf->device_type);
+ pos = os_strchr(hapd->conf->device_type, '-');
+ if (pos == NULL) {
+ wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
+ return -1;
+ }
+ pos++;
+ if (hexstr2bin(pos, oui, 4)) {
+ wpa_printf(MSG_ERROR, "WPS: Invalid device_type OUI");
+ return -1;
+ }
+ cfg.dev.oui = WPA_GET_BE32(oui);
+ pos = os_strchr(pos, '-');
+ if (pos == NULL) {
+ wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
+ return -1;
+ }
+ pos++;
+ cfg.dev.sub_categ = atoi(pos);
+ }
+ cfg.dev.os_version = WPA_GET_BE32(hapd->conf->os_version);
if (conf->wpa & WPA_PROTO_RSN) {
if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)