Add a mechanism to insert notes to wpa_supplicant debug log
This can be used to insert information from external programs to the wpa_supplicant debug log.
This commit is contained in:
parent
92afbe9d63
commit
77895cd937
2 changed files with 18 additions and 0 deletions
|
@ -1761,6 +1761,8 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
||||||
if (os_strcmp(buf, "PING") == 0) {
|
if (os_strcmp(buf, "PING") == 0) {
|
||||||
os_memcpy(reply, "PONG\n", 5);
|
os_memcpy(reply, "PONG\n", 5);
|
||||||
reply_len = 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) {
|
} else if (os_strcmp(buf, "MIB") == 0) {
|
||||||
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
|
reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
|
||||||
if (reply_len >= 0) {
|
if (reply_len >= 0) {
|
||||||
|
|
|
@ -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[])
|
static int wpa_cli_cmd_mib(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return wpa_ctrl_command(ctrl, "MIB");
|
return wpa_ctrl_command(ctrl, "MIB");
|
||||||
|
@ -1578,6 +1591,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
|
||||||
{ "ping", wpa_cli_cmd_ping,
|
{ "ping", wpa_cli_cmd_ping,
|
||||||
cli_cmd_flag_none,
|
cli_cmd_flag_none,
|
||||||
"= pings wpa_supplicant" },
|
"= 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,
|
{ "mib", wpa_cli_cmd_mib,
|
||||||
cli_cmd_flag_none,
|
cli_cmd_flag_none,
|
||||||
"= get MIB variables (dot1x, dot11)" },
|
"= get MIB variables (dot1x, dot11)" },
|
||||||
|
|
Loading…
Reference in a new issue