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>
This commit is contained in:
Jouni Malinen 2017-10-14 18:04:34 +03:00
parent bb06748f45
commit 751f5b2933

View 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)