aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-12-21 13:59:25 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-21 13:59:25 (GMT)
commitc0e4dd9eeb96fa39cc8bd6151fbf5a7a9cc46a97 (patch)
treed376612ff9471a2b92ec23ef32a710d22a4435ca /wpa_supplicant
parentb64576fcf511dc7f705708e6640bbef76ead4b7b (diff)
downloadhostap-c0e4dd9eeb96fa39cc8bd6151fbf5a7a9cc46a97.zip
hostap-c0e4dd9eeb96fa39cc8bd6151fbf5a7a9cc46a97.tar.gz
hostap-c0e4dd9eeb96fa39cc8bd6151fbf5a7a9cc46a97.tar.bz2
WPS: Make Config Methods configurable for wpa_supplicant
This adds config_methods configuration option for wpa_supplicant following the design used in hostapd. In addition, the string is now parsed in common code from src/wps/wps_common.c and the list of configurable methods include all the defined methods from WPS 1.0h spec.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/config.c1
-rw-r--r--wpa_supplicant/config.h10
-rw-r--r--wpa_supplicant/config_file.c3
-rw-r--r--wpa_supplicant/config_winreg.c4
-rw-r--r--wpa_supplicant/wpa_supplicant.conf6
-rw-r--r--wpa_supplicant/wps_supplicant.c4
6 files changed, 26 insertions, 2 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index b6c5aa8..692b52f 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1671,6 +1671,7 @@ void wpa_config_free(struct wpa_config *config)
os_free(config->model_number);
os_free(config->serial_number);
os_free(config->device_type);
+ os_free(config->config_methods);
os_free(config->pssid);
os_free(config);
}
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 84eef48..bdc3553 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -298,6 +298,16 @@ struct wpa_config {
char *device_type;
/**
+ * config_methods - Config Methods
+ *
+ * This is a space-separated list of supported WPS configuration
+ * methods. For example, "label display push_button keypad".
+ * Available methods: usba ethernet label display ext_nfc_token
+ * int_nfc_token nfc_interface push_button keypad.
+ */
+ char *config_methods;
+
+ /**
* os_version - OS Version (WPS)
* 4-octet operating system version number
*/
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 07a1e8a..5b6233e 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -454,6 +454,7 @@ static const struct global_parse_data global_fields[] = {
{ STR_RANGE(serial_number, 0, 32) },
{ STR(device_type) },
{ FUNC(os_version) },
+ { STR(config_methods) },
{ INT_RANGE(wps_cred_processing, 0, 2) },
#endif /* CONFIG_WPS */
{ FUNC(country) }
@@ -878,6 +879,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (WPA_GET_BE32(config->os_version))
fprintf(f, "os_version=%08x\n",
WPA_GET_BE32(config->os_version));
+ if (config->config_methods)
+ fprintf(f, "config_methods=%s\n", config->config_methods);
if (config->wps_cred_processing)
fprintf(f, "wps_cred_processing=%d\n",
config->wps_cred_processing);
diff --git a/wpa_supplicant/config_winreg.c b/wpa_supplicant/config_winreg.c
index 456d417..6bd003b 100644
--- a/wpa_supplicant/config_winreg.c
+++ b/wpa_supplicant/config_winreg.c
@@ -249,6 +249,8 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
hk, TEXT("serial_number"));
config->device_type = wpa_config_read_reg_string(
hk, TEXT("device_type"));
+ config->config_methods = wpa_config_read_reg_string(
+ hk, TEXT("config_methods"));
if (wpa_config_read_global_os_version(config, hk))
errors++;
wpa_config_read_reg_dword(hk, TEXT("wps_cred_processing"),
@@ -569,6 +571,8 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
wpa_config_write_reg_string(hk, "serial_number",
config->serial_number);
wpa_config_write_reg_string(hk, "device_type", config->device_type);
+ wpa_config_write_reg_string(hk, "config_methods",
+ config->config_methods);
if (WPA_GET_BE32(config->os_version)) {
char vbuf[10];
os_snprintf(vbuf, sizeof(vbuf), "%08x",
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 1ee282a..d552014 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -196,6 +196,12 @@ fast_reauth=1
# 4-octet operating system version number (hex string)
#os_version=01020300
+# Config Methods
+# List of the supported configuration methods
+# Available methods: usba ethernet label display ext_nfc_token int_nfc_token
+# nfc_interface push_button keypad
+#config_methods=label display push_button keypad
+
# Credential processing
# 0 = process received credentials internally (default)
# 1 = do not process received credentials; just pass them over ctrl_iface to
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 1231d44..e7b2a7a 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -841,6 +841,8 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
wps->dev.model_name = wpa_s->conf->model_name;
wps->dev.model_number = wpa_s->conf->model_number;
wps->dev.serial_number = wpa_s->conf->serial_number;
+ wps->config_methods =
+ wps_config_methods_str2bin(wpa_s->conf->config_methods);
if (wpa_s->conf->device_type &&
wps_dev_type_str2bin(wpa_s->conf->device_type,
wps->dev.pri_dev_type) < 0) {
@@ -1116,8 +1118,6 @@ int wpas_wps_er_start(struct wpa_supplicant *wpa_s)
wps_er_refresh(wpa_s->wps_er);
return 0;
}
- wpa_s->wps->config_methods |= WPS_CONFIG_DISPLAY;
- wpa_s->wps->config_methods |= WPS_CONFIG_KEYPAD;
wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname);
if (wpa_s->wps_er == NULL)
return -1;