WPS ER: Add wps_er_set_config to use local configuration

This command can be used to enroll a network based on a local
network configuration block instead of having to (re-)learn the
current AP settings with wps_er_learn.
This commit is contained in:
Jouni Malinen 2010-10-20 13:37:01 +03:00 committed by Jouni Malinen
parent cbbf4a1cc3
commit ef10f4733f
7 changed files with 124 additions and 0 deletions

View file

@ -758,6 +758,8 @@ void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
int wps_er_pbc(struct wps_er *er, const u8 *uuid);
int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *pin,
size_t pin_len);
int wps_er_set_config(struct wps_er *er, const u8 *uuid,
const struct wps_credential *cred);
int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *pin,
size_t pin_len, const struct wps_credential *cred);

View file

@ -1738,6 +1738,34 @@ int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *pin,
}
int wps_er_set_config(struct wps_er *er, const u8 *uuid,
const struct wps_credential *cred)
{
struct wps_er_ap *ap;
if (er == NULL)
return -1;
ap = wps_er_ap_get(er, NULL, uuid);
if (ap == NULL) {
wpa_printf(MSG_DEBUG, "WPS ER: AP not found for set config "
"request");
return -1;
}
os_free(ap->ap_settings);
ap->ap_settings = os_malloc(sizeof(*cred));
if (ap->ap_settings == NULL)
return -1;
os_memcpy(ap->ap_settings, cred, sizeof(*cred));
ap->ap_settings->cred_attr = NULL;
wpa_printf(MSG_DEBUG, "WPS ER: Updated local AP settings based set "
"config request");
return 0;
}
static void wps_er_ap_config_m1(struct wps_er_ap *ap, struct wpabuf *m1)
{
struct wps_config cfg;