aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-11-15 20:27:06 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-15 20:27:06 (GMT)
commite64dcfd54b621f5eb48db4e9931cb17dc89d3390 (patch)
tree8fc672846e5c298b57904e38c74f40398ba1aa14 /wpa_supplicant
parent82b857ec0b78a28a080792a921cae785850dd470 (diff)
downloadhostap-e64dcfd54b621f5eb48db4e9931cb17dc89d3390.zip
hostap-e64dcfd54b621f5eb48db4e9931cb17dc89d3390.tar.gz
hostap-e64dcfd54b621f5eb48db4e9931cb17dc89d3390.tar.bz2
WPS ER: Add command for fetching current AP settings
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/ctrl_iface.c15
-rw-r--r--wpa_supplicant/wpa_cli.c26
-rw-r--r--wpa_supplicant/wps_supplicant.c12
-rw-r--r--wpa_supplicant/wps_supplicant.h2
4 files changed, 55 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index d732133..48e445d 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -308,6 +308,18 @@ static int wpa_supplicant_ctrl_iface_wps_er_pin(struct wpa_supplicant *wpa_s,
*pin++ = '\0';
return wpas_wps_er_add_pin(wpa_s, uuid, pin);
}
+
+
+static int wpa_supplicant_ctrl_iface_wps_er_learn(struct wpa_supplicant *wpa_s,
+ char *cmd)
+{
+ char *uuid = cmd, *pin;
+ pin = os_strchr(uuid, ' ');
+ if (pin == NULL)
+ return -1;
+ *pin++ = '\0';
+ return wpas_wps_er_learn(wpa_s, uuid, pin);
+}
#endif /* CONFIG_WPS_ER */
#endif /* CONFIG_WPS */
@@ -1660,6 +1672,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strncmp(buf, "WPS_ER_PBC ", 11) == 0) {
if (wpas_wps_er_pbc(wpa_s, buf + 11))
reply_len = -1;
+ } else if (os_strncmp(buf, "WPS_ER_LEARN ", 13) == 0) {
+ if (wpa_supplicant_ctrl_iface_wps_er_learn(wpa_s, buf + 13))
+ reply_len = -1;
#endif /* CONFIG_WPS_ER */
#endif /* CONFIG_WPS */
#ifdef CONFIG_IBSS_RSN
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 11a1e46..dc7ae6c 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -594,6 +594,29 @@ static int wpa_cli_cmd_wps_er_pbc(struct wpa_ctrl *ctrl, int argc,
}
+static int wpa_cli_cmd_wps_er_learn(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ if (argc != 2) {
+ printf("Invalid WPS_ER_LEARN command: need two arguments:\n"
+ "- UUID: specify which AP to use\n"
+ "- PIN: AP PIN\n");
+ return -1;
+ }
+
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_ER_LEARN %s %s",
+ argv[0], argv[1]);
+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+ printf("Too long WPS_ER_LEARN command.\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
+
+
static int wpa_cli_cmd_ibss_rsn(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
@@ -1470,6 +1493,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "wps_er_pbc", wpa_cli_cmd_wps_er_pbc,
cli_cmd_flag_none,
"<UUID> = accept an Enrollee PBC using External Registrar" },
+ { "wps_er_learn", wpa_cli_cmd_wps_er_learn,
+ cli_cmd_flag_sensitive,
+ "<UUID> <PIN> = learn AP configuration" },
{ "ibss_rsn", wpa_cli_cmd_ibss_rsn,
cli_cmd_flag_none,
"<addr> = request RSN authentication with <addr> in IBSS" },
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index a2193d1..bc54c0d 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1171,4 +1171,16 @@ int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid)
return -1;
return wps_er_pbc(wpa_s->wps_er, u);
}
+
+
+int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
+ const char *pin)
+{
+ u8 u[UUID_LEN];
+
+ if (uuid_str2bin(uuid, u))
+ return -1;
+ return wps_er_learn(wpa_s->wps_er, u, (const u8 *) pin,
+ os_strlen(pin));
+}
#endif /* CONFIG_WPS_ER */
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index db70edd..d51ff61 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -54,6 +54,8 @@ int wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const char *uuid,
const char *pin);
int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
+int wpas_wps_er_learn(struct wpa_supplicant *wpa_s, const char *uuid,
+ const char *pin);
#else /* CONFIG_WPS */