aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-01-13 04:20:43 (GMT)
committerJouni Malinen <j@w1.fi>2008-01-13 04:20:43 (GMT)
commit9d6783a2df35c33d185e1b7e93e6ce0c866f90b5 (patch)
tree83f945ab80b64425285b7dff3601ae373f02cfe4 /hostapd
parent6ee5a9a2105435a6d74c12613aac9990464e9d2e (diff)
downloadhostap-history-9d6783a2df35c33d185e1b7e93e6ce0c866f90b5.zip
hostap-history-9d6783a2df35c33d185e1b7e93e6ce0c866f90b5.tar.gz
hostap-history-9d6783a2df35c33d185e1b7e93e6ce0c866f90b5.tar.bz2
WPS: Added initial part for configuring hostapd to act as an Enrollee
The new ap_pin configuration option is used to set the AP PIN for initial setup or for registering a new external Registrar.
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config.c15
-rw-r--r--hostapd/config.h1
-rw-r--r--hostapd/hostapd.conf5
3 files changed, 21 insertions, 0 deletions
diff --git a/hostapd/config.c b/hostapd/config.c
index 0ce05c8..e151275 100644
--- a/hostapd/config.c
+++ b/hostapd/config.c
@@ -1963,6 +1963,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
printf("Line %d: invalid os_version\n", line);
errors++;
}
+ } else if (os_strcmp(buf, "ap_pin") == 0) {
+ bss->ap_pin = os_strdup(pos);
#endif /* CONFIG_WPS */
} else {
printf("Line %d: unknown configuration item '%s'\n",
@@ -2166,6 +2168,7 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
os_free(conf->serial_number);
os_free(conf->device_type);
os_free(conf->config_methods);
+ os_free(conf->ap_pin);
#endif /* CONFIG_WPS */
}
@@ -2270,6 +2273,18 @@ hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
"WSC", &wsc_enrollee.methods[0].vendor);
return &wsc_enrollee;
}
+
+ if (conf->wps_state && conf->ap_pin &&
+ identity_len == WSC_ID_REGISTRAR_LEN &&
+ os_memcmp(identity, WSC_ID_REGISTRAR, WSC_ID_REGISTRAR_LEN) == 0) {
+ static struct hostapd_eap_user wsc_registrar;
+ os_memset(&wsc_registrar, 0, sizeof(wsc_registrar));
+ wsc_registrar.methods[0].method = eap_server_get_type(
+ "WSC", &wsc_registrar.methods[0].vendor);
+ wsc_registrar.password = (u8 *) conf->ap_pin;
+ wsc_registrar.password_len = os_strlen(conf->ap_pin);
+ return &wsc_registrar;
+ }
#endif /* CONFIG_WPS */
while (user) {
diff --git a/hostapd/config.h b/hostapd/config.h
index 0fb730b..a27d534 100644
--- a/hostapd/config.h
+++ b/hostapd/config.h
@@ -276,6 +276,7 @@ struct hostapd_bss_config {
char *device_type;
char *config_methods;
u8 os_version[4];
+ char *ap_pin;
#endif /* CONFIG_WPS */
};
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index d96b597..3d2e035 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -833,6 +833,11 @@ own_ip_addr=127.0.0.1
# List of the supported configuration methods
#config_methods=label display push_button keypad
+# Access point PIN for initial configuration and adding Registrars
+# If not set, hostapd will not allow external WPS Registrars to control the
+# access point.
+#ap_pin=12345670
+
##### Multiple BSSID support ##################################################
#