]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Set Probe Request config methods based on configuration
authorBharat Chakravarty <bchakrav@qca.qualcomm.com>
Thu, 1 Sep 2011 12:24:45 +0000 (15:24 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 1 Sep 2011 12:24:45 +0000 (15:24 +0300)
Instead of hardcoding the Config Methods attribute value in Probe
Request frames, set this based on the configured parameter
config_methods to allow correct set of methods to be advertised.

src/wps/wps.c
src/wps/wps.h
wpa_supplicant/wps_supplicant.c

index 101ae1d0b94eb4b19b2b3a5e9e6dfed7dce41492..9413ece0ab351434784632347264386ecc351d53 100644 (file)
@@ -456,7 +456,6 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
                                       const u8 *req_dev_types)
 {
        struct wpabuf *ie;
-       u16 methods = 0;
 
        wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for Probe Request");
 
@@ -464,35 +463,9 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
        if (ie == NULL)
                return NULL;
 
-       methods |= WPS_CONFIG_PUSHBUTTON;
-#ifdef CONFIG_WPS2
-       /*
-        * TODO: Should figure out whether this device has a physical or
-        * virtual pushbutton.
-        */
-       methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
-#endif /* CONFIG_WPS2 */
-
-       /*
-        * TODO: Should figure out whether this Probe Request was triggered
-        * using physical or virtual display. Also, if the device has a PIN on
-        * a label, that should be indicated here.
-        */
-       methods |= WPS_CONFIG_DISPLAY |
-#ifdef CONFIG_WPS2
-               WPS_CONFIG_VIRT_DISPLAY |
-#endif /* CONFIG_WPS2 */
-               WPS_CONFIG_KEYPAD;
-#ifdef CONFIG_WPS_UFD
-       methods |= WPS_CONFIG_USBA;
-#endif /* CONFIG_WPS_UFD */
-#ifdef CONFIG_WPS_NFC
-       methods |= WPS_CONFIG_NFC_INTERFACE;
-#endif /* CONFIG_WPS_NFC */
-
        if (wps_build_version(ie) ||
            wps_build_req_type(ie, req_type) ||
-           wps_build_config_methods(ie, methods) ||
+           wps_build_config_methods(ie, dev->config_methods) ||
            wps_build_uuid_e(ie, uuid) ||
            wps_build_primary_dev_type(dev, ie) ||
            wps_build_rf_bands(dev, ie) ||
index 2cbbc1855ab1a67f88e607fcbc5e49de66088d19..e2cd4a7bd13763095ea213c3c728e06ad8afe5e6 100644 (file)
@@ -99,6 +99,7 @@ struct wps_device_data {
        u8 num_sec_dev_types;
        u32 os_version;
        u8 rf_bands;
+       u16 config_methods;
        struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
 
        int p2p;
index 222c8fc8132d356145f05ea45b094a8834b0266f..3400365b5a6b0db3a152343d79e9ee35b53cac0b 100644 (file)
@@ -1142,6 +1142,7 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
                return -1;
        }
        wps->config_methods = wps_fix_config_methods(wps->config_methods);
+       wps->dev.config_methods = wps->config_methods;
        os_memcpy(wps->dev.pri_dev_type, wpa_s->conf->device_type,
                  WPS_DEV_TYPE_LEN);