aboutsummaryrefslogtreecommitdiffstats
path: root/src/p2p
diff options
context:
space:
mode:
authorMasashi Honma <masashi.honma@gmail.com>2012-06-17 11:58:46 +0300
committerJouni Malinen <j@w1.fi>2012-06-17 11:58:46 +0300
commitc2d76aa6247b4769b935f11c902aa3f31278278e (patch)
treef7460dbc2cff30da9bb9c2929541a1de903898b0 /src/p2p
parent17706d1c7604c2beac6d33ff39ceccd63aa9a33a (diff)
downloadexternal_wpa_supplicant_8_ti-c2d76aa6247b4769b935f11c902aa3f31278278e.zip
external_wpa_supplicant_8_ti-c2d76aa6247b4769b935f11c902aa3f31278278e.tar.gz
external_wpa_supplicant_8_ti-c2d76aa6247b4769b935f11c902aa3f31278278e.tar.bz2
P2P: Add p2p_client_list support for FullMAC Persistent GO
Currently, FullMAC Persistent GO can't use p2p_client_list because its own hapd->p2p_group is NULL at ap_sta_set_authorized(). This patch changes the processing to use sta->p2p_ie instead of p2p_group_get_dev_addr() on FullMAC GO. Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/p2p.c29
-rw-r--r--src/p2p/p2p.h9
2 files changed, 26 insertions, 12 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index f7915bd..5b1af43 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -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;
}
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index a759adf..98ba5cd 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1427,6 +1427,15 @@ int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end);
int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end);
/**
+ * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatenated
+ * P2P IE
+ * @p2p_ie: P2P IE
+ * @dev_addr: Buffer for returning P2P Device Address
+ * Returns: 0 on success or -1 if P2P Device Address could not be parsed
+ */
+int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr);
+
+/**
* p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s)
* @ies: Information elements from scan results
* @ies_len: ies buffer length in octets