P2P: Allow BSS entry to be fetched based on GO P2P Device Address

"BSS p2p_dev_addr=<P2P Device Address>" can now be used to fetch a
specific BSS entry based on the P2P Device Address of the GO to avoid
having to iterate through the full BSS table when an external program
needs to figure out whether a specific peer is currently operating as
a GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-02-07 16:23:21 +02:00 committed by Jouni Malinen
parent c427ac9211
commit 0a70f34f22
5 changed files with 61 additions and 0 deletions

View file

@ -2096,6 +2096,32 @@ int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end)
}
int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
{
struct wpabuf *p2p_ie;
struct p2p_message msg;
p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
P2P_IE_VENDOR_TYPE);
if (p2p_ie == NULL)
return -1;
os_memset(&msg, 0, sizeof(msg));
if (p2p_parse_p2p_ie(p2p_ie, &msg)) {
wpabuf_free(p2p_ie);
return -1;
}
if (msg.p2p_device_addr == NULL) {
wpabuf_free(p2p_ie);
return -1;
}
os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
wpabuf_free(p2p_ie);
return 0;
}
static void p2p_clear_go_neg(struct p2p_data *p2p)
{
p2p->go_neg_peer = NULL;