From a1a31b6c3f9f87f87e232a819065042c85092726 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 2 Jan 2014 18:15:07 +0200 Subject: [PATCH] Remove hostapd dump_file functionality This debugging mechanism has now been deprecated by the control interface commands that can be used to fetch same internal information from hostapd in a more convenient way. Leave the empty USR1 signal handler and configuration file parameter for backwards compatibility. They can be removed in future versions of hostapd. Signed-hostap: Jouni Malinen --- hostapd/Android.mk | 5 +-- hostapd/Makefile | 6 ++-- hostapd/android.config | 2 +- hostapd/config_file.c | 3 +- hostapd/defconfig | 2 +- hostapd/dump_state.c | 81 ------------------------------------------ hostapd/dump_state.h | 14 -------- hostapd/hostapd.conf | 3 -- hostapd/main.c | 6 +--- src/ap/ap_config.c | 1 - src/ap/ap_config.h | 2 -- 11 files changed, 11 insertions(+), 114 deletions(-) delete mode 100644 hostapd/dump_state.c delete mode 100644 hostapd/dump_state.h diff --git a/hostapd/Android.mk b/hostapd/Android.mk index bc0273e0c..c6cdecf5a 100644 --- a/hostapd/Android.mk +++ b/hostapd/Android.mk @@ -137,8 +137,9 @@ OBJS += src/eapol_auth/eapol_auth_sm.c ifndef CONFIG_NO_DUMP_STATE -# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to -# a file (undefine it, if you want to save in binary size) +# define HOSTAPD_DUMP_STATE to include support for dumping internal state +# through control interface commands (undefine it, if you want to save in +# binary size) L_CFLAGS += -DHOSTAPD_DUMP_STATE OBJS += dump_state.c OBJS += src/eapol_auth/eapol_auth_dump.c diff --git a/hostapd/Makefile b/hostapd/Makefile index 753781406..5bf91ba32 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -119,10 +119,10 @@ LIBS_n += -lgcov endif ifndef CONFIG_NO_DUMP_STATE -# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to -# a file (undefine it, if you want to save in binary size) +# define HOSTAPD_DUMP_STATE to include support for dumping internal state +# through control interface commands (undefine it, if you want to save in +# binary size) CFLAGS += -DHOSTAPD_DUMP_STATE -OBJS += dump_state.o OBJS += ../src/eapol_auth/eapol_auth_dump.o endif diff --git a/hostapd/android.config b/hostapd/android.config index 51d6656f1..81a2e2ceb 100644 --- a/hostapd/android.config +++ b/hostapd/android.config @@ -157,7 +157,7 @@ CONFIG_NO_RADIUS=y # Remove support for VLANs #CONFIG_NO_VLAN=y -# Remove support for dumping state into a file on SIGUSR1 signal +# Remove support for dumping internal state through control interface commands # This can be used to reduce binary size at the cost of disabling a debugging # option. #CONFIG_NO_DUMP_STATE=y diff --git a/hostapd/config_file.c b/hostapd/config_file.c index fa1a7fb4b..41988345b 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -1631,7 +1631,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, } else if (os_strcmp(buf, "logger_stdout") == 0) { bss->logger_stdout = atoi(pos); } else if (os_strcmp(buf, "dump_file") == 0) { - bss->dump_log_name = os_strdup(pos); + wpa_printf(MSG_INFO, "Line %d: DEPRECATED: 'dump_file' configuration variable is not used anymore", + line); } else if (os_strcmp(buf, "ssid") == 0) { bss->ssid.ssid_len = os_strlen(pos); if (bss->ssid.ssid_len > HOSTAPD_MAX_SSID_LEN || diff --git a/hostapd/defconfig b/hostapd/defconfig index a9c8bdcef..60f2c04ec 100644 --- a/hostapd/defconfig +++ b/hostapd/defconfig @@ -179,7 +179,7 @@ CONFIG_IPV6=y # Note: This requires libnl 3.1 or newer. #CONFIG_VLAN_NETLINK=y -# Remove support for dumping state into a file on SIGUSR1 signal +# Remove support for dumping internal state through control interface commands # This can be used to reduce binary size at the cost of disabling a debugging # option. #CONFIG_NO_DUMP_STATE=y diff --git a/hostapd/dump_state.c b/hostapd/dump_state.c deleted file mode 100644 index fb25c15f3..000000000 --- a/hostapd/dump_state.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * hostapd / State dump - * Copyright (c) 2002-2009, Jouni Malinen - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#include "utils/includes.h" -#include - -#include "utils/common.h" -#include "eapol_auth/eapol_auth_sm.h" -#include "eapol_auth/eapol_auth_sm_i.h" -#include "eap_server/eap.h" -#include "ap/hostapd.h" -#include "ap/ap_config.h" -#include "ap/sta_info.h" -#include "dump_state.h" -#include "ap/ap_drv_ops.h" - - -static void ieee802_1x_dump_state(FILE *f, struct sta_info *sta) -{ - struct eapol_state_machine *sm = sta->eapol_sm; - char buf[4096]; - int res; - - if (sm == NULL) - return; - res = eapol_auth_dump_state(sm, buf, sizeof(buf)); - if (res > 0) - fprintf(f, "%s", buf); -} - - -/** - * hostapd_dump_state - SIGUSR1 handler to dump hostapd state to a text file - */ -static void hostapd_dump_state(struct hostapd_data *hapd) -{ - FILE *f; - time_t now; - struct sta_info *sta; - - if (!hapd->conf->dump_log_name) { - wpa_printf(MSG_DEBUG, "Dump file not defined - ignoring dump " - "request"); - return; - } - - wpa_printf(MSG_DEBUG, "Dumping hostapd state to '%s'", - hapd->conf->dump_log_name); - f = fopen(hapd->conf->dump_log_name, "w"); - if (f == NULL) { - wpa_printf(MSG_WARNING, "Could not open dump file '%s' for " - "writing.", hapd->conf->dump_log_name); - return; - } - - time(&now); - fprintf(f, "hostapd state dump - %s", ctime(&now)); - - for (sta = hapd->sta_list; sta != NULL; sta = sta->next) { - fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr)); - ieee802_1x_dump_state(f, sta); - } - - fclose(f); -} - - -int handle_dump_state_iface(struct hostapd_iface *iface, void *ctx) -{ - size_t i; - - for (i = 0; i < iface->num_bss; i++) - hostapd_dump_state(iface->bss[i]); - - return 0; -} diff --git a/hostapd/dump_state.h b/hostapd/dump_state.h deleted file mode 100644 index a209d6535..000000000 --- a/hostapd/dump_state.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * hostapd / State dump - * Copyright (c) 2002-2009, Jouni Malinen - * - * This software may be distributed under the terms of the BSD license. - * See README for more details. - */ - -#ifndef DUMP_STATE_H -#define DUMP_STATE_H - -int handle_dump_state_iface(struct hostapd_iface *iface, void *ctx); - -#endif /* DUMP_STATE_H */ diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 9b70d0fbe..da7817f42 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -51,9 +51,6 @@ logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 -# Dump file for state information (on SIGUSR1) -dump_file=/tmp/hostapd.dump - # Interface for separate control program. If this is specified, hostapd # will create this directory and a UNIX domain socket for listening to requests # from external programs (CLI/GUI, etc.) for status information and diff --git a/hostapd/main.c b/hostapd/main.c index 196bccc71..edb5a11d3 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -25,7 +25,6 @@ #include "ap/ap_drv_ops.h" #include "config_file.h" #include "eap_register.h" -#include "dump_state.h" #include "ctrl_iface.h" @@ -295,10 +294,7 @@ static void handle_reload(int sig, void *signal_ctx) static void handle_dump_state(int sig, void *signal_ctx) { -#ifdef HOSTAPD_DUMP_STATE - struct hapd_interfaces *interfaces = signal_ctx; - hostapd_for_each_interface(interfaces, handle_dump_state_iface, NULL); -#endif /* HOSTAPD_DUMP_STATE */ + /* Not used anymore - ignore signal */ } #endif /* CONFIG_NATIVE_WINDOWS */ diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 5033c5567..a29f4d0e0 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -433,7 +433,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) } os_free(conf->eap_user_sqlite); - os_free(conf->dump_log_name); os_free(conf->eap_req_id_text); os_free(conf->accept_mac); os_free(conf->deny_mac); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 09b2778e0..af30ac49a 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -189,8 +189,6 @@ struct hostapd_bss_config { unsigned int logger_syslog; /* module bitfield */ unsigned int logger_stdout; /* module bitfield */ - char *dump_log_name; /* file name for state dump (SIGUSR1) */ - int max_num_sta; /* maximum number of STAs in station table */ int dtim_period;