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>
This commit is contained in:
parent
aa9bb7644b
commit
6f251b6bb5
6 changed files with 33 additions and 10 deletions
|
@ -1261,6 +1261,16 @@ struct p2p_group_config {
|
||||||
*/
|
*/
|
||||||
unsigned int max_clients;
|
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
|
* cb_ctx - Context to use with callback functions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -731,3 +731,15 @@ int p2p_group_is_client_connected(struct p2p_group *group, const u8 *dev_addr)
|
||||||
|
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -549,6 +549,8 @@ const u8 * p2p_group_get_interface_addr(struct p2p_group *group);
|
||||||
u8 p2p_group_presence_req(struct p2p_group *group,
|
u8 p2p_group_presence_req(struct p2p_group *group,
|
||||||
const u8 *client_interface_addr,
|
const u8 *client_interface_addr,
|
||||||
const u8 *noa, size_t noa_len);
|
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);
|
void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token);
|
||||||
|
|
|
@ -540,9 +540,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
|
||||||
hapd_iface->bss[i]->sta_authorized_cb_ctx = wpa_s;
|
hapd_iface->bss[i]->sta_authorized_cb_ctx = wpa_s;
|
||||||
#ifdef CONFIG_P2P
|
#ifdef CONFIG_P2P
|
||||||
hapd_iface->bss[i]->p2p = wpa_s->global->p2p;
|
hapd_iface->bss[i]->p2p = wpa_s->global->p2p;
|
||||||
hapd_iface->bss[i]->p2p_group = wpas_p2p_group_init(
|
hapd_iface->bss[i]->p2p_group = wpas_p2p_group_init(wpa_s,
|
||||||
wpa_s, ssid->p2p_persistent_group,
|
ssid);
|
||||||
ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION);
|
|
||||||
#endif /* CONFIG_P2P */
|
#endif /* CONFIG_P2P */
|
||||||
hapd_iface->bss[i]->setup_complete_cb = wpas_ap_configured_cb;
|
hapd_iface->bss[i]->setup_complete_cb = wpas_ap_configured_cb;
|
||||||
hapd_iface->bss[i]->setup_complete_cb_ctx = wpa_s;
|
hapd_iface->bss[i]->setup_complete_cb_ctx = wpa_s;
|
||||||
|
|
|
@ -3665,8 +3665,7 @@ static void wpas_p2p_idle_update(void *ctx, int idle)
|
||||||
|
|
||||||
|
|
||||||
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
int persistent_group,
|
struct wpa_ssid *ssid)
|
||||||
int group_formation)
|
|
||||||
{
|
{
|
||||||
struct p2p_group *group;
|
struct p2p_group *group;
|
||||||
struct p2p_group_config *cfg;
|
struct p2p_group_config *cfg;
|
||||||
|
@ -3680,9 +3679,9 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
if (cfg == NULL)
|
if (cfg == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (persistent_group && wpa_s->conf->persistent_reconnect)
|
if (ssid->p2p_persistent_group && wpa_s->conf->persistent_reconnect)
|
||||||
cfg->persistent_group = 2;
|
cfg->persistent_group = 2;
|
||||||
else if (persistent_group)
|
else if (ssid->p2p_persistent_group)
|
||||||
cfg->persistent_group = 1;
|
cfg->persistent_group = 1;
|
||||||
os_memcpy(cfg->interface_addr, wpa_s->own_addr, ETH_ALEN);
|
os_memcpy(cfg->interface_addr, wpa_s->own_addr, ETH_ALEN);
|
||||||
if (wpa_s->max_stations &&
|
if (wpa_s->max_stations &&
|
||||||
|
@ -3690,6 +3689,8 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
cfg->max_clients = wpa_s->max_stations;
|
cfg->max_clients = wpa_s->max_stations;
|
||||||
else
|
else
|
||||||
cfg->max_clients = wpa_s->conf->max_num_sta;
|
cfg->max_clients = wpa_s->conf->max_num_sta;
|
||||||
|
os_memcpy(cfg->ssid, ssid->ssid, ssid->ssid_len);
|
||||||
|
cfg->ssid_len = ssid->ssid_len;
|
||||||
cfg->cb_ctx = wpa_s;
|
cfg->cb_ctx = wpa_s;
|
||||||
cfg->ie_update = wpas_p2p_ie_update;
|
cfg->ie_update = wpas_p2p_ie_update;
|
||||||
cfg->idle_update = wpas_p2p_idle_update;
|
cfg->idle_update = wpas_p2p_idle_update;
|
||||||
|
@ -3697,7 +3698,7 @@ struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
group = p2p_group_init(wpa_s->global->p2p, cfg);
|
group = p2p_group_init(wpa_s->global->p2p, cfg);
|
||||||
if (group == NULL)
|
if (group == NULL)
|
||||||
os_free(cfg);
|
os_free(cfg);
|
||||||
if (!group_formation)
|
if (ssid->mode != WPAS_MODE_P2P_GROUP_FORMATION)
|
||||||
p2p_group_notif_formation_done(group);
|
p2p_group_notif_formation_done(group);
|
||||||
wpa_s->p2p_group = group;
|
wpa_s->p2p_group = group;
|
||||||
return group;
|
return group;
|
||||||
|
|
|
@ -32,8 +32,7 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid, int addr_allocated,
|
struct wpa_ssid *ssid, int addr_allocated,
|
||||||
int freq);
|
int freq);
|
||||||
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
|
||||||
int persistent_group,
|
struct wpa_ssid *ssid);
|
||||||
int group_formation);
|
|
||||||
void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
|
void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
|
||||||
int registrar);
|
int registrar);
|
||||||
enum wpas_p2p_prov_disc_use {
|
enum wpas_p2p_prov_disc_use {
|
||||||
|
|
Loading…
Reference in a new issue