aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-01-08 04:29:35 (GMT)
committerJouni Malinen <j@w1.fi>2008-01-08 04:29:35 (GMT)
commit5722f6dfbf0c94b3e2eb4b949bf0464523b51e39 (patch)
treed6635a9f344d1318d3f58651a688e27e900a4aa1 /hostapd
parent3d9fd79fdf5410e41068cfc7d909d3bf6c0cb815 (diff)
downloadhostap-history-5722f6dfbf0c94b3e2eb4b949bf0464523b51e39.zip
hostap-history-5722f6dfbf0c94b3e2eb4b949bf0464523b51e39.tar.gz
hostap-history-5722f6dfbf0c94b3e2eb4b949bf0464523b51e39.tar.bz2
WPS: Notification for Enrollee PIN requests
Send a ctrl_iface monitor event and optionally write an entry to a text file (wps_pin_requests in hostapd.conf) when an Enrollee requests WPS negotiation and no Device Password (PIN) is available for the specified Enrollee UUID. This version is only providing E-UUID in the callback. Additional information about the Enrollee (Manufacturer, device type, etc.) should also be added to the callback (and ctrl_iface/text file logging).
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config.c6
-rw-r--r--hostapd/config.h1
-rw-r--r--hostapd/hostapd.conf8
-rw-r--r--hostapd/wps_hostapd.c31
4 files changed, 46 insertions, 0 deletions
diff --git a/hostapd/config.c b/hostapd/config.c
index f6d953b..ca6a107 100644
--- a/hostapd/config.c
+++ b/hostapd/config.c
@@ -1942,6 +1942,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
printf("Line %d: invalid UUID\n", line);
errors++;
}
+ } else if (os_strcmp(buf, "wps_pin_requests") == 0) {
+ bss->wps_pin_requests = os_strdup(pos);
#endif /* CONFIG_WPS */
} else {
printf("Line %d: unknown configuration item '%s'\n",
@@ -2135,6 +2137,10 @@ static void hostapd_config_free_bss(struct hostapd_bss_config *conf)
}
}
#endif /* CONFIG_IEEE80211R */
+
+#ifdef CONFIG_WPS
+ os_free(conf->wps_pin_requests);
+#endif /* CONFIG_WPS */
}
diff --git a/hostapd/config.h b/hostapd/config.h
index 0e5a8f0..2d4a496 100644
--- a/hostapd/config.h
+++ b/hostapd/config.h
@@ -267,6 +267,7 @@ struct hostapd_bss_config {
#ifdef CONFIG_WPS
int ap_setup_locked;
u8 uuid[16];
+ char *wps_pin_requests;
#endif /* CONFIG_WPS */
};
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 38821d8..a0ba216 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -784,6 +784,14 @@ own_ip_addr=127.0.0.1
# per-device PSKs is recommended as the more secure option (i.e., make sure to
# set wpa_psk_file when using WPS with WPA-PSK).
+# When an Enrollee requests access to the network with PIN method, the Enrollee
+# PIN will need to be entered for the Registrar. PIN request notifications are
+# sent to hostapd ctrl_iface monitor. In addition, they can be written to a
+# text file that could be used, e.g., to populate the AP administration UI with
+# pending PIN requests. If the following variable is set, the PIN requests will
+# be written to the configured file.
+#wps_pin_requests=/var/run/hostapd_wps_pin_requests
+
# Multiple BSSID support
#
diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c
index 7e27f7c..f61aba4 100644
--- a/hostapd/wps_hostapd.c
+++ b/hostapd/wps_hostapd.c
@@ -17,6 +17,8 @@
#include "hostapd.h"
#include "driver.h"
#include "uuid.h"
+#include "wpa_ctrl.h"
+#include "ctrl_iface.h"
#include "wps/wps.h"
#include "wps/wps_defs.h"
#include "wps_hostapd.h"
@@ -111,6 +113,34 @@ static int hostapd_wps_set_ie_cb(void *ctx, const u8 *beacon_ie,
}
+static void hostapd_wps_pin_needed_cb(void *ctx, const u8 *uuid_e)
+{
+ struct hostapd_data *hapd = ctx;
+ char uuid[40], txt[100];
+ int len;
+ if (uuid_bin2str(uuid_e, uuid, sizeof(uuid)))
+ return;
+ wpa_printf(MSG_DEBUG, "WPS: PIN needed for E-UUID %s", uuid);
+ len = os_snprintf(txt, sizeof(txt), WPS_EVENT_PIN_NEEDED "%s", uuid);
+ if (len < 0 || len >= (int) sizeof(txt))
+ return;
+ hostapd_ctrl_iface_send(hapd, MSG_INFO, txt, len);
+
+ if (hapd->conf->wps_pin_requests) {
+ FILE *f;
+ struct os_time t;
+ f = fopen(hapd->conf->wps_pin_requests, "a");
+ if (f == NULL)
+ return;
+ os_get_time(&t);
+ /* TODO: add more information about Enrollee (Manufacturer,
+ * Device Type, ...) */
+ fprintf(f, "%ld\t%s\n", t.sec, uuid);
+ fclose(f);
+ }
+}
+
+
static void hostapd_wps_clear_ies(struct hostapd_data *hapd)
{
os_free(hapd->wps_beacon_ie);
@@ -195,6 +225,7 @@ int hostapd_init_wps(struct hostapd_data *hapd,
cfg.new_psk_cb = hostapd_wps_new_psk_cb;
cfg.set_ie_cb = hostapd_wps_set_ie_cb;
+ cfg.pin_needed_cb = hostapd_wps_pin_needed_cb;
cfg.cb_ctx = hapd;
hapd->wps_registrar = wps_registrar_init(&cfg);