aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-10-04 08:45:13 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-04 08:45:13 (GMT)
commita530fe778ba0b27e90a5989df48e5bf3d32ef2ae (patch)
tree961627b65e60c41ab0610221bc476b47ad7db045 /wpa_supplicant/ctrl_iface.c
parent4b9d79b66ec4616296422195aa6dd091dd9586ad (diff)
downloadhostap-a530fe778ba0b27e90a5989df48e5bf3d32ef2ae.zip
hostap-a530fe778ba0b27e90a5989df48e5bf3d32ef2ae.tar.gz
hostap-a530fe778ba0b27e90a5989df48e5bf3d32ef2ae.tar.bz2
Add wpa_supplicant EVENT_TEST control interface command
This testing command makes it easier to debug bursts of event message. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ctrl_iface.c')
-rw-r--r--wpa_supplicant/ctrl_iface.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 3b97806..02d0cc2 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -7735,6 +7735,33 @@ static int wpas_ctrl_get_fail(struct wpa_supplicant *wpa_s,
#endif /* WPA_TRACE_BFD */
}
+
+static void wpas_ctrl_event_test_cb(void *eloop_ctx, void *timeout_ctx)
+{
+ struct wpa_supplicant *wpa_s = eloop_ctx;
+ int i, count = (intptr_t) timeout_ctx;
+
+ wpa_printf(MSG_DEBUG, "TEST: Send %d control interface event messages",
+ count);
+ for (i = 0; i < count; i++) {
+ wpa_msg_ctrl(wpa_s, MSG_INFO, "TEST-EVENT-MESSAGE %d/%d",
+ i + 1, count);
+ }
+}
+
+
+static int wpas_ctrl_event_test(struct wpa_supplicant *wpa_s, const char *cmd)
+{
+ int count;
+
+ count = atoi(cmd);
+ if (count <= 0)
+ return -1;
+
+ return eloop_register_timeout(0, 0, wpas_ctrl_event_test_cb, wpa_s,
+ (void *) (intptr_t) count);
+}
+
#endif /* CONFIG_TESTING_OPTIONS */
@@ -8769,6 +8796,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
reply_len = -1;
} else if (os_strcmp(buf, "GET_FAIL") == 0) {
reply_len = wpas_ctrl_get_fail(wpa_s, reply, reply_size);
+ } else if (os_strncmp(buf, "EVENT_TEST ", 11) == 0) {
+ if (wpas_ctrl_event_test(wpa_s, buf + 11) < 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)