P2P: Allow Device ID to be specified for p2p_find command
dev_id=<P2P Device Addr> can now be specified as an argument to p2p_find to request P2P find for a specific P2P device. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
68921e24b2
commit
6d92fa6e92
9 changed files with 55 additions and 23 deletions
|
@ -795,8 +795,8 @@ static void p2p_search(struct p2p_data *p2p)
|
|||
}
|
||||
|
||||
if (p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, type, freq,
|
||||
p2p->num_req_dev_types, p2p->req_dev_types) < 0)
|
||||
{
|
||||
p2p->num_req_dev_types, p2p->req_dev_types,
|
||||
p2p->find_dev_id) < 0) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Scan request failed");
|
||||
p2p_continue_find(p2p);
|
||||
|
@ -895,7 +895,8 @@ static void p2p_free_req_dev_types(struct p2p_data *p2p)
|
|||
|
||||
int p2p_find(struct p2p_data *p2p, unsigned int timeout,
|
||||
enum p2p_discovery_type type,
|
||||
unsigned int num_req_dev_types, const u8 *req_dev_types)
|
||||
unsigned int num_req_dev_types, const u8 *req_dev_types,
|
||||
const u8 *dev_id)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -917,6 +918,12 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
|
|||
p2p->num_req_dev_types = num_req_dev_types;
|
||||
}
|
||||
|
||||
if (dev_id) {
|
||||
os_memcpy(p2p->find_dev_id_buf, dev_id, ETH_ALEN);
|
||||
p2p->find_dev_id = p2p->find_dev_id_buf;
|
||||
} else
|
||||
p2p->find_dev_id = NULL;
|
||||
|
||||
p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING;
|
||||
p2p_clear_timeout(p2p);
|
||||
p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
|
||||
|
@ -933,12 +940,12 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
|
|||
case P2P_FIND_PROGRESSIVE:
|
||||
res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_FULL, 0,
|
||||
p2p->num_req_dev_types,
|
||||
p2p->req_dev_types);
|
||||
p2p->req_dev_types, dev_id);
|
||||
break;
|
||||
case P2P_FIND_ONLY_SOCIAL:
|
||||
res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_SOCIAL, 0,
|
||||
p2p->num_req_dev_types,
|
||||
p2p->req_dev_types);
|
||||
p2p->req_dev_types, dev_id);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -975,7 +982,8 @@ int p2p_other_scan_completed(struct p2p_data *p2p)
|
|||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Starting pending P2P find "
|
||||
"now that previous scan was completed");
|
||||
if (p2p_find(p2p, p2p->last_p2p_find_timeout, p2p->find_type,
|
||||
p2p->num_req_dev_types, p2p->req_dev_types) < 0)
|
||||
p2p->num_req_dev_types, p2p->req_dev_types,
|
||||
p2p->find_dev_id) < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -2533,10 +2541,12 @@ void p2p_scan_res_handled(struct p2p_data *p2p)
|
|||
}
|
||||
|
||||
|
||||
void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies)
|
||||
void p2p_scan_ie(struct p2p_data *p2p, struct wpabuf *ies, const u8 *dev_id)
|
||||
{
|
||||
u8 *len = p2p_buf_add_ie_hdr(ies);
|
||||
p2p_buf_add_capability(ies, p2p->dev_capab, 0);
|
||||
if (dev_id)
|
||||
p2p_buf_add_device_id(ies, dev_id);
|
||||
if (p2p->cfg->reg_class && p2p->cfg->channel)
|
||||
p2p_buf_add_listen_channel(ies, p2p->cfg->country,
|
||||
p2p->cfg->reg_class,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue