aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-01-21 09:54:12 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-08 10:11:52 (GMT)
commit4b509d543827ef9c2c768fe2caf5fe168d5d323c (patch)
treee97c67df86c7972025c40b63a6a4b663427955d2
parentd2e7a70f088dd3cedfea01f22ab7bb646a328d0b (diff)
downloadhostap-06-4b509d543827ef9c2c768fe2caf5fe168d5d323c.zip
hostap-06-4b509d543827ef9c2c768fe2caf5fe168d5d323c.tar.gz
hostap-06-4b509d543827ef9c2c768fe2caf5fe168d5d323c.tar.bz2
Added wps_cred_processing configuration option for hostapd
This behaves like the one in wpa_supplicant, i.e., hostapd can be configured not to process new credentials (AP settings) internally and instead pass the WPS attributes for an external program to process over ctrl_iface. (cherry picked from commit d745c7cc1a2dfee6880e7707b94f7581742370e6)
-rw-r--r--hostapd/config.c2
-rw-r--r--hostapd/config.h1
-rw-r--r--hostapd/hostapd.conf8
-rw-r--r--hostapd/wps_hostapd.c17
4 files changed, 27 insertions, 1 deletions
diff --git a/hostapd/config.c b/hostapd/config.c
index 27df233..0a7d57a 100644
--- a/hostapd/config.c
+++ b/hostapd/config.c
@@ -2217,6 +2217,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
line, pos);
errors++;
}
+ } else if (os_strcmp(buf, "wps_cred_processing") == 0) {
+ bss->wps_cred_processing = atoi(pos);
#endif /* CONFIG_WPS */
} else {
wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
diff --git a/hostapd/config.h b/hostapd/config.h
index 0896749..f799d9c 100644
--- a/hostapd/config.h
+++ b/hostapd/config.h
@@ -303,6 +303,7 @@ struct hostapd_bss_config {
int skip_cred_build;
u8 *extra_cred;
size_t extra_cred_len;
+ int wps_cred_processing;
#endif /* CONFIG_WPS */
};
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 853bc6e..bd24f17 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -948,6 +948,14 @@ own_ip_addr=127.0.0.1
# attribute(s) as binary data.
#extra_cred=hostapd.cred
+# Credential processing
+# 0 = process received credentials internally (default)
+# 1 = do not process received credentials; just pass them over ctrl_iface to
+# external program(s)
+# 2 = process received credentials internally and pass them over ctrl_iface
+# to external program(s)
+#wps_cred_processing=0
+
##### Multiple BSSID support ##################################################
#
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index f4c1b0e..89fe50b 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -194,7 +194,22 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
wpa_printf(MSG_DEBUG, "WPS: MAC Address " MACSTR,
MAC2STR(cred->mac_addr));
- wpa_msg(hapd, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS);
+ if ((hapd->conf->wps_cred_processing == 1 ||
+ hapd->conf->wps_cred_processing == 2) && cred->cred_attr) {
+ size_t blen = cred->cred_attr_len * 2 + 1;
+ char *buf = os_malloc(blen);
+ if (buf) {
+ wpa_snprintf_hex(buf, blen,
+ cred->cred_attr, cred->cred_attr_len);
+ wpa_msg(hapd, MSG_INFO, "%s%s",
+ WPS_EVENT_NEW_AP_SETTINGS, buf);
+ os_free(buf);
+ }
+ } else
+ wpa_msg(hapd, MSG_INFO, WPS_EVENT_NEW_AP_SETTINGS);
+
+ if (hapd->conf->wps_cred_processing == 1)
+ return 0;
len = os_strlen(hapd->iface->config_fname) + 5;
tmp_fname = os_malloc(len);