P2P: Allow adding of WPS vendor extension attributes
This adds the ability to add WPS vendor extension attributes in P2P frames, like GO Negotiation and Probe Response frames. Signed-off-by: Jean-Michel Bachot <jean-michelx.bachot@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
4028a7fd43
commit
f95cac271b
6 changed files with 99 additions and 0 deletions
|
@ -1936,6 +1936,7 @@ void p2p_deinit(struct p2p_data *p2p)
|
|||
os_free(p2p->groups);
|
||||
wpabuf_free(p2p->sd_resp);
|
||||
os_free(p2p->after_scan_tx);
|
||||
p2p_remove_wps_vendor_extensions(p2p);
|
||||
os_free(p2p);
|
||||
}
|
||||
|
||||
|
@ -2019,6 +2020,40 @@ int p2p_set_sec_dev_types(struct p2p_data *p2p, const u8 dev_types[][8],
|
|||
}
|
||||
|
||||
|
||||
void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < P2P_MAX_WPS_VENDOR_EXTENSIONS; i++) {
|
||||
wpabuf_free(p2p->wps_vendor_ext[i]);
|
||||
p2p->wps_vendor_ext[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
|
||||
const struct wpabuf *vendor_ext)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (vendor_ext == NULL)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < P2P_MAX_WPS_VENDOR_EXTENSIONS; i++) {
|
||||
if (p2p->wps_vendor_ext[i] == NULL)
|
||||
break;
|
||||
}
|
||||
if (i >= P2P_MAX_WPS_VENDOR_EXTENSIONS)
|
||||
return -1;
|
||||
|
||||
p2p->wps_vendor_ext[i] = wpabuf_dup(vendor_ext);
|
||||
if (p2p->wps_vendor_ext[i] == NULL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int p2p_set_country(struct p2p_data *p2p, const char *country)
|
||||
{
|
||||
os_memcpy(p2p->cfg->country, country, 3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue