Added ap_settings option for overriding WPS AP Settings in M7
This optional configuration parameter can be used to override AP Settings attributes in M7 similarly to extra_cred option for Credential attribute(s) in M8.
This commit is contained in:
parent
6296625308
commit
4c29cae932
6 changed files with 56 additions and 8 deletions
|
@ -396,6 +396,19 @@ struct wps_context {
|
|||
*/
|
||||
size_t network_key_len;
|
||||
|
||||
/**
|
||||
* ap_settings - AP Settings override for M7 (only used at AP)
|
||||
*
|
||||
* If %NULL, AP Settings attributes will be generated based on the
|
||||
* current network configuration.
|
||||
*/
|
||||
u8 *ap_settings;
|
||||
|
||||
/**
|
||||
* ap_settings_len - Length of ap_settings in octets
|
||||
*/
|
||||
size_t ap_settings_len;
|
||||
|
||||
/**
|
||||
* cred_cb - Callback to notify that new Credentials were received
|
||||
* @ctx: Higher layer context data (cb_ctx)
|
||||
|
|
|
@ -268,17 +268,34 @@ static int wps_build_cred_mac_addr(struct wps_data *wps, struct wpabuf *msg)
|
|||
}
|
||||
|
||||
|
||||
static int wps_build_ap_settings(struct wps_data *wps, struct wpabuf *plain)
|
||||
{
|
||||
if (wps->wps->ap_settings) {
|
||||
wpa_printf(MSG_DEBUG, "WPS: * AP Settings (pre-configured)");
|
||||
wpabuf_put_data(plain, wps->wps->ap_settings,
|
||||
wps->wps->ap_settings_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return wps_build_cred_ssid(wps, plain) ||
|
||||
wps_build_cred_mac_addr(wps, plain) ||
|
||||
wps_build_cred_auth_type(wps, plain) ||
|
||||
wps_build_cred_encr_type(wps, plain) ||
|
||||
wps_build_cred_network_key(wps, plain);
|
||||
}
|
||||
|
||||
|
||||
static struct wpabuf * wps_build_m7(struct wps_data *wps)
|
||||
{
|
||||
struct wpabuf *msg, *plain;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "WPS: Building Message M7");
|
||||
|
||||
plain = wpabuf_alloc(500);
|
||||
plain = wpabuf_alloc(500 + wps->wps->ap_settings_len);
|
||||
if (plain == NULL)
|
||||
return NULL;
|
||||
|
||||
msg = wpabuf_alloc(1000);
|
||||
msg = wpabuf_alloc(1000 + wps->wps->ap_settings_len);
|
||||
if (msg == NULL) {
|
||||
wpabuf_free(plain);
|
||||
return NULL;
|
||||
|
@ -288,12 +305,7 @@ static struct wpabuf * wps_build_m7(struct wps_data *wps)
|
|||
wps_build_msg_type(msg, WPS_M7) ||
|
||||
wps_build_registrar_nonce(wps, msg) ||
|
||||
wps_build_e_snonce2(wps, plain) ||
|
||||
(wps->wps->ap &&
|
||||
(wps_build_cred_ssid(wps, plain) ||
|
||||
wps_build_cred_mac_addr(wps, plain) ||
|
||||
wps_build_cred_auth_type(wps, plain) ||
|
||||
wps_build_cred_encr_type(wps, plain) ||
|
||||
wps_build_cred_network_key(wps, plain))) ||
|
||||
(wps->wps->ap && wps_build_ap_settings(wps, plain)) ||
|
||||
wps_build_key_wrap_auth(wps, plain) ||
|
||||
wps_build_encr_settings(wps, msg, plain) ||
|
||||
wps_build_authenticator(wps, msg)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue