]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - build-utilities/hostap.git/commitdiff
Add a mechanism to insert notes to wpa_supplicant debug log
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 4 Aug 2010 16:11:32 +0000 (09:11 -0700)
committerJouni Malinen <j@w1.fi>
Wed, 11 Aug 2010 15:07:22 +0000 (18:07 +0300)
This can be used to insert information from external programs to the
wpa_supplicant debug log.

wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_cli.c

index 5c3a73579cc025cf17e550022a441550ea040d5f..464a226829d610a9e92a5e3cc8053d625f50829f 100644 (file)
@@ -1761,6 +1761,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        if (os_strcmp(buf, "PING") == 0) {
                os_memcpy(reply, "PONG\n", 5);
                reply_len = 5;
+       } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
+               wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
        } else if (os_strcmp(buf, "MIB") == 0) {
                reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
                if (reply_len >= 0) {
index 2d878c5255f7c1a2a8992cbbbcad0d2859d05d83..2a9261b09320c5b55008740ea6168fa8a236f263 100644 (file)
@@ -371,6 +371,19 @@ static int wpa_cli_cmd_ping(struct wpa_ctrl *ctrl, int argc, char *argv[])
 }
 
 
+static int wpa_cli_cmd_note(struct wpa_ctrl *ctrl, int argc, char *argv[])
+{
+       char cmd[256];
+       int ret;
+       if (argc == 0)
+               return -1;
+       ret = os_snprintf(cmd, sizeof(cmd), "NOTE %s", argv[0]);
+       if (ret < 0 || (size_t) ret >= sizeof(cmd))
+               return -1;
+       return wpa_ctrl_command(ctrl, cmd);
+}
+
+
 static int wpa_cli_cmd_mib(struct wpa_ctrl *ctrl, int argc, char *argv[])
 {
        return wpa_ctrl_command(ctrl, "MIB");
@@ -1578,6 +1591,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
        { "ping", wpa_cli_cmd_ping,
          cli_cmd_flag_none,
          "= pings wpa_supplicant" },
+       { "note", wpa_cli_cmd_note,
+         cli_cmd_flag_none,
+         "<text> = add a note to wpa_supplicant debug log" },
        { "mib", wpa_cli_cmd_mib,
          cli_cmd_flag_none,
          "= get MIB variables (dot1x, dot11)" },