aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-04-06 14:47:34 -0700
committerIrfan Sheriff <isheriff@google.com>2012-04-06 15:24:54 -0700
commita6328e341c8c1ad0deb8753fdc6f1a49d0a57a92 (patch)
tree3bafc6ef24d9fa2aa50d1249e0fa8141efab99e6 /src
parent067a17f056511e2761f07340fb3106dd59ad596a (diff)
downloadexternal_wpa_supplicant_8-a6328e341c8c1ad0deb8753fdc6f1a49d0a57a92.zip
external_wpa_supplicant_8-a6328e341c8c1ad0deb8753fdc6f1a49d0a57a92.tar.gz
external_wpa_supplicant_8-a6328e341c8c1ad0deb8753fdc6f1a49d0a57a92.tar.bz2
P2P: Use P2P Device ID attribute if Device Info not available
The "BSS p2p_dev_addr=address" command uses p2p_parse_dev_addr() to figure out the P2P Device Address of the GO from scan results. This used to work only if the P2P IE was received from Probe Response frames since only those include the P2P Device Info attribute. Make this work with Beacon frames, too, by using P2P Device ID attribute if the P2P Device Info attribute is not present. Change-Id: I3f0a49c22ee02e8971edb9ecd033e74342c318c0 Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src')
-rw-r--r--src/p2p/p2p.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index d5884f2..a4c6a8f 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2094,6 +2094,7 @@ int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
{
struct wpabuf *p2p_ie;
struct p2p_message msg;
+ int ret = -1;
p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
P2P_IE_VENDOR_TYPE);
@@ -2105,14 +2106,16 @@ int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
return -1;
}
- if (msg.p2p_device_addr == NULL) {
- wpabuf_free(p2p_ie);
- return -1;
+ if (msg.p2p_device_addr) {
+ os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
+ ret = 0;
+ } else if (msg.device_id) {
+ os_memcpy(dev_addr, msg.device_id, ETH_ALEN);
+ ret = 0;
}
- os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
wpabuf_free(p2p_ie);
- return 0;
+ return ret;
}