aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/ctrl_iface.c
diff options
context:
space:
mode:
authorSrinivas Dasari <dasaris@qti.qualcomm.com>2015-08-02 09:34:21 (GMT)
committerJouni Malinen <j@w1.fi>2015-08-03 14:50:09 (GMT)
commit5c4f0511a20c316f2ac24396377b09a50a34fe04 (patch)
tree1f27e79b15f3c87aac70395cb8983d05c4e382c2 /hostapd/ctrl_iface.c
parentab62f96f55ebdda69a8fd173980c181adce0a1bf (diff)
downloadhostap-5c4f0511a20c316f2ac24396377b09a50a34fe04.zip
hostap-5c4f0511a20c316f2ac24396377b09a50a34fe04.tar.gz
hostap-5c4f0511a20c316f2ac24396377b09a50a34fe04.tar.bz2
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. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'hostapd/ctrl_iface.c')
-rw-r--r--hostapd/ctrl_iface.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index d2c78ca..835feb0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1961,6 +1961,52 @@ static int hostapd_ctrl_iface_eapol_set(struct hostapd_data *hapd, char *cmd)
}
+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,
int reply_size,
@@ -2189,6 +2235,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "EAPOL_SET ", 10) == 0) {
if (hostapd_ctrl_iface_eapol_set(hapd, buf + 10))
reply_len = -1;
+ } else if (os_strncmp(buf, "LOG_LEVEL", 9) == 0) {
+ reply_len = hostapd_ctrl_iface_log_level(
+ hapd, buf + 9, reply, reply_size);
} else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;