P2P: Store SSID of the group in p2p_group data

This can be used with P2P management operations that need to verify
whether the local device is operating a specific group based on
P2P Group ID attribute from a peer.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-05-08 17:33:14 +03:00 committed by Jouni Malinen
parent aa9bb7644b
commit 6f251b6bb5
6 changed files with 33 additions and 10 deletions

View file

@ -1261,6 +1261,16 @@ struct p2p_group_config {
*/
unsigned int max_clients;
/**
* ssid - Group SSID
*/
u8 ssid[32];
/**
* ssid_len - Length of SSID
*/
size_t ssid_len;
/**
* cb_ctx - Context to use with callback functions
*/

View file

@ -731,3 +731,15 @@ int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr)
return 0;
}
int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
size_t group_id_len)
{
if (group_id_len != ETH_ALEN + group->cfg->ssid_len)
return 0;
if (os_memcmp(group_id, group->p2p->cfg->dev_addr, ETH_ALEN) != 0)
return 0;
return os_memcmp(group_id + ETH_ALEN, group->cfg->ssid,
group->cfg->ssid_len) == 0;
}

View file

@ -549,6 +549,8 @@ const u8 * p2p_group_get_interface_addr(struct p2p_group *group);
u8 p2p_group_presence_req(struct p2p_group *group,
const u8 *client_interface_addr,
const u8 *noa, size_t noa_len);
int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id,
size_t group_id_len);
void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);