WPS: Add secondary device types into Probe Request frames

The secondary device type list is an optional attribute in the WSC IE.

Signed-off-by: Jean-Michel Bachot <jean-michelx.bachot@linux.intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Jean-Michel Bachot 2011-03-17 11:09:49 +02:00 committed by Jouni Malinen
parent 13579b987b
commit a9e86bfb74
5 changed files with 64 additions and 3 deletions

View file

@ -486,10 +486,9 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
wps_build_model_name(dev, ie) ||
wps_build_model_number(dev, ie) ||
wps_build_dev_name(dev, ie) ||
wps_build_wfa_ext(ie, req_type == WPS_REQ_ENROLLEE, NULL, 0)
#else /* CONFIG_WPS2 */
0
wps_build_wfa_ext(ie, req_type == WPS_REQ_ENROLLEE, NULL, 0) ||
#endif /* CONFIG_WPS2 */
wps_build_secondary_dev_type(dev, ie)
) {
wpabuf_free(ie);
return NULL;

View file

@ -73,6 +73,8 @@ struct wps_credential {
* @model_number: Model Number (0..32 octets encoded in UTF-8)
* @serial_number: Serial Number (0..32 octets encoded in UTF-8)
* @pri_dev_type: Primary Device Type
* @sec_dev_type: Array of secondary device types
* @num_sec_dev_type: Number of secondary device types
* @os_version: OS Version
* @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ flags)
* @p2p: Whether the device is a P2P device
@ -85,6 +87,9 @@ struct wps_device_data {
char *model_number;
char *serial_number;
u8 pri_dev_type[WPS_DEV_TYPE_LEN];
#define WPS_SEC_DEVICE_TYPES 5
u8 sec_dev_type[WPS_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
u8 num_sec_dev_types;
u32 os_version;
u8 rf_bands;

View file

@ -126,6 +126,22 @@ int wps_build_primary_dev_type(struct wps_device_data *dev, struct wpabuf *msg)
}
int wps_build_secondary_dev_type(struct wps_device_data *dev,
struct wpabuf *msg)
{
if (!dev->num_sec_dev_types)
return 0;
wpa_printf(MSG_DEBUG, "WPS: * Secondary Device Type");
wpabuf_put_be16(msg, ATTR_SECONDARY_DEV_TYPE_LIST);
wpabuf_put_be16(msg, WPS_DEV_TYPE_LEN * dev->num_sec_dev_types);
wpabuf_put_data(msg, dev->sec_dev_type,
WPS_DEV_TYPE_LEN * dev->num_sec_dev_types);
return 0;
}
int wps_build_dev_name(struct wps_device_data *dev, struct wpabuf *msg)
{
size_t len;

View file

@ -26,6 +26,8 @@ int wps_build_os_version(struct wps_device_data *dev, struct wpabuf *msg);
int wps_build_rf_bands(struct wps_device_data *dev, struct wpabuf *msg);
int wps_build_primary_dev_type(struct wps_device_data *dev,
struct wpabuf *msg);
int wps_build_secondary_dev_type(struct wps_device_data *dev,
struct wpabuf *msg);
int wps_build_dev_name(struct wps_device_data *dev, struct wpabuf *msg);
int wps_process_device_attrs(struct wps_device_data *dev,
struct wps_parse_attr *attr);