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.config_methods = cli->config_methods;
|
||||
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 :
|
||||
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) {
|
||||
dev->info.dev_capab = msg.capability[0];
|
||||
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));
|
||||
dev->info.config_methods = msg->config_methods ? msg->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) {
|
||||
dev->info.dev_capab = msg->capability[0];
|
||||
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,
|
||||
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);
|
||||
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
|
|
|
@ -172,6 +172,20 @@ struct p2p_peer_info {
|
|||
* group_capab - Group Capabilities
|
||||
*/
|
||||
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 wps_config_methods;
|
||||
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 */
|
||||
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,
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue