aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-03-30 15:50:33 +0300
committerJouni Malinen <j@w1.fi>2012-03-30 15:50:33 +0300
commit526ec4aee84ed1ab25930d4445161a02aa5937cb (patch)
treeaa4581cf16be482fda2fd4f248f2729a351c5eba /src/p2p
parent1f6c0ab87229222e8f2f4bd933a85ff0c9e89bdd (diff)
downloadexternal_wpa_supplicant_8_ti-526ec4aee84ed1ab25930d4445161a02aa5937cb.zip
external_wpa_supplicant_8_ti-526ec4aee84ed1ab25930d4445161a02aa5937cb.tar.gz
external_wpa_supplicant_8_ti-526ec4aee84ed1ab25930d4445161a02aa5937cb.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. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src/p2p')
-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 5bdf473..6c19774 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2116,6 +2116,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);
@@ -2127,14 +2128,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;
}