aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorSrinivas Dasari <dasaris@qti.qualcomm.com>2015-08-17 13:19:14 +0530
committerSrinivas Dasari <dasaris@codeaurora.org>2015-10-27 15:26:42 +0530
commitdf108644a680552f7acf1e356632dc1fac3752e5 (patch)
treebd0eb12b9d92fa752e203fabe208b8cee0a31a64 /hostapd
parentbe10fca4de6ea6516c95c5aa0909cdbb67e15fbe (diff)
downloadandroid_external_wpa_supplicant_8-df108644a680552f7acf1e356632dc1fac3752e5.tar.gz
android_external_wpa_supplicant_8-df108644a680552f7acf1e356632dc1fac3752e5.tar.bz2
android_external_wpa_supplicant_8-df108644a680552f7acf1e356632dc1fac3752e5.zip
hostapd: Add support to configure debug log level at runtime
Add support to read/configure log_level using hostapd control interface LOG_LEVEL command similarly to what was already supported in wpa_supplicant CRs-Fixed: 891515 Git-repo: git://w1.fi/srv/git/hostap.git Git-commit: 5c4f0511a20c316f2ac24396377b09a50a34fe04 Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Change-Id: I95fc3957870f5a2f6d1dfa3270fa7e1c821ddd4e
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/ctrl_iface.c49
-rw-r--r--hostapd/hostapd_cli.c18
2 files changed, 67 insertions, 0 deletions
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index ea8e0f8f..ea03b1f6 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1872,6 +1872,52 @@ static int hostapd_ctrl_iface_vendor(struct hostapd_data *hapd, char *cmd,
return ret;
}
+static int hostapd_ctrl_iface_log_level(struct hostapd_data *hapd, char *cmd,
+ char *buf, size_t buflen)
+{
+ char *pos, *end, *stamp;
+ int ret;
+
+ /* cmd: "LOG_LEVEL [<level>]" */
+ if (*cmd == '\0') {
+ pos = buf;
+ end = buf + buflen;
+ ret = os_snprintf(pos, end - pos, "Current level: %s\n"
+ "Timestamp: %d\n",
+ debug_level_str(wpa_debug_level),
+ wpa_debug_timestamp);
+ if (os_snprintf_error(end - pos, ret))
+ ret = 0;
+
+ return ret;
+ }
+
+ while (*cmd == ' ')
+ cmd++;
+
+ stamp = os_strchr(cmd, ' ');
+ if (stamp) {
+ *stamp++ = '\0';
+ while (*stamp == ' ') {
+ stamp++;
+ }
+ }
+
+ if (cmd && os_strlen(cmd)) {
+ int level = str_to_debug_level(cmd);
+ if (level < 0)
+ return -1;
+ wpa_debug_level = level;
+ }
+
+ if (stamp && os_strlen(stamp))
+ wpa_debug_timestamp = atoi(stamp);
+
+ os_memcpy(buf, "OK\n", 3);
+ return 3;
+}
+
+
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
@@ -2085,6 +2131,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
reply_size);
+ } else if (os_strncmp(buf, "LOG_LEVEL", 9) == 0) {
+ reply_len = hostapd_ctrl_iface_log_level(
+ hapd, buf + 9, reply, reply_size);
} else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
ieee802_1x_erp_flush(hapd);
#ifdef RADIUS_SERVER
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 6b1ecba9..392fcb31 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1041,6 +1041,23 @@ static int hostapd_cli_cmd_vendor(struct wpa_ctrl *ctrl, int argc, char *argv[])
return wpa_ctrl_command(ctrl, cmd);
}
+static int hostapd_cli_cmd_log_level(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ res = os_snprintf(cmd, sizeof(cmd), "LOG_LEVEL%s%s%s%s",
+ argc >= 1 ? " " : "",
+ argc >= 1 ? argv[0] : "",
+ argc == 2 ? " " : "",
+ argc == 2 ? argv[1] : "");
+ if (os_snprintf_error(sizeof(cmd), res)) {
+ printf("Too long option\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
static int hostapd_cli_cmd_erp_flush(struct wpa_ctrl *ctrl, int argc,
char *argv[])
@@ -1106,6 +1123,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
{ "reload", hostapd_cli_cmd_reload },
{ "disable", hostapd_cli_cmd_disable },
{ "erp_flush", hostapd_cli_cmd_erp_flush },
+ { "log_level", hostapd_cli_cmd_log_level },
{ NULL, NULL }
};