]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow EAPOL-Key Request to be sent through control interface
authorJouni Malinen <j@w1.fi>
Sat, 14 Oct 2017 15:04:34 +0000 (18:04 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 16 Oct 2017 14:47:24 +0000 (17:47 +0300)
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>
wpa_supplicant/ctrl_iface.c

index 746c9f1fe498537671caccde524214048113b3d1..cd76fea36db93e4821378b63cd631d57b86b56aa 100644 (file)
@@ -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)