WPS 2.0: Add Request to Enroll attribute into Probe Request
authorJouni Malinen <jouni.malinen@atheros.com>
Tue, 22 Dec 2009 23:03:15 +0000 (01:03 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 13:07:47 +0000 (06:07 -0700)
Whenever wpa_supplication is using Request Type Enrollee, it is trying
to enroll into a network. Indicate this with the explicit inclusion of
Request to Enroll attribute with value TRUE.

src/wps/wps.c
src/wps/wps_attr_build.c
src/wps/wps_i.h

index 6d4b1cb..e86021d 100644 (file)
@@ -449,7 +449,9 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
            wps_build_config_error(ie, WPS_CFG_NO_ERROR) ||
            wps_build_dev_password_id(ie, pbc ? DEV_PW_PUSHBUTTON :
                                      DEV_PW_DEFAULT) ||
-           wps_build_version2(ie)) {
+           wps_build_version2(ie) ||
+           (req_type == WPS_REQ_ENROLLEE &&
+            wps_build_req_to_enroll(ie))) {
                wpabuf_free(ie);
                return NULL;
        }
index 4de75df..8068654 100644 (file)
@@ -337,3 +337,13 @@ int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps)
        return 0;
 }
 #endif /* CONFIG_WPS_OOB */
+
+
+int wps_build_req_to_enroll(struct wpabuf *msg)
+{
+       wpa_printf(MSG_DEBUG, "WPS:  * Request to Enroll (1)");
+       wpabuf_put_be16(msg, ATTR_REQUEST_TO_ENROLL);
+       wpabuf_put_be16(msg, 1);
+       wpabuf_put_u8(msg, 1);
+       return 0;
+}
index d4378c3..2110a54 100644 (file)
@@ -247,6 +247,7 @@ int wps_build_encr_type_flags(struct wps_data *wps, struct wpabuf *msg);
 int wps_build_conn_type_flags(struct wps_data *wps, struct wpabuf *msg);
 int wps_build_assoc_state(struct wps_data *wps, struct wpabuf *msg);
 int wps_build_oob_dev_password(struct wpabuf *msg, struct wps_context *wps);
+int wps_build_req_to_enroll(struct wpabuf *msg);
 
 /* wps_attr_process.c */
 int wps_process_authenticator(struct wps_data *wps, const u8 *authenticator,