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:
Jean-Michel Bachot 2011-03-19 11:57:10 +02:00 committed by Jouni Malinen
parent 4028a7fd43
commit f95cac271b
6 changed files with 99 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7)
#define CFG_CHANGED_WPS_STRING BIT(8)
#define CFG_CHANGED_P2P_INTRA_BSS BIT(9)
#define CFG_CHANGED_VENDOR_EXTENSION BIT(10)
/**
* struct wpa_config - wpa_supplicant configuration data
@ -357,6 +358,12 @@ struct wpa_config {
int persistent_reconnect;
int p2p_intra_bss;
#define MAX_WPS_VENDOR_EXT 10
/**
* wps_vendor_ext - Vendor extension attributes in WPS
*/
struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXT];
/**
* p2p_group_idle - Maximum idle time in seconds for P2P group
*

View file

@ -2295,6 +2295,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
{
struct p2p_config p2p;
unsigned int r;
int i;
if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE))
return 0;
@ -2433,6 +2434,13 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
if (global->p2p == NULL)
return -1;
for (i = 0; i < MAX_WPS_VENDOR_EXT; i++) {
if (wpa_s->conf->wps_vendor_ext[i] == NULL)
continue;
p2p_add_wps_vendor_extension(
global->p2p, wpa_s->conf->wps_vendor_ext[i]);
}
return 0;
}
@ -3883,6 +3891,17 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
(void *) wpa_s->conf->sec_device_type,
wpa_s->conf->num_sec_device_types);
if (wpa_s->conf->changed_parameters & CFG_CHANGED_VENDOR_EXTENSION) {
int i;
p2p_remove_wps_vendor_extensions(p2p);
for (i = 0; i < MAX_WPS_VENDOR_EXT; i++) {
if (wpa_s->conf->wps_vendor_ext[i] == NULL)
continue;
p2p_add_wps_vendor_extension(
p2p, wpa_s->conf->wps_vendor_ext[i]);
}
}
if ((wpa_s->conf->changed_parameters & CFG_CHANGED_COUNTRY) &&
wpa_s->conf->country[0] && wpa_s->conf->country[1]) {
char country[3];