aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-10-16 09:57:47 (GMT)
committerJouni Malinen <j@w1.fi>2010-10-16 09:57:47 (GMT)
commit092acb5441fc1df01036beea89608b2bb1bf8404 (patch)
tree957147e7f9cc0d0de7568bd5f7c1db2f85e090cd /wpa_supplicant/wps_supplicant.c
parent0e8da74e225fa2f6d0bd5bf40e91a8db06219061 (diff)
downloadhostap-092acb5441fc1df01036beea89608b2bb1bf8404.zip
hostap-092acb5441fc1df01036beea89608b2bb1bf8404.tar.gz
hostap-092acb5441fc1df01036beea89608b2bb1bf8404.tar.bz2
WPS: Add virtual flags in Config Methods for WPS 2.0 if needed
This is a workaround for incorrect configuration (missing virtual/physical identifier for config methods) for WPS 2.0 to allow unmodified configuration from WPS 1.0 to be used while enforcing compliant WPS 2.0 values.
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index b9c22f9..af8c4c4 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -934,6 +934,29 @@ static void wpas_wps_set_sel_reg_cb(void *ctx, int sel_reg, u16 dev_passwd_id,
}
+static u16 wps_fix_config_methods(u16 config_methods)
+{
+#ifdef CONFIG_WPS2
+ if ((config_methods &
+ (WPS_CONFIG_DISPLAY | WPS_CONFIG_VIRT_DISPLAY |
+ WPS_CONFIG_PHY_DISPLAY)) == WPS_CONFIG_DISPLAY) {
+ wpa_printf(MSG_INFO, "WPS: Converting display to "
+ "virtual_display for WPS 2.0 compliance");
+ config_methods |= WPS_CONFIG_VIRT_DISPLAY;
+ }
+ if ((config_methods &
+ (WPS_CONFIG_PUSHBUTTON | WPS_CONFIG_VIRT_PUSHBUTTON |
+ WPS_CONFIG_PHY_PUSHBUTTON)) == WPS_CONFIG_PUSHBUTTON) {
+ wpa_printf(MSG_INFO, "WPS: Converting push_button to "
+ "virtual_push_button for WPS 2.0 compliance");
+ config_methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
+ }
+#endif /* CONFIG_WPS2 */
+
+ return config_methods;
+}
+
+
int wpas_wps_init(struct wpa_supplicant *wpa_s)
{
struct wps_context *wps;
@@ -961,6 +984,7 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
os_free(wps);
return -1;
}
+ wps->config_methods = wps_fix_config_methods(wps->config_methods);
if (wpa_s->conf->device_type &&
wps_dev_type_str2bin(wpa_s->conf->device_type,
wps->dev.pri_dev_type) < 0) {
@@ -1442,6 +1466,7 @@ void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
wps->config_methods &= ~WPS_CONFIG_LABEL;
}
}
+ wps->config_methods = wps_fix_config_methods(wps->config_methods);
if (wpa_s->conf->changed_parameters & CFG_CHANGED_DEVICE_TYPE) {
if (wpa_s->conf->device_type &&