aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-10-14 15:04:34 (GMT)
committerJouni Malinen <j@w1.fi>2017-10-16 14:47:24 (GMT)
commit751f5b29333d590e623418ff654c500118a94e2f (patch)
tree05f6cdd2a738eb1fdc63bf5b848f4a5347a545f8 /wpa_supplicant/ctrl_iface.c
parentbb06748f453ccba95f243e140a46c39370a08932 (diff)
downloadhostap-751f5b29333d590e623418ff654c500118a94e2f.zip
hostap-751f5b29333d590e623418ff654c500118a94e2f.tar.gz
hostap-751f5b29333d590e623418ff654c500118a94e2f.tar.bz2
Allow EAPOL-Key Request to be sent through control interface
The new wpa_supplicant "KEY_REQUEST <error=0/1> <pairwise=0/1>" command can be used to request an EAPOL-Key Request frame to be sent to the AP. This functionality is for testing purposes and included only in builds with CONFIG_TESTING_OPTIONS=y. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ctrl_iface.c')
-rw-r--r--wpa_supplicant/ctrl_iface.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 746c9f1..cd76fea 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -8937,6 +8937,21 @@ static int wpas_ctrl_reset_pn(struct wpa_supplicant *wpa_s)
wpa_s->last_tk, wpa_s->last_tk_len);
}
+
+static int wpas_ctrl_key_request(struct wpa_supplicant *wpa_s, const char *cmd)
+{
+ const char *pos = cmd;
+ int error, pairwise;
+
+ error = atoi(pos);
+ pos = os_strchr(pos, ' ');
+ if (!pos)
+ return -1;
+ pairwise = atoi(pos);
+ wpa_sm_key_request(wpa_s->wpa, error, pairwise);
+ return 0;
+}
+
#endif /* CONFIG_TESTING_OPTIONS */
@@ -10311,6 +10326,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strcmp(buf, "RESET_PN") == 0) {
if (wpas_ctrl_reset_pn(wpa_s) < 0)
reply_len = -1;
+ } else if (os_strncmp(buf, "KEY_REQUEST ", 12) == 0) {
+ if (wpas_ctrl_key_request(wpa_s, buf + 12) < 0)
+ reply_len = -1;
#endif /* CONFIG_TESTING_OPTIONS */
} else if (os_strncmp(buf, "VENDOR_ELEM_ADD ", 16) == 0) {
if (wpas_ctrl_vendor_elem_add(wpa_s, buf + 16) < 0)