diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2012-05-08 17:33:14 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-05-08 17:38:57 +0300 |
commit | 6f251b6bb504176bc9086cde3a1bbe744d15bce8 (patch) | |
tree | 2d2cf296a1d24febfd15e5fed68395915de3c79f /src/p2p | |
parent | aa9bb7644b0f7acbc9403189f0c47c17079205bc (diff) | |
download | external_wpa_supplicant_8_ti-6f251b6bb504176bc9086cde3a1bbe744d15bce8.zip external_wpa_supplicant_8_ti-6f251b6bb504176bc9086cde3a1bbe744d15bce8.tar.gz external_wpa_supplicant_8_ti-6f251b6bb504176bc9086cde3a1bbe744d15bce8.tar.bz2 |
P2P: Store SSID of the group in p2p_group data
This can be used with P2P management operations that need to verify
whether the local device is operating a specific group based on
P2P Group ID attribute from a peer.
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/p2p.h | 10 | ||||
-rw-r--r-- | src/p2p/p2p_group.c | 12 | ||||
-rw-r--r-- | src/p2p/p2p_i.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 44162f6..92e7048 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1262,6 +1262,16 @@ struct p2p_group_config { unsigned int max_clients; /** + * ssid - Group SSID + */ + u8 ssid[32]; + + /** + * ssid_len - Length of SSID + */ + size_t ssid_len; + + /** * cb_ctx - Context to use with callback functions */ void *cb_ctx; diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index fafd135..44b387a 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -731,3 +731,15 @@ int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr) return 0; } + + +int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id, + size_t group_id_len) +{ + if (group_id_len != ETH_ALEN + group->cfg->ssid_len) + return 0; + if (os_memcmp(group_id, group->p2p->cfg->dev_addr, ETH_ALEN) != 0) + return 0; + return os_memcmp(group_id + ETH_ALEN, group->cfg->ssid, + group->cfg->ssid_len) == 0; +} diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index 3a764ca..279225c 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -549,6 +549,8 @@ const u8 * p2p_group_get_interface_addr(struct p2p_group *group); u8 p2p_group_presence_req(struct p2p_group *group, const u8 *client_interface_addr, const u8 *noa, size_t noa_len); +int p2p_group_is_group_id_match(struct p2p_group *group, const u8 *group_id, + size_t group_id_len); void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token); |