aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-11-07 10:41:01 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-07 10:41:01 (GMT)
commite9bcfebfce3c8a12ebdeddb05f86fc2a97fadae2 (patch)
treec3529aca898cf8db1c80ab41746ba15cb08d1141 /wpa_supplicant
parent08eb154db52f167b7c331ea565f4fd8bb21ccbb0 (diff)
downloadhostap-e9bcfebfce3c8a12ebdeddb05f86fc2a97fadae2.zip
hostap-e9bcfebfce3c8a12ebdeddb05f86fc2a97fadae2.tar.gz
hostap-e9bcfebfce3c8a12ebdeddb05f86fc2a97fadae2.tar.bz2
WPS: Add initial part of External Registrar functionality
This is the first step in adding support for using wpa_supplicant as a WPS External Registrar to manage APs over UPnP. Only the device discovery part is implemented in this commit.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/Makefile6
-rw-r--r--wpa_supplicant/ctrl_iface.c6
-rw-r--r--wpa_supplicant/wpa_cli.c22
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
-rw-r--r--wpa_supplicant/wps_supplicant.c30
-rw-r--r--wpa_supplicant/wps_supplicant.h2
6 files changed, 67 insertions, 0 deletions
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 6e15f24..e234bc8 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -497,6 +497,12 @@ ifdef NEED_WPS_OOB
CFLAGS += -DCONFIG_WPS_OOB
endif
+ifdef CONFIG_WPS_ER
+CONFIG_WPS_UPNP=y
+CFLAGS += -DCONFIG_WPS_ER
+OBJS += ../src/wps/wps_er.o
+endif
+
ifdef CONFIG_WPS_UPNP
CFLAGS += -DCONFIG_WPS_UPNP
OBJS += ../src/wps/wps_upnp.o
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index bebb125..c00169c 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1632,6 +1632,12 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strncmp(buf, "WPS_REG ", 8) == 0) {
if (wpa_supplicant_ctrl_iface_wps_reg(wpa_s, buf + 8))
reply_len = -1;
+ } else if (os_strcmp(buf, "WPS_ER_START") == 0) {
+ if (wpas_wps_er_start(wpa_s))
+ reply_len = -1;
+ } else if (os_strcmp(buf, "WPS_ER_STOP") == 0) {
+ if (wpas_wps_er_stop(wpa_s))
+ reply_len = -1;
#endif /* CONFIG_WPS */
#ifdef CONFIG_IBSS_RSN
} else if (os_strncmp(buf, "IBSS_RSN ", 9) == 0) {
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index ec103bf..f19a603 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -533,6 +533,22 @@ static int wpa_cli_cmd_wps_reg(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
+static int wpa_cli_cmd_wps_er_start(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "WPS_ER_START");
+
+}
+
+
+static int wpa_cli_cmd_wps_er_stop(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "WPS_ER_STOP");
+
+}
+
+
static int wpa_cli_cmd_ibss_rsn(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
@@ -1397,6 +1413,12 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "wps_reg", wpa_cli_cmd_wps_reg,
cli_cmd_flag_sensitive,
"<BSSID> <AP PIN> = start WPS Registrar to configure an AP" },
+ { "wps_er_start", wpa_cli_cmd_wps_er_start,
+ cli_cmd_flag_none,
+ "= start Wi-Fi Protected Setup External Registrar" },
+ { "wps_er_stop", wpa_cli_cmd_wps_er_stop,
+ cli_cmd_flag_none,
+ "= stop Wi-Fi Protected Setup External Registrar" },
{ "ibss_rsn", wpa_cli_cmd_ibss_rsn,
cli_cmd_flag_none,
"<addr> = request RSN authentication with <addr> in IBSS" },
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index d426aaa..e47ac74 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -380,6 +380,7 @@ struct wpa_supplicant {
struct wps_context *wps;
int wps_success; /* WPS success event received */
+ struct wps_er *wps_er;
int blacklist_cleared;
struct wpabuf *pending_eapol_rx;
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 95f3b88..5fd94e2 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -814,6 +814,9 @@ void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
os_free(wpa_s->wps->network_key);
os_free(wpa_s->wps);
wpa_s->wps = NULL;
+
+ wps_er_deinit(wpa_s->wps_er);
+ wpa_s->wps_er = NULL;
}
@@ -1021,3 +1024,30 @@ int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
wpabuf_free(wps_ie);
return ret;
}
+
+
+int wpas_wps_er_start(struct wpa_supplicant *wpa_s)
+{
+#ifdef CONFIG_WPS_ER
+ if (wpa_s->wps_er) {
+ /* TODO: re-send ctrl_iface events for current data? */
+ return 0;
+ }
+ wpa_s->wps_er = wps_er_init(wpa_s->wps, wpa_s->ifname);
+ if (wpa_s->wps_er == NULL)
+ return -1;
+ return 0;
+#else /* CONFIG_WPS_ER */
+ return 0;
+#endif /* CONFIG_WPS_ER */
+}
+
+
+int wpas_wps_er_stop(struct wpa_supplicant *wpa_s)
+{
+#ifdef CONFIG_WPS_ER
+ wps_er_deinit(wpa_s->wps_er);
+ wpa_s->wps_er = NULL;
+#endif /* CONFIG_WPS_ER */
+ return 0;
+}
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index 0f23955..e75b3be 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -49,6 +49,8 @@ void wpas_wps_notify_scan_results(struct wpa_supplicant *wpa_s);
int wpas_wps_searching(struct wpa_supplicant *wpa_s);
int wpas_wps_scan_result_text(const u8 *ies, size_t ies_len, char *pos,
char *end);
+int wpas_wps_er_start(struct wpa_supplicant *wpa_s);
+int wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
#else /* CONFIG_WPS */