P2P: Add peer entry based on Provision Discovery Request
Add (or complete Probe Request only) P2P peer entry when receiving Provision Discovery Request from a previously unknown peer. This is especially of use for a GO when a P2P client is requesting to join a running group.
This commit is contained in:
parent
812bf56ab1
commit
17bef1e97a
3 changed files with 14 additions and 4 deletions
|
@ -419,10 +419,12 @@ static int p2p_add_group_clients(struct p2p_data *p2p, const u8 *go_dev_addr,
|
|||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* If the scan result is for a GO, the clients in the group will also be added
|
||||
* to the peer table.
|
||||
* to the peer table. This function can also be used with some other frames
|
||||
* like Provision Discovery Request that contains P2P Capability and P2P Device
|
||||
* Info attributes.
|
||||
*/
|
||||
static int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
|
||||
int level, const u8 *ies, size_t ies_len)
|
||||
int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
|
||||
const u8 *ies, size_t ies_len)
|
||||
{
|
||||
struct p2p_device *dev;
|
||||
struct p2p_message msg;
|
||||
|
|
|
@ -1235,4 +1235,7 @@ void p2p_set_cross_connect(struct p2p_data *p2p, int enabled);
|
|||
|
||||
int p2p_get_oper_freq(struct p2p_data *p2p, const u8 *iface_addr);
|
||||
|
||||
int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level,
|
||||
const u8 *ies, size_t ies_len);
|
||||
|
||||
#endif /* P2P_H */
|
||||
|
|
|
@ -105,10 +105,15 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
|
|||
MAC2STR(sa), msg.wps_config_methods, rx_freq);
|
||||
|
||||
dev = p2p_get_device(p2p, sa);
|
||||
if (dev == NULL) {
|
||||
if (dev == NULL || !(dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Provision Discovery Request from "
|
||||
"unknown peer " MACSTR, MAC2STR(sa));
|
||||
if (p2p_add_device(p2p, sa, rx_freq, 0, data + 1, len - 1)) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Provision Discovery Request add device "
|
||||
"failed " MACSTR, MAC2STR(sa));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(msg.wps_config_methods &
|
||||
|
|
Loading…
Reference in a new issue