Revert "Cumulative patch from commit 4ec1fd8e42bad9390f14a58225b6e5f6fb691950"
This reverts commit 78a5dac804c22aa6e4ec8226a864d3b0d6ccddbb.
Test: None
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 9a14be4..ea3a39a 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -38,9 +38,6 @@
L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\"
-# Use Android specific directory for hostapd_cli command completion history
-L_CFLAGS += -DCONFIG_HOSTAPD_CLI_HISTORY_DIR=\"/data/misc/wifi\"
-
# To force sizeof(enum) = 4
ifeq ($(TARGET_ARCH),arm)
L_CFLAGS += -mabi=aapcs-linux
@@ -247,7 +244,7 @@
endif
ifdef CONFIG_IEEE80211R
-L_CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP
+L_CFLAGS += -DCONFIG_IEEE80211R
OBJS += src/ap/wpa_auth_ft.c
NEED_SHA256=y
NEED_AES_OMAC1=y
@@ -261,13 +258,6 @@
NEED_DH_GROUPS=y
endif
-ifdef CONFIG_FILS
-L_CFLAGS += -DCONFIG_FILS
-NEED_CRC32=y
-NEED_SHA384=y
-NEED_AES_SIV=y
-endif
-
ifdef CONFIG_WNM
L_CFLAGS += -DCONFIG_WNM
OBJS += src/ap/wnm_ap.c
@@ -747,9 +737,6 @@
AESOBJS += src/crypto/aes-cbc.c
endif
endif
-ifdef NEED_AES_SIV
-AESOBJS += src/crypto/aes-siv.c
-endif
ifdef NEED_AES_DEC
ifdef CONFIG_INTERNAL_AES
AESOBJS += src/crypto/aes-internal-dec.c
@@ -865,10 +852,6 @@
L_CFLAGS += -DCONFIG_ECC
endif
-ifdef NEED_CRC32
-OBJS += src/utils/crc32.c
-endif
-
ifdef CONFIG_NO_RANDOM_POOL
L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
else
diff --git a/hostapd/ChangeLog b/hostapd/ChangeLog
index d2b669b..30b1472 100644
--- a/hostapd/ChangeLog
+++ b/hostapd/ChangeLog
@@ -1,6 +1,6 @@
ChangeLog for hostapd
-2016-10-02 - v2.6
+????-??-?? - v2.6
* fixed EAP-pwd last fragment validation
[http://w1.fi/security/2015-7/] (CVE-2015-5314)
* fixed WPS configuration update vulnerability with malformed passphrase
diff --git a/hostapd/Makefile b/hostapd/Makefile
index 52c72dc..46dffe5 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -290,7 +290,7 @@
endif
ifdef CONFIG_IEEE80211R
-CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP
+CFLAGS += -DCONFIG_IEEE80211R
OBJS += ../src/ap/wpa_auth_ft.o
NEED_SHA256=y
NEED_AES_OMAC1=y
@@ -305,13 +305,6 @@
NEED_AP_MLME=y
endif
-ifdef CONFIG_FILS
-CFLAGS += -DCONFIG_FILS
-NEED_CRC32=y
-NEED_SHA384=y
-NEED_AES_SIV=y
-endif
-
ifdef CONFIG_WNM
CFLAGS += -DCONFIG_WNM
OBJS += ../src/ap/wnm_ap.o
@@ -784,9 +777,6 @@
AESOBJS += ../src/crypto/aes-cbc.o
endif
endif
-ifdef NEED_AES_SIV
-AESOBJS += ../src/crypto/aes-siv.o
-endif
ifdef NEED_AES_DEC
ifdef CONFIG_INTERNAL_AES
AESOBJS += ../src/crypto/aes-internal-dec.o
@@ -904,10 +894,6 @@
CFLAGS += -DCONFIG_ECC
endif
-ifdef NEED_CRC32
-OBJS += ../src/utils/crc32.o
-endif
-
ifdef CONFIG_NO_RANDOM_POOL
CFLAGS += -DCONFIG_NO_RANDOM_POOL
else
diff --git a/hostapd/android.config b/hostapd/android.config
index 1715cc8..e382c40 100644
--- a/hostapd/android.config
+++ b/hostapd/android.config
@@ -199,6 +199,3 @@
# These extentions facilitate efficient use of multiple frequency bands
# available to the AP and the devices that may associate with it.
#CONFIG_MBO=y
-
-# Include internal line edit mode in hostapd_cli.
-CONFIG_WPA_CLI_EDIT=y
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 7795015..5079f69 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -208,8 +208,7 @@
fclose(f);
- if (*acl)
- qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
return 0;
}
@@ -711,18 +710,6 @@
else if (os_strcmp(start, "WPA-EAP-SUITE-B-192") == 0)
val |= WPA_KEY_MGMT_IEEE8021X_SUITE_B_192;
#endif /* CONFIG_SUITEB192 */
-#ifdef CONFIG_FILS
- else if (os_strcmp(start, "FILS-SHA256") == 0)
- val |= WPA_KEY_MGMT_FILS_SHA256;
- else if (os_strcmp(start, "FILS-SHA384") == 0)
- val |= WPA_KEY_MGMT_FILS_SHA384;
-#ifdef CONFIG_IEEE80211R
- else if (os_strcmp(start, "FT-FILS-SHA256") == 0)
- val |= WPA_KEY_MGMT_FT_FILS_SHA256;
- else if (os_strcmp(start, "FT-FILS-SHA384") == 0)
- val |= WPA_KEY_MGMT_FT_FILS_SHA384;
-#endif /* CONFIG_IEEE80211R */
-#endif /* CONFIG_FILS */
else {
wpa_printf(MSG_ERROR, "Line %d: invalid key_mgmt '%s'",
line, start);
@@ -2572,8 +2559,6 @@
bss->pmk_r1_push = atoi(pos);
} else if (os_strcmp(buf, "ft_over_ds") == 0) {
bss->ft_over_ds = atoi(pos);
- } else if (os_strcmp(buf, "ft_psk_generate_local") == 0) {
- bss->ft_psk_generate_local = atoi(pos);
#endif /* CONFIG_IEEE80211R */
#ifndef CONFIG_NO_CTRL_IFACE
} else if (os_strcmp(buf, "ctrl_interface") == 0) {
@@ -3493,39 +3478,19 @@
} else if (os_strcmp(buf, "lci") == 0) {
wpabuf_free(conf->lci);
conf->lci = wpabuf_parse_bin(pos);
- if (conf->lci && wpabuf_len(conf->lci) == 0) {
- wpabuf_free(conf->lci);
- conf->lci = NULL;
- }
} else if (os_strcmp(buf, "civic") == 0) {
wpabuf_free(conf->civic);
conf->civic = wpabuf_parse_bin(pos);
- if (conf->civic && wpabuf_len(conf->civic) == 0) {
- wpabuf_free(conf->civic);
- conf->civic = NULL;
- }
} else if (os_strcmp(buf, "rrm_neighbor_report") == 0) {
if (atoi(pos))
bss->radio_measurements[0] |=
WLAN_RRM_CAPS_NEIGHBOR_REPORT;
} else if (os_strcmp(buf, "gas_address3") == 0) {
bss->gas_address3 = atoi(pos);
- } else if (os_strcmp(buf, "stationary_ap") == 0) {
- conf->stationary_ap = atoi(pos);
} else if (os_strcmp(buf, "ftm_responder") == 0) {
bss->ftm_responder = atoi(pos);
} else if (os_strcmp(buf, "ftm_initiator") == 0) {
bss->ftm_initiator = atoi(pos);
-#ifdef CONFIG_FILS
- } else if (os_strcmp(buf, "fils_cache_id") == 0) {
- if (hexstr2bin(pos, bss->fils_cache_id, FILS_CACHE_ID_LEN)) {
- wpa_printf(MSG_ERROR,
- "Line %d: Invalid fils_cache_id '%s'",
- line, pos);
- return 1;
- }
- bss->fils_cache_id_set = 1;
-#endif /* CONFIG_FILS */
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 0d86b4a..d7db4a7 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1117,20 +1117,6 @@
pos += ret;
}
#endif /* CONFIG_SAE */
-#ifdef CONFIG_FILS
- if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA256) {
- ret = os_snprintf(pos, end - pos, "FT-FILS-SHA256 ");
- if (os_snprintf_error(end - pos, ret))
- return pos - buf;
- pos += ret;
- }
- if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FT_FILS_SHA384) {
- ret = os_snprintf(pos, end - pos, "FT-FILS-SHA384 ");
- if (os_snprintf_error(end - pos, ret))
- return pos - buf;
- pos += ret;
- }
-#endif /* CONFIG_FILS */
#endif /* CONFIG_IEEE80211R */
#ifdef CONFIG_IEEE80211W
if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK_SHA256) {
@@ -1168,20 +1154,6 @@
return pos - buf;
pos += ret;
}
-#ifdef CONFIG_FILS
- if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA256) {
- ret = os_snprintf(pos, end - pos, "FILS-SHA256 ");
- if (os_snprintf_error(end - pos, ret))
- return pos - buf;
- pos += ret;
- }
- if (hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_FILS_SHA384) {
- ret = os_snprintf(pos, end - pos, "FILS-SHA384 ");
- if (os_snprintf_error(end - pos, ret))
- return pos - buf;
- pos += ret;
- }
-#endif /* CONFIG_FILS */
if (pos > buf && *(pos - 1) == ' ') {
*(pos - 1) = '\0';
@@ -2083,9 +2055,8 @@
int ret;
os_reltime_sub(&now, &info->last_seen, &age);
- ret = os_snprintf(pos, end - pos, MACSTR " %u %d\n",
- MAC2STR(info->addr), (unsigned int) age.sec,
- info->ssi_signal);
+ ret = os_snprintf(pos, end - pos, MACSTR " %u\n",
+ MAC2STR(info->addr), (unsigned int) age.sec);
if (os_snprintf_error(end - pos, ret))
break;
pos += ret;
@@ -2174,7 +2145,6 @@
struct wpa_ssid_value ssid;
u8 bssid[ETH_ALEN];
struct wpabuf *nr, *lci = NULL, *civic = NULL;
- int stationary = 0;
char *tmp;
int ret;
@@ -2253,15 +2223,8 @@
}
}
- if (!buf)
- goto set;
-
- if (os_strstr(buf, "stat"))
- stationary = 1;
-
set:
- ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic,
- stationary);
+ ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic);
wpabuf_free(nr);
wpabuf_free(lci);
@@ -3515,6 +3478,8 @@
}
}
+ dl_list_init(&interface->global_ctrl_dst);
+ interface->global_ctrl_sock = -1;
os_get_random(gcookie, COOKIE_LEN);
#ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
diff --git a/hostapd/defconfig b/hostapd/defconfig
index e25ec32..4659dd1 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -343,12 +343,3 @@
# a client, from which a signature can be produced which can identify the model
# of client device like "Nexus 6P" or "iPhone 5s".
#CONFIG_TAXONOMY=y
-
-# Fast Initial Link Setup (FILS) (IEEE 802.11ai)
-# Note: This is an experimental and not yet complete implementation. This
-# should not be enabled for production use.
-#CONFIG_FILS=y
-
-# Include internal line edit mode in hostapd_cli. This can be used to provide
-# limited command line editing and history support.
-#CONFIG_WPA_CLI_EDIT=y
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 54c8b95..fa9a855 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1163,10 +1163,6 @@
# Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The
# entries are separated with a space. WPA-PSK-SHA256 and WPA-EAP-SHA256 can be
# added to enable SHA256-based stronger algorithms.
-# FILS-SHA256 = Fast Initial Link Setup with SHA256
-# FILS-SHA384 = Fast Initial Link Setup with SHA384
-# FT-FILS-SHA256 = FT and Fast Initial Link Setup with SHA256
-# FT-FILS-SHA384 = FT and Fast Initial Link Setup with SHA384
# (dot11RSNAConfigAuthenticationSuitesTable)
#wpa_key_mgmt=WPA-PSK WPA-EAP
@@ -1277,9 +1273,6 @@
# http://www.iana.org/assignments/ipsec-registry/ipsec-registry.xml#ipsec-registry-9
#sae_groups=19 20 21 25 26
-# FILS Cache Identifier (16-bit value in hexdump format)
-#fils_cache_id=0011
-
##### IEEE 802.11r configuration ##############################################
# Mobility Domain identifier (dot11FTMobilityDomainID, MDID)
@@ -1333,14 +1326,6 @@
# 1 = FT-over-DS enabled (default)
#ft_over_ds=1
-# Whether to generate FT response locally for PSK networks
-# This avoids use of PMK-R1 push/pull from other APs with FT-PSK networks as
-# the required information (PSK and other session data) is already locally
-# available.
-# 0 = disabled (default)
-# 1 = enabled
-#ft_psk_generate_local=0
-
##### Neighbor table ##########################################################
# Maximum number of entries kept in AP table (either for neigbor table or for
# detecting Overlapping Legacy BSS Condition). The oldest entry will be
@@ -1940,12 +1925,6 @@
# This parameter only controls publishing via Extended Capabilities element.
# Actual functionality is managed outside hostapd.
#ftm_initiator=0
-#
-# Stationary AP config indicates that the AP doesn't move hence location data
-# can be considered as always up to date. If configured, LCI data will be sent
-# as a radio measurement even if the request doesn't contain a max age element
-# that allows sending of such data. Default: 0.
-#stationary_ap=0
##### TESTING OPTIONS #########################################################
#
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 8b8d7f9..5e62542 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -45,8 +45,6 @@
static void print_help(FILE *stream, const char *cmd);
static char ** list_cmd_list(void);
static void hostapd_cli_receive(int sock, void *eloop_ctx, void *sock_ctx);
-static void update_stations(struct wpa_ctrl *ctrl);
-static void cli_event(const char *str);
static void usage(void)
@@ -149,45 +147,13 @@
}
-static int hostapd_cli_reconnect(const char *ifname)
-{
- char *next_ctrl_ifname;
-
- hostapd_cli_close_connection();
-
- if (!ifname)
- return -1;
-
- next_ctrl_ifname = os_strdup(ifname);
- os_free(ctrl_ifname);
- ctrl_ifname = next_ctrl_ifname;
- if (!ctrl_ifname)
- return -1;
-
- ctrl_conn = hostapd_cli_open_connection(ctrl_ifname);
- if (!ctrl_conn)
- return -1;
- if (!interactive && !action_file)
- return 0;
- if (wpa_ctrl_attach(ctrl_conn) == 0) {
- hostapd_cli_attached = 1;
- register_event_handler(ctrl_conn);
- update_stations(ctrl_conn);
- } else {
- printf("Warning: Failed to attach to hostapd.\n");
- }
- return 0;
-}
-
-
static void hostapd_cli_msg_cb(char *msg, size_t len)
{
- cli_event(msg);
printf("%s\n", msg);
}
-static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd, int print)
+static int _wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd, int print)
{
char buf[4096];
size_t len;
@@ -215,7 +181,7 @@
}
-static inline int wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd)
+static inline int wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd)
{
return _wpa_ctrl_command(ctrl, cmd, 1);
}
@@ -320,21 +286,6 @@
}
-static char ** hostapd_complete_sta(const char *str, int pos)
-{
- int arg = get_cmd_arg_num(str, pos);
- char **res = NULL;
-
- switch (arg) {
- case 1:
- res = cli_txt_list_array(&stations);
- break;
- }
-
- return res;
-}
-
-
static int hostapd_cli_cmd_new_sta(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -750,8 +701,8 @@
}
-static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, const char *cmd,
- char *addr, size_t addr_len, int print)
+static int wpa_ctrl_command_sta(struct wpa_ctrl *ctrl, char *cmd,
+ char *addr, size_t addr_len)
{
char buf[4096], *pos;
size_t len;
@@ -775,8 +726,7 @@
buf[len] = '\0';
if (memcmp(buf, "FAIL", 4) == 0)
return -1;
- if (print)
- printf("%s", buf);
+ printf("%s", buf);
pos = buf;
while (*pos != '\0' && *pos != '\n')
@@ -792,33 +742,16 @@
{
char addr[32], cmd[64];
- if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 1))
+ if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr)))
return 0;
do {
snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
- } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 1) == 0);
+ } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr)) == 0);
return -1;
}
-static int hostapd_cli_cmd_list_sta(struct wpa_ctrl *ctrl, int argc,
- char *argv[])
-{
- char addr[32], cmd[64];
-
- if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 0))
- return 0;
- do {
- if (os_strcmp(addr, "") != 0)
- printf("%s\n", addr);
- os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
- } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0);
-
- return 0;
-}
-
-
static int hostapd_cli_cmd_help(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
print_help(stdout, argc > 0 ? argv[0] : NULL);
@@ -955,25 +888,6 @@
}
-static void update_stations(struct wpa_ctrl *ctrl)
-{
- char addr[32], cmd[64];
-
- if (!ctrl || !interactive)
- return;
-
- cli_txt_list_flush(&stations);
-
- if (wpa_ctrl_command_sta(ctrl, "STA-FIRST", addr, sizeof(addr), 0))
- return;
- do {
- if (os_strcmp(addr, "") != 0)
- cli_txt_list_add(&stations, addr);
- os_snprintf(cmd, sizeof(cmd), "STA-NEXT %s", addr);
- } while (wpa_ctrl_command_sta(ctrl, cmd, addr, sizeof(addr), 0) == 0);
-}
-
-
static void hostapd_cli_get_interfaces(struct wpa_ctrl *ctrl,
struct dl_list *interfaces)
{
@@ -1026,7 +940,23 @@
hostapd_cli_list_interfaces(ctrl);
return 0;
}
- if (hostapd_cli_reconnect(argv[0]) != 0) {
+
+ hostapd_cli_close_connection();
+ os_free(ctrl_ifname);
+ ctrl_ifname = os_strdup(argv[0]);
+ if (ctrl_ifname == NULL)
+ return -1;
+
+ if (hostapd_cli_open_connection(ctrl_ifname)) {
+ printf("Connected to interface '%s.\n", ctrl_ifname);
+ if (wpa_ctrl_attach(ctrl_conn) == 0) {
+ hostapd_cli_attached = 1;
+ register_event_handler(ctrl_conn);
+ } else {
+ printf("Warning: Failed to attach to "
+ "hostapd.\n");
+ }
+ } else {
printf("Could not connect to interface '%s' - re-trying\n",
ctrl_ifname);
}
@@ -1255,14 +1185,14 @@
char cmd[2048];
int res;
- if (argc < 3 || argc > 6) {
- printf("Invalid set_neighbor command: needs 3-6 arguments\n");
+ if (argc < 3 || argc > 5) {
+ printf("Invalid set_neighbor command: needs 3-5 arguments\n");
return -1;
}
- res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s %s",
+ res = os_snprintf(cmd, sizeof(cmd), "SET_NEIGHBOR %s %s %s %s %s",
argv[0], argv[1], argv[2], argc >= 4 ? argv[3] : "",
- argc >= 5 ? argv[4] : "", argc == 6 ? argv[5] : "");
+ argc == 5 ? argv[4] : "");
if (os_snprintf_error(sizeof(cmd), res)) {
printf("Too long SET_NEIGHBOR command.\n");
return -1;
@@ -1345,12 +1275,10 @@
"= get MIB variables (dot1x, dot11, radius)" },
{ "relog", hostapd_cli_cmd_relog, NULL, NULL },
{ "status", hostapd_cli_cmd_status, NULL, NULL },
- { "sta", hostapd_cli_cmd_sta, hostapd_complete_sta,
+ { "sta", hostapd_cli_cmd_sta, NULL,
"<addr> = get MIB variables for one station" },
{ "all_sta", hostapd_cli_cmd_all_sta, NULL,
"= get MIB variables for all stations" },
- { "list_sta", hostapd_cli_cmd_list_sta, NULL,
- "= list all stations" },
{ "new_sta", hostapd_cli_cmd_new_sta, NULL,
"<addr> = add a new station" },
{ "deauthenticate", hostapd_cli_cmd_deauthenticate,
@@ -1576,8 +1504,19 @@
printf("Connection to hostapd lost - trying to reconnect\n");
hostapd_cli_close_connection();
}
- if (!ctrl_conn && hostapd_cli_reconnect(ctrl_ifname) == 0)
- printf("Connection to hostapd re-established\n");
+ if (!ctrl_conn) {
+ ctrl_conn = hostapd_cli_open_connection(ctrl_ifname);
+ if (ctrl_conn) {
+ printf("Connection to hostapd re-established\n");
+ if (wpa_ctrl_attach(ctrl_conn) == 0) {
+ hostapd_cli_attached = 1;
+ register_event_handler(ctrl_conn);
+ } else {
+ printf("Warning: Failed to attach to "
+ "hostapd.\n");
+ }
+ }
+ }
if (ctrl_conn)
hostapd_cli_recv_pending(ctrl_conn, 1, 0);
eloop_register_timeout(ping_interval, 0, hostapd_cli_ping, NULL, NULL);
@@ -1672,34 +1611,17 @@
static void hostapd_cli_interactive(void)
{
- char *hfile = NULL;
- char *home;
-
printf("\nInteractive mode\n\n");
-#ifdef CONFIG_HOSTAPD_CLI_HISTORY_DIR
- home = CONFIG_HOSTAPD_CLI_HISTORY_DIR;
-#else /* CONFIG_HOSTAPD_CLI_HISTORY_DIR */
- home = getenv("HOME");
-#endif /* CONFIG_HOSTAPD_CLI_HISTORY_DIR */
- if (home) {
- const char *fname = ".hostapd_cli_history";
- int hfile_len = os_strlen(home) + 1 + os_strlen(fname) + 1;
- hfile = os_malloc(hfile_len);
- if (hfile)
- os_snprintf(hfile, hfile_len, "%s/%s", home, fname);
- }
-
eloop_register_signal_terminate(hostapd_cli_eloop_terminate, NULL);
edit_init(hostapd_cli_edit_cmd_cb, hostapd_cli_edit_eof_cb,
- hostapd_cli_edit_completion_cb, NULL, hfile, NULL);
+ hostapd_cli_edit_completion_cb, NULL, NULL, NULL);
eloop_register_timeout(ping_interval, 0, hostapd_cli_ping, NULL, NULL);
eloop_run();
cli_txt_list_flush(&stations);
- edit_deinit(hfile, NULL);
- os_free(hfile);
+ edit_deinit(NULL, NULL);
eloop_cancel_timeout(hostapd_cli_ping, NULL, NULL);
}
@@ -1826,7 +1748,7 @@
closedir(dir);
}
}
- hostapd_cli_reconnect(ctrl_ifname);
+ ctrl_conn = hostapd_cli_open_connection(ctrl_ifname);
if (ctrl_conn) {
if (warning_displayed)
printf("Connection established.\n");
@@ -1847,8 +1769,17 @@
continue;
}
- if (action_file && !hostapd_cli_attached)
- return -1;
+ if (interactive || action_file) {
+ if (wpa_ctrl_attach(ctrl_conn) == 0) {
+ hostapd_cli_attached = 1;
+ register_event_handler(ctrl_conn);
+ } else {
+ printf("Warning: Failed to attach to hostapd.\n");
+ if (action_file)
+ return -1;
+ }
+ }
+
if (daemonize && os_daemonize(pid_file) && eloop_sock_requeue())
return -1;