Add hostapd control interface command to stop logging to file
Add CLOSE_LOG command to stop hostapd logging to file. This can be followed with RELOG to restart logging to the same file path. Signed-off-by: Sai Pratyusha Magam <quic_smagam@quicinc.com>
This commit is contained in:
parent
0fd13c90eb
commit
080afc03d5
4 changed files with 21 additions and 1 deletions
|
@ -3195,6 +3195,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
|
|||
} else if (os_strncmp(buf, "RELOG", 5) == 0) {
|
||||
if (wpa_debug_reopen_file() < 0)
|
||||
reply_len = -1;
|
||||
} else if (os_strcmp(buf, "CLOSE_LOG") == 0) {
|
||||
wpa_debug_stop_log();
|
||||
} else if (os_strncmp(buf, "NOTE ", 5) == 0) {
|
||||
wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
|
||||
} else if (os_strcmp(buf, "STATUS") == 0) {
|
||||
|
|
|
@ -252,6 +252,13 @@ static int hostapd_cli_cmd_relog(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
static int hostapd_cli_cmd_close_log(struct wpa_ctrl *ctrl, int argc,
|
||||
char *argv[])
|
||||
{
|
||||
return wpa_ctrl_command(ctrl, "CLOSE_LOG");
|
||||
}
|
||||
|
||||
|
||||
static int hostapd_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||
{
|
||||
if (argc > 0 && os_strcmp(argv[0], "driver") == 0)
|
||||
|
@ -1572,6 +1579,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
|
|||
"= get MIB variables (dot1x, dot11, radius)" },
|
||||
{ "relog", hostapd_cli_cmd_relog, NULL,
|
||||
"= reload/truncate debug log output file" },
|
||||
{ "close_log", hostapd_cli_cmd_close_log, NULL,
|
||||
"= disable debug log output file" },
|
||||
{ "status", hostapd_cli_cmd_status, NULL,
|
||||
"= show interface status info" },
|
||||
{ "sta", hostapd_cli_cmd_sta, hostapd_complete_stations,
|
||||
|
|
|
@ -596,13 +596,21 @@ int wpa_debug_open_file(const char *path)
|
|||
}
|
||||
|
||||
|
||||
void wpa_debug_close_file(void)
|
||||
void wpa_debug_stop_log(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
if (!out_file)
|
||||
return;
|
||||
fclose(out_file);
|
||||
out_file = NULL;
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
}
|
||||
|
||||
|
||||
void wpa_debug_close_file(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
wpa_debug_stop_log();
|
||||
os_free(last_path);
|
||||
last_path = NULL;
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
|
|
|
@ -49,6 +49,7 @@ int wpa_debug_open_file(const char *path);
|
|||
int wpa_debug_reopen_file(void);
|
||||
void wpa_debug_close_file(void);
|
||||
void wpa_debug_setup_stdout(void);
|
||||
void wpa_debug_stop_log(void);
|
||||
|
||||
/**
|
||||
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
||||
|
|
Loading…
Reference in a new issue