P2P: Keep track of secondary device types for peers
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:
parent
8e8c0df158
commit
e57ae6e19e
7 changed files with 61 additions and 0 deletions
|
@ -338,6 +338,9 @@ static void p2p_copy_client_info(struct p2p_device *dev,
|
||||||
dev->info.dev_capab = cli->dev_capab;
|
dev->info.dev_capab = cli->dev_capab;
|
||||||
dev->info.config_methods = cli->config_methods;
|
dev->info.config_methods = cli->config_methods;
|
||||||
os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
|
os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
|
||||||
|
dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types;
|
||||||
|
os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types,
|
||||||
|
dev->info.wps_sec_dev_type_list_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,6 +514,14 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
|
||||||
dev->info.config_methods = msg.config_methods ? msg.config_methods :
|
dev->info.config_methods = msg.config_methods ? msg.config_methods :
|
||||||
msg.wps_config_methods;
|
msg.wps_config_methods;
|
||||||
|
|
||||||
|
if (msg.wps_sec_dev_type_list) {
|
||||||
|
os_memcpy(dev->info.wps_sec_dev_type_list,
|
||||||
|
msg.wps_sec_dev_type_list,
|
||||||
|
msg.wps_sec_dev_type_list_len);
|
||||||
|
dev->info.wps_sec_dev_type_list_len =
|
||||||
|
msg.wps_sec_dev_type_list_len;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.capability) {
|
if (msg.capability) {
|
||||||
dev->info.dev_capab = msg.capability[0];
|
dev->info.dev_capab = msg.capability[0];
|
||||||
dev->info.group_capab = msg.capability[1];
|
dev->info.group_capab = msg.capability[1];
|
||||||
|
@ -1068,6 +1079,15 @@ void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr,
|
||||||
sizeof(dev->info.device_name));
|
sizeof(dev->info.device_name));
|
||||||
dev->info.config_methods = msg->config_methods ? msg->config_methods :
|
dev->info.config_methods = msg->config_methods ? msg->config_methods :
|
||||||
msg->wps_config_methods;
|
msg->wps_config_methods;
|
||||||
|
|
||||||
|
if (msg->wps_sec_dev_type_list) {
|
||||||
|
os_memcpy(dev->info.wps_sec_dev_type_list,
|
||||||
|
msg->wps_sec_dev_type_list,
|
||||||
|
msg->wps_sec_dev_type_list_len);
|
||||||
|
dev->info.wps_sec_dev_type_list_len =
|
||||||
|
msg->wps_sec_dev_type_list_len;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg->capability) {
|
if (msg->capability) {
|
||||||
dev->info.dev_capab = msg->capability[0];
|
dev->info.dev_capab = msg->capability[0];
|
||||||
dev->info.group_capab = msg->capability[1];
|
dev->info.group_capab = msg->capability[1];
|
||||||
|
@ -1441,6 +1461,14 @@ static void p2p_add_dev_from_probe_req(struct p2p_data *p2p, const u8 *addr,
|
||||||
os_memcpy(dev->info.pri_dev_type, msg.wps_pri_dev_type,
|
os_memcpy(dev->info.pri_dev_type, msg.wps_pri_dev_type,
|
||||||
sizeof(dev->info.pri_dev_type));
|
sizeof(dev->info.pri_dev_type));
|
||||||
|
|
||||||
|
if (msg.wps_sec_dev_type_list) {
|
||||||
|
os_memcpy(dev->info.wps_sec_dev_type_list,
|
||||||
|
msg.wps_sec_dev_type_list,
|
||||||
|
msg.wps_sec_dev_type_list_len);
|
||||||
|
dev->info.wps_sec_dev_type_list_len =
|
||||||
|
msg.wps_sec_dev_type_list_len;
|
||||||
|
}
|
||||||
|
|
||||||
p2p_parse_free(&msg);
|
p2p_parse_free(&msg);
|
||||||
|
|
||||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||||
|
|
|
@ -172,6 +172,20 @@ struct p2p_peer_info {
|
||||||
* group_capab - Group Capabilities
|
* group_capab - Group Capabilities
|
||||||
*/
|
*/
|
||||||
u8 group_capab;
|
u8 group_capab;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wps_sec_dev_type_list - WPS secondary device type list
|
||||||
|
*
|
||||||
|
* This list includes from 0 to 16 Secondary Device Types as indicated
|
||||||
|
* by wps_sec_dev_type_list_len (8 * number of types).
|
||||||
|
*/
|
||||||
|
u8 wps_sec_dev_type_list[128];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wps_sec_dev_type_list_len - Length of secondary device type list
|
||||||
|
*/
|
||||||
|
size_t wps_sec_dev_type_list_len;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -437,6 +437,8 @@ struct p2p_message {
|
||||||
u16 dev_password_id;
|
u16 dev_password_id;
|
||||||
u16 wps_config_methods;
|
u16 wps_config_methods;
|
||||||
const u8 *wps_pri_dev_type;
|
const u8 *wps_pri_dev_type;
|
||||||
|
const u8 *wps_sec_dev_type_list;
|
||||||
|
size_t wps_sec_dev_type_list_len;
|
||||||
|
|
||||||
/* DS Parameter Set IE */
|
/* DS Parameter Set IE */
|
||||||
const u8 *ds_params;
|
const u8 *ds_params;
|
||||||
|
|
|
@ -353,6 +353,10 @@ static int p2p_parse_wps_ie(const struct wpabuf *buf, struct p2p_message *msg)
|
||||||
wps_dev_type_bin2str(msg->wps_pri_dev_type, devtype,
|
wps_dev_type_bin2str(msg->wps_pri_dev_type, devtype,
|
||||||
sizeof(devtype)));
|
sizeof(devtype)));
|
||||||
}
|
}
|
||||||
|
if (attr.sec_dev_type_list) {
|
||||||
|
msg->wps_sec_dev_type_list = attr.sec_dev_type_list;
|
||||||
|
msg->wps_sec_dev_type_list_len = attr.sec_dev_type_list_len;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct wps_credential {
|
||||||
|
|
||||||
#define WPS_DEV_TYPE_LEN 8
|
#define WPS_DEV_TYPE_LEN 8
|
||||||
#define WPS_DEV_TYPE_BUFSIZE 21
|
#define WPS_DEV_TYPE_BUFSIZE 21
|
||||||
|
#define WPS_SEC_DEV_TYPE_MAX_LEN 128
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct wps_device_data - WPS Device Data
|
* struct wps_device_data - WPS Device Data
|
||||||
|
|
|
@ -512,6 +512,16 @@ static int wps_set_attr(struct wps_parse_attr *attr, u16 type,
|
||||||
attr->req_dev_type[attr->num_req_dev_type] = pos;
|
attr->req_dev_type[attr->num_req_dev_type] = pos;
|
||||||
attr->num_req_dev_type++;
|
attr->num_req_dev_type++;
|
||||||
break;
|
break;
|
||||||
|
case ATTR_SECONDARY_DEV_TYPE_LIST:
|
||||||
|
if (len > WPS_SEC_DEV_TYPE_MAX_LEN ||
|
||||||
|
(len % WPS_DEV_TYPE_LEN) > 0) {
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS: Invalid Secondary Device "
|
||||||
|
"Type length %u", len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
attr->sec_dev_type_list = pos;
|
||||||
|
attr->sec_dev_type_list_len = len;
|
||||||
|
break;
|
||||||
case ATTR_VENDOR_EXT:
|
case ATTR_VENDOR_EXT:
|
||||||
if (wps_parse_vendor_ext(attr, pos, len) < 0)
|
if (wps_parse_vendor_ext(attr, pos, len) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -195,6 +195,8 @@ struct wps_parse_attr {
|
||||||
size_t eap_identity_len;
|
size_t eap_identity_len;
|
||||||
const u8 *authorized_macs; /* <= 30 octets */
|
const u8 *authorized_macs; /* <= 30 octets */
|
||||||
size_t authorized_macs_len;
|
size_t authorized_macs_len;
|
||||||
|
const u8 *sec_dev_type_list; /* <= 128 octets */
|
||||||
|
size_t sec_dev_type_list_len;
|
||||||
|
|
||||||
/* attributes that can occur multiple times */
|
/* attributes that can occur multiple times */
|
||||||
#define MAX_CRED_COUNT 10
|
#define MAX_CRED_COUNT 10
|
||||||
|
|
Loading…
Add table
Reference in a new issue