|
@@ -2167,30 +2167,35 @@ 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)
|
|
|
+int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, 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);
|
|
|
- if (p2p_ie == NULL)
|
|
|
- return -1;
|
|
|
os_memset(&msg, 0, sizeof(msg));
|
|
|
- if (p2p_parse_p2p_ie(p2p_ie, &msg)) {
|
|
|
- wpabuf_free(p2p_ie);
|
|
|
+ if (p2p_parse_p2p_ie(p2p_ie, &msg))
|
|
|
return -1;
|
|
|
- }
|
|
|
|
|
|
if (msg.p2p_device_addr) {
|
|
|
os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN);
|
|
|
- ret = 0;
|
|
|
+ return 0;
|
|
|
} else if (msg.device_id) {
|
|
|
os_memcpy(dev_addr, msg.device_id, ETH_ALEN);
|
|
|
- ret = 0;
|
|
|
+ return 0;
|
|
|
}
|
|
|
+ return -1;
|
|
|
+}
|
|
|
|
|
|
+
|
|
|
+int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr)
|
|
|
+{
|
|
|
+ struct wpabuf *p2p_ie;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
|
|
|
+ P2P_IE_VENDOR_TYPE);
|
|
|
+ if (p2p_ie == NULL)
|
|
|
+ return -1;
|
|
|
+ ret = p2p_parse_dev_addr_in_p2p_ie(p2p_ie, dev_addr);
|
|
|
wpabuf_free(p2p_ie);
|
|
|
return ret;
|
|
|
}
|