]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add virt/phy flag for Display/PushButton if needed (WPS 2.0)
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 23 Sep 2010 00:45:43 +0000 (17:45 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 23 Sep 2010 00:45:43 +0000 (17:45 -0700)
This seems to be the easiest way of making sure the Config Methods
value is compliant with the WSC 2.0 specification without having
to modify the configuration file. However, this will only add the
virtual flag, so the configuration files should really be updated
to specify values that match the AP design.

src/ap/wps_hostapd.c

index f1ad1df33943ed4ef0308e923e4dbe339f294d93..2694231457e661da99e74a6e965fb1d34801df1f 100644 (file)
@@ -601,6 +601,22 @@ int hostapd_init_wps(struct hostapd_data *hapd,
                os_strdup(hapd->conf->serial_number) : NULL;
        wps->config_methods =
                wps_config_methods_str2bin(hapd->conf->config_methods);
+#ifdef CONFIG_WPS2
+       if ((wps->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");
+               wps->config_methods |= WPS_CONFIG_VIRT_DISPLAY;
+       }
+       if ((wps->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");
+               wps->config_methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
+       }
+#endif /* CONFIG_WPS2 */
        if (hapd->conf->device_type &&
            wps_dev_type_str2bin(hapd->conf->device_type,
                                 wps->dev.pri_dev_type) < 0) {