WPS: Pass device data into wps_enrollee_build_probe_req_ie()
authorJouni Malinen <j@w1.fi>
Sat, 29 Nov 2008 10:19:30 +0000 (12:19 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 29 Nov 2008 10:19:30 +0000 (12:19 +0200)
Use configured device data instead of hardcoded values to generate WPS
IE for Probe Request.

src/wps/wps.h
src/wps/wps_enrollee.c
wpa_supplicant/scan.c

index e206c2d..9807caa 100644 (file)
@@ -131,6 +131,8 @@ void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
                                const struct wpabuf *wps_data);
 
 struct wpabuf * wps_enrollee_build_assoc_req_ie(void);
-struct wpabuf * wps_enrollee_build_probe_req_ie(int pbc, const u8 *uuid);
+struct wpabuf * wps_enrollee_build_probe_req_ie(int pbc,
+                                               struct wps_device_data *dev,
+                                               const u8 *uuid);
 
 #endif /* WPS_H */
index 4a0058a..f16a05b 100644 (file)
@@ -1147,21 +1147,16 @@ struct wpabuf * wps_enrollee_build_assoc_req_ie(void)
 }
 
 
-struct wpabuf * wps_enrollee_build_probe_req_ie(int pbc, const u8 *uuid)
+struct wpabuf * wps_enrollee_build_probe_req_ie(int pbc,
+                                               struct wps_device_data *dev,
+                                               const u8 *uuid)
 {
        struct wpabuf *ie;
        u8 *len;
        u16 methods;
-       struct wps_device_data dev;
 
        wpa_printf(MSG_DEBUG, "WPS: Building WPS IE for Probe Request");
 
-       /* TODO: get device data from caller */
-       os_memset(&dev, 0, sizeof(dev));
-       dev.categ = WPS_DEV_COMPUTER;
-       dev.oui = WPS_DEV_OUI_WFA;
-       dev.sub_categ = WPS_DEV_COMPUTER_PC;
-
        ie = wpabuf_alloc(200);
        if (ie == NULL)
                return NULL;
@@ -1180,7 +1175,7 @@ struct wpabuf * wps_enrollee_build_probe_req_ie(int pbc, const u8 *uuid)
            wps_build_req_type(ie, WPS_REQ_ENROLLEE) ||
            wps_build_config_methods(ie, methods) ||
            wps_build_uuid_e(ie, uuid) ||
-           wps_build_primary_dev_type(&dev, ie) ||
+           wps_build_primary_dev_type(dev, ie) ||
            wps_build_rf_bands(NULL, ie) ||
            wps_build_assoc_state(NULL, ie) ||
            wps_build_config_error(NULL, ie) ||
index 8002920..fb64ca5 100644 (file)
@@ -176,6 +176,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 #ifdef CONFIG_WPS
        if (wps) {
                wps_ie = wps_enrollee_build_probe_req_ie(wps == 2,
+                                                        &wpa_s->wps->dev,
                                                         wpa_s->conf->uuid);
                if (wps_ie) {
                        extra_ie = wpabuf_head(wps_ie);