aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-23 19:08:55 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-08 10:18:54 (GMT)
commite51609f083579fb3de4bfb9e6eb9a6f6f8256b51 (patch)
tree0c459375c4f5c2dbe7d2d061058eb7c311d39b35 /src
parent4d88c94f7ba6c3acfe236feb2550fa3f68cc0304 (diff)
downloadhostap-06-e51609f083579fb3de4bfb9e6eb9a6f6f8256b51.zip
hostap-06-e51609f083579fb3de4bfb9e6eb9a6f6f8256b51.tar.gz
hostap-06-e51609f083579fb3de4bfb9e6eb9a6f6f8256b51.tar.bz2
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. (cherry picked from commit 4c29cae9320ccc6675b59f41dddf652b997fdc71)
Diffstat (limited to 'src')
-rw-r--r--src/wps/wps.h13
-rw-r--r--src/wps/wps_enrollee.c28
2 files changed, 33 insertions, 8 deletions
diff --git a/src/wps/wps.h b/src/wps/wps.h
index 4847332..7524acb 100644
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
@@ -397,6 +397,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)
* @cred: The received Credential
diff --git a/src/wps/wps_enrollee.c b/src/wps/wps_enrollee.c
index 59f3b19..dda8fc6 100644
--- a/src/wps/wps_enrollee.c
+++ b/src/wps/wps_enrollee.c
@@ -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)) {