Last active
August 13, 2021 20:43
-
-
Save alopatindev/95376067bf80d0ea2de37ef6e69155cc to your computer and use it in GitHub Desktop.
Old patch for hostapd that might makes r8188eu (TP-Link TL-WN725N) work in AP mode. It's a diff between https://github.com/jenssegers/RTL8188-hostapd/tree/44d73276cb59bf58c700b70f2237ffb440b94ec3/hostapd and https://github.com/latelee/hostapd/tree/1bbff09ec5e1d2b67f9748eb24e5a3cc6d547ac0/hostapd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur /var/tmp/hostapd/hostapd/Android.mk ./Android.mk | |
--- /var/tmp/hostapd/hostapd/Android.mk 2021-08-13 23:32:56.873413502 +0300 | |
+++ ./Android.mk 2021-08-13 23:22:08.955399008 +0300 | |
@@ -4,7 +4,8 @@ | |
ifneq ($(TARGET_SIMULATOR),true) | |
ifneq ($(BOARD_HOSTAPD_DRIVER),) | |
WPA_BUILD_HOSTAPD := true | |
- CONFIG_DRIVER_$(BOARD_HOSTAPD_DRIVER) := y | |
+ #CONFIG_DRIVER_$(BOARD_HOSTAPD_DRIVER) := y | |
+ CONFIG_DRIVER_RTW := y | |
endif | |
endif | |
@@ -13,9 +14,6 @@ | |
# To ignore possible wrong network configurations | |
L_CFLAGS = -DWPA_IGNORE_CONFIG_ERRORS | |
-# Set Android log name | |
-L_CFLAGS += -DANDROID_LOG_NAME=\"hostapd\" | |
- | |
# To force sizeof(enum) = 4 | |
ifeq ($(TARGET_ARCH),arm) | |
L_CFLAGS += -mabi=aapcs-linux | |
@@ -809,7 +807,7 @@ | |
endif | |
LOCAL_SHARED_LIBRARIES := libc libcutils libcrypto libssl | |
ifdef CONFIG_DRIVER_NL80211 | |
-LOCAL_SHARED_LIBRARIES += libnl_2 | |
+LOCAL_STATIC_LIBRARIES += libnl_2 | |
endif | |
LOCAL_CFLAGS := $(L_CFLAGS) | |
LOCAL_SRC_FILES := $(OBJS) | |
Only in .: bsd_hostapd.conf | |
diff -ur /var/tmp/hostapd/hostapd/ChangeLog ./ChangeLog | |
--- /var/tmp/hostapd/hostapd/ChangeLog 2021-08-13 23:32:56.874413502 +0300 | |
+++ ./ChangeLog 2021-08-13 23:22:08.955399008 +0300 | |
@@ -82,7 +82,7 @@ | |
* updated management frame protection to use IEEE Std 802.11w-2009 | |
* fixed number of small WPS issues and added workarounds to | |
interoperate with common deployed broken implementations | |
- * added some IEEE 802.11n co-existence rules to disable 40 MHz channels | |
+ * added some IEEE 802.11n co-existance rules to disable 40 MHz channels | |
or modify primary/secondary channels if needed based on neighboring | |
networks | |
* added support for NFC out-of-band mechanism with WPS | |
Only in .: .config | |
Only in .: .config_bsd | |
diff -ur /var/tmp/hostapd/hostapd/config_file.c ./config_file.c | |
--- /var/tmp/hostapd/hostapd/config_file.c 2021-08-13 23:32:56.877413502 +0300 | |
+++ ./config_file.c 2021-08-13 23:22:08.956399008 +0300 | |
@@ -1142,40 +1142,6 @@ | |
} | |
-#ifdef CONFIG_INTERWORKING | |
-static int parse_roaming_consortium(struct hostapd_bss_config *bss, char *pos, | |
- int line) | |
-{ | |
- size_t len = os_strlen(pos); | |
- u8 oi[MAX_ROAMING_CONSORTIUM_LEN]; | |
- | |
- struct hostapd_roaming_consortium *rc; | |
- | |
- if ((len & 1) || len < 2 * 3 || len / 2 > MAX_ROAMING_CONSORTIUM_LEN || | |
- hexstr2bin(pos, oi, len / 2)) { | |
- wpa_printf(MSG_ERROR, "Line %d: invalid roaming_consortium " | |
- "'%s'", line, pos); | |
- return -1; | |
- } | |
- len /= 2; | |
- | |
- rc = os_realloc(bss->roaming_consortium, | |
- sizeof(struct hostapd_roaming_consortium) * | |
- (bss->roaming_consortium_count + 1)); | |
- if (rc == NULL) | |
- return -1; | |
- | |
- os_memcpy(rc[bss->roaming_consortium_count].oi, oi, len); | |
- rc[bss->roaming_consortium_count].len = len; | |
- | |
- bss->roaming_consortium = rc; | |
- bss->roaming_consortium_count++; | |
- | |
- return 0; | |
-} | |
-#endif /* CONFIG_INTERWORKING */ | |
- | |
- | |
/** | |
* hostapd_config_read - Read and parse a configuration file | |
* @fname: Configuration file name (including path, if needed) | |
@@ -1938,8 +1904,6 @@ | |
#endif /* CONFIG_IEEE80211N */ | |
} else if (os_strcmp(buf, "max_listen_interval") == 0) { | |
bss->max_listen_interval = atoi(pos); | |
- } else if (os_strcmp(buf, "disable_pmksa_caching") == 0) { | |
- bss->disable_pmksa_caching = atoi(pos); | |
} else if (os_strcmp(buf, "okc") == 0) { | |
bss->okc = atoi(pos); | |
#ifdef CONFIG_WPS | |
@@ -2057,8 +2021,6 @@ | |
} else if (os_strcmp(buf, "upc") == 0) { | |
os_free(bss->upc); | |
bss->upc = os_strdup(pos); | |
- } else if (os_strcmp(buf, "pbc_in_m1") == 0) { | |
- bss->pbc_in_m1 = atoi(pos); | |
#endif /* CONFIG_WPS */ | |
#ifdef CONFIG_P2P_MANAGER | |
} else if (os_strcmp(buf, "manage_p2p") == 0) { | |
@@ -2092,55 +2054,6 @@ | |
extern int rsn_testing; | |
rsn_testing = atoi(pos); | |
#endif /* CONFIG_RSN_TESTING */ | |
- } else if (os_strcmp(buf, "time_advertisement") == 0) { | |
- bss->time_advertisement = atoi(pos); | |
- } else if (os_strcmp(buf, "time_zone") == 0) { | |
- size_t tz_len = os_strlen(pos); | |
- if (tz_len < 4 || tz_len > 255) { | |
- wpa_printf(MSG_DEBUG, "Line %d: invalid " | |
- "time_zone", line); | |
- errors++; | |
- continue; | |
- } | |
- os_free(bss->time_zone); | |
- bss->time_zone = os_strdup(pos); | |
- if (bss->time_zone == NULL) | |
- errors++; | |
-#ifdef CONFIG_INTERWORKING | |
- } else if (os_strcmp(buf, "interworking") == 0) { | |
- bss->interworking = atoi(pos); | |
- } else if (os_strcmp(buf, "access_network_type") == 0) { | |
- bss->access_network_type = atoi(pos); | |
- if (bss->access_network_type < 0 || | |
- bss->access_network_type > 15) { | |
- wpa_printf(MSG_ERROR, "Line %d: invalid " | |
- "access_network_type", line); | |
- errors++; | |
- } | |
- } else if (os_strcmp(buf, "internet") == 0) { | |
- bss->internet = atoi(pos); | |
- } else if (os_strcmp(buf, "asra") == 0) { | |
- bss->asra = atoi(pos); | |
- } else if (os_strcmp(buf, "esr") == 0) { | |
- bss->esr = atoi(pos); | |
- } else if (os_strcmp(buf, "uesa") == 0) { | |
- bss->uesa = atoi(pos); | |
- } else if (os_strcmp(buf, "venue_group") == 0) { | |
- bss->venue_group = atoi(pos); | |
- bss->venue_info_set = 1; | |
- } else if (os_strcmp(buf, "venue_type") == 0) { | |
- bss->venue_type = atoi(pos); | |
- bss->venue_info_set = 1; | |
- } else if (os_strcmp(buf, "hessid") == 0) { | |
- if (hwaddr_aton(pos, bss->hessid)) { | |
- wpa_printf(MSG_ERROR, "Line %d: invalid " | |
- "hessid", line); | |
- errors++; | |
- } | |
- } else if (os_strcmp(buf, "roaming_consortium") == 0) { | |
- if (parse_roaming_consortium(bss, pos, line) < 0) | |
- errors++; | |
-#endif /* CONFIG_INTERWORKING */ | |
} else { | |
wpa_printf(MSG_ERROR, "Line %d: unknown configuration " | |
"item '%s'", line, buf); | |
@@ -2182,29 +2095,12 @@ | |
} else if (bss->wpa) { | |
bss->ssid.security_policy = SECURITY_WPA_PSK; | |
} else if (bss->ieee802_1x) { | |
- int cipher = WPA_CIPHER_NONE; | |
bss->ssid.security_policy = SECURITY_IEEE_802_1X; | |
bss->ssid.wep.default_len = bss->default_wep_key_len; | |
- if (bss->default_wep_key_len) | |
- cipher = bss->default_wep_key_len >= 13 ? | |
- WPA_CIPHER_WEP104 : WPA_CIPHER_WEP40; | |
- bss->wpa_group = cipher; | |
- bss->wpa_pairwise = cipher; | |
- bss->rsn_pairwise = cipher; | |
- } else if (bss->ssid.wep.keys_set) { | |
- int cipher = WPA_CIPHER_WEP40; | |
- if (bss->ssid.wep.len[0] >= 13) | |
- cipher = WPA_CIPHER_WEP104; | |
+ } else if (bss->ssid.wep.keys_set) | |
bss->ssid.security_policy = SECURITY_STATIC_WEP; | |
- bss->wpa_group = cipher; | |
- bss->wpa_pairwise = cipher; | |
- bss->rsn_pairwise = cipher; | |
- } else { | |
+ else | |
bss->ssid.security_policy = SECURITY_PLAINTEXT; | |
- bss->wpa_group = WPA_CIPHER_NONE; | |
- bss->wpa_pairwise = WPA_CIPHER_NONE; | |
- bss->rsn_pairwise = WPA_CIPHER_NONE; | |
- } | |
} | |
if (hostapd_config_check(conf)) | |
diff -ur /var/tmp/hostapd/hostapd/ctrl_iface.c ./ctrl_iface.c | |
--- /var/tmp/hostapd/hostapd/ctrl_iface.c 2021-08-13 23:32:56.878413502 +0300 | |
+++ ./ctrl_iface.c 2021-08-13 23:22:08.956399008 +0300 | |
@@ -526,57 +526,6 @@ | |
#endif /* CONFIG_WPS */ | |
-static int hostapd_ctrl_iface_ess_disassoc(struct hostapd_data *hapd, | |
- const char *cmd) | |
-{ | |
- u8 addr[ETH_ALEN]; | |
- const char *url; | |
- u8 buf[1000], *pos; | |
- struct ieee80211_mgmt *mgmt; | |
- size_t url_len; | |
- | |
- if (hwaddr_aton(cmd, addr)) | |
- return -1; | |
- url = cmd + 17; | |
- if (*url != ' ') | |
- return -1; | |
- url++; | |
- url_len = os_strlen(url); | |
- if (url_len > 255) | |
- return -1; | |
- | |
- os_memset(buf, 0, sizeof(buf)); | |
- mgmt = (struct ieee80211_mgmt *) buf; | |
- mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, | |
- WLAN_FC_STYPE_ACTION); | |
- os_memcpy(mgmt->da, addr, ETH_ALEN); | |
- os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN); | |
- os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN); | |
- mgmt->u.action.category = WLAN_ACTION_WNM; | |
- mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ; | |
- mgmt->u.action.u.bss_tm_req.dialog_token = 1; | |
- mgmt->u.action.u.bss_tm_req.req_mode = | |
- WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT; | |
- mgmt->u.action.u.bss_tm_req.disassoc_timer = host_to_le16(0); | |
- mgmt->u.action.u.bss_tm_req.validity_interval = 0; | |
- | |
- pos = mgmt->u.action.u.bss_tm_req.variable; | |
- | |
- /* Session Information URL */ | |
- *pos++ = url_len; | |
- os_memcpy(pos, url, url_len); | |
- pos += url_len; | |
- | |
- if (hostapd_drv_send_mlme(hapd, buf, pos - buf) < 0) { | |
- wpa_printf(MSG_DEBUG, "Failed to send BSS Transition " | |
- "Management Request frame"); | |
- return -1; | |
- } | |
- | |
- return 0; | |
-} | |
- | |
- | |
static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd, | |
char *buf, size_t buflen) | |
{ | |
@@ -930,9 +879,6 @@ | |
if (hostapd_ctrl_iface_wps_config(hapd, buf + 11) < 0) | |
reply_len = -1; | |
#endif /* CONFIG_WPS */ | |
- } else if (os_strncmp(buf, "ESS_DISASSOC ", 13) == 0) { | |
- if (hostapd_ctrl_iface_ess_disassoc(hapd, buf + 13)) | |
- reply_len = -1; | |
} else if (os_strcmp(buf, "GET_CONFIG") == 0) { | |
reply_len = hostapd_ctrl_iface_get_config(hapd, reply, | |
reply_size); | |
diff -ur /var/tmp/hostapd/hostapd/defconfig ./defconfig | |
--- /var/tmp/hostapd/hostapd/defconfig 2021-08-13 23:32:56.878413502 +0300 | |
+++ ./defconfig 2021-08-13 23:22:08.956399008 +0300 | |
@@ -20,7 +20,7 @@ | |
#CFLAGS += -I../../madwifi # change to the madwifi source directory | |
# Driver interface for drivers using the nl80211 kernel interface | |
-CONFIG_DRIVER_NL80211=y | |
+#CONFIG_DRIVER_NL80211=y | |
# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver) | |
#CONFIG_DRIVER_BSD=y | |
@@ -193,51 +193,12 @@ | |
# it may help in cases where the system pool is not initialized properly. | |
# However, it is very strongly recommended that the system pool is initialized | |
# with enough entropy either by using hardware assisted random number | |
-# generator or by storing state over device reboots. | |
+# generatior or by storing state over device reboots. | |
# | |
-# hostapd can be configured to maintain its own entropy store over restarts to | |
-# enhance random number generation. This is not perfect, but it is much more | |
-# secure than using the same sequence of random numbers after every reboot. | |
-# This can be enabled with -e<entropy file> command line option. The specified | |
-# file needs to be readable and writable by hostapd. | |
-# | |
-# If the os_get_random() is known to provide strong random data (e.g., on | |
+# If the os_get_random() is known to provide strong ramdom data (e.g., on | |
# Linux/BSD, the board in question is known to have reliable source of random | |
# data from /dev/urandom), the internal hostapd random pool can be disabled. | |
# This will save some in binary size and CPU use. However, this should only be | |
# considered for builds that are known to be used on devices that meet the | |
# requirements described above. | |
#CONFIG_NO_RANDOM_POOL=y | |
- | |
-# Select TLS implementation | |
-# openssl = OpenSSL (default) | |
-# gnutls = GnuTLS | |
-# internal = Internal TLSv1 implementation (experimental) | |
-# none = Empty template | |
-#CONFIG_TLS=openssl | |
- | |
-# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1) | |
-# can be enabled to get a stronger construction of messages when block ciphers | |
-# are used. | |
-#CONFIG_TLSV11=y | |
- | |
-# If CONFIG_TLS=internal is used, additional library and include paths are | |
-# needed for LibTomMath. Alternatively, an integrated, minimal version of | |
-# LibTomMath can be used. See beginning of libtommath.c for details on benefits | |
-# and drawbacks of this option. | |
-#CONFIG_INTERNAL_LIBTOMMATH=y | |
-#ifndef CONFIG_INTERNAL_LIBTOMMATH | |
-#LTM_PATH=/usr/src/libtommath-0.39 | |
-#CFLAGS += -I$(LTM_PATH) | |
-#LIBS += -L$(LTM_PATH) | |
-#LIBS_p += -L$(LTM_PATH) | |
-#endif | |
-# At the cost of about 4 kB of additional binary size, the internal LibTomMath | |
-# can be configured to include faster routines for exptmod, sqr, and div to | |
-# speed up DH and RSA calculation considerably | |
-#CONFIG_INTERNAL_LIBTOMMATH_FAST=y | |
- | |
-# Interworking (IEEE 802.11u) | |
-# This can be used to enable functionality to improve interworking with | |
-# external networks. | |
-#CONFIG_INTERWORKING=y | |
diff -ur /var/tmp/hostapd/hostapd/dump_state.c ./dump_state.c | |
--- /var/tmp/hostapd/hostapd/dump_state.c 2021-08-13 23:32:56.878413502 +0300 | |
+++ ./dump_state.c 2021-08-13 23:22:08.956399008 +0300 | |
@@ -13,7 +13,6 @@ | |
*/ | |
#include "utils/includes.h" | |
-#include <time.h> | |
#include "utils/common.h" | |
#include "radius/radius_client.h" | |
@@ -107,8 +106,7 @@ | |
fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr)); | |
fprintf(f, | |
- " AID=%d flags=0x%x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" | |
- "\n" | |
+ " AID=%d flags=0x%x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n" | |
" capability=0x%x listen_interval=%d\n", | |
sta->aid, | |
sta->flags, | |
@@ -129,7 +127,6 @@ | |
(sta->flags & WLAN_STA_MAYBE_WPS ? "[MAYBE_WPS]" : ""), | |
(sta->flags & WLAN_STA_WDS ? "[WDS]" : ""), | |
(sta->flags & WLAN_STA_NONERP ? "[NonERP]" : ""), | |
- (sta->flags & WLAN_STA_WPS2 ? "[WPS2]" : ""), | |
sta->capability, | |
sta->listen_interval); | |
diff -ur /var/tmp/hostapd/hostapd/hostapd_cli.c ./hostapd_cli.c | |
--- /var/tmp/hostapd/hostapd/hostapd_cli.c 2021-08-13 23:32:56.880413502 +0300 | |
+++ ./hostapd_cli.c 2021-08-13 23:22:08.957399008 +0300 | |
@@ -16,9 +16,7 @@ | |
#include <dirent.h> | |
#include "common/wpa_ctrl.h" | |
-#include "utils/common.h" | |
-#include "utils/eloop.h" | |
-#include "utils/edit.h" | |
+#include "common.h" | |
#include "common/version.h" | |
@@ -115,7 +113,6 @@ | |
static const char *pid_file = NULL; | |
static const char *action_file = NULL; | |
static int ping_interval = 5; | |
-static int interactive = 0; | |
static void usage(void) | |
@@ -217,7 +214,6 @@ | |
return _wpa_ctrl_command(ctrl, cmd, 1); | |
} | |
- | |
static int hostapd_cli_cmd_ping(struct wpa_ctrl *ctrl, int argc, char *argv[]) | |
{ | |
return wpa_ctrl_command(ctrl, "PING"); | |
@@ -515,26 +511,6 @@ | |
#endif /* CONFIG_WPS */ | |
-static int hostapd_cli_cmd_ess_disassoc(struct wpa_ctrl *ctrl, int argc, | |
- char *argv[]) | |
-{ | |
- char buf[300]; | |
- int res; | |
- | |
- if (argc < 2) { | |
- printf("Invalid 'ess_disassoc' command - two arguments (STA " | |
- "addr and URL) are needed\n"); | |
- return -1; | |
- } | |
- | |
- res = os_snprintf(buf, sizeof(buf), "ESS_DISASSOC %s %s", | |
- argv[0], argv[1]); | |
- if (res < 0 || res >= (int) sizeof(buf)) | |
- return -1; | |
- return wpa_ctrl_command(ctrl, buf); | |
-} | |
- | |
- | |
static int hostapd_cli_cmd_get_config(struct wpa_ctrl *ctrl, int argc, | |
char *argv[]) | |
{ | |
@@ -611,8 +587,6 @@ | |
static int hostapd_cli_cmd_quit(struct wpa_ctrl *ctrl, int argc, char *argv[]) | |
{ | |
hostapd_cli_quit = 1; | |
- if (interactive) | |
- eloop_terminate(); | |
return 0; | |
} | |
@@ -748,7 +722,6 @@ | |
{ "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin }, | |
{ "wps_config", hostapd_cli_cmd_wps_config }, | |
#endif /* CONFIG_WPS */ | |
- { "ess_disassoc", hostapd_cli_cmd_ess_disassoc }, | |
{ "get_config", hostapd_cli_cmd_get_config }, | |
{ "help", hostapd_cli_cmd_help }, | |
{ "interface", hostapd_cli_cmd_interface }, | |
@@ -827,39 +800,70 @@ | |
} | |
-#define max_args 10 | |
- | |
-static int tokenize_cmd(char *cmd, char *argv[]) | |
+static void hostapd_cli_interactive(void) | |
{ | |
- char *pos; | |
- int argc = 0; | |
+ const int max_args = 10; | |
+ char cmd[256], *res, *argv[max_args], *pos; | |
+ int argc; | |
- pos = cmd; | |
- for (;;) { | |
- while (*pos == ' ') | |
- pos++; | |
- if (*pos == '\0') | |
- break; | |
- argv[argc] = pos; | |
- argc++; | |
- if (argc == max_args) | |
+ printf("\nInteractive mode\n\n"); | |
+ | |
+ do { | |
+ hostapd_cli_recv_pending(ctrl_conn, 0, 0); | |
+ printf("> "); | |
+ alarm(ping_interval); | |
+ res = fgets(cmd, sizeof(cmd), stdin); | |
+ alarm(0); | |
+ if (res == NULL) | |
break; | |
- if (*pos == '"') { | |
- char *pos2 = os_strrchr(pos, '"'); | |
- if (pos2) | |
- pos = pos2 + 1; | |
- } | |
- while (*pos != '\0' && *pos != ' ') | |
+ pos = cmd; | |
+ while (*pos != '\0') { | |
+ if (*pos == '\n') { | |
+ *pos = '\0'; | |
+ break; | |
+ } | |
pos++; | |
- if (*pos == ' ') | |
- *pos++ = '\0'; | |
- } | |
+ } | |
+ argc = 0; | |
+ pos = cmd; | |
+ for (;;) { | |
+ while (*pos == ' ') | |
+ pos++; | |
+ if (*pos == '\0') | |
+ break; | |
+ argv[argc] = pos; | |
+ argc++; | |
+ if (argc == max_args) | |
+ break; | |
+ while (*pos != '\0' && *pos != ' ') | |
+ pos++; | |
+ if (*pos == ' ') | |
+ *pos++ = '\0'; | |
+ } | |
+ if (argc) | |
+ wpa_request(ctrl_conn, argc, argv); | |
+ } while (!hostapd_cli_quit); | |
+} | |
+ | |
+ | |
+static void hostapd_cli_cleanup(void) | |
+{ | |
+ hostapd_cli_close_connection(); | |
+ if (pid_file) | |
+ os_daemonize_terminate(pid_file); | |
- return argc; | |
+ os_program_deinit(); | |
} | |
-static void hostapd_cli_ping(void *eloop_ctx, void *timeout_ctx) | |
+static void hostapd_cli_terminate(int sig) | |
+{ | |
+ hostapd_cli_cleanup(); | |
+ exit(0); | |
+} | |
+ | |
+ | |
+static void hostapd_cli_alarm(int sig) | |
{ | |
if (ctrl_conn && _wpa_ctrl_command(ctrl_conn, "PING", 0)) { | |
printf("Connection to hostapd lost - trying to reconnect\n"); | |
@@ -879,55 +883,7 @@ | |
} | |
if (ctrl_conn) | |
hostapd_cli_recv_pending(ctrl_conn, 1, 0); | |
- eloop_register_timeout(ping_interval, 0, hostapd_cli_ping, NULL, NULL); | |
-} | |
- | |
- | |
-static void hostapd_cli_eloop_terminate(int sig, void *signal_ctx) | |
-{ | |
- eloop_terminate(); | |
-} | |
- | |
- | |
-static void hostapd_cli_edit_cmd_cb(void *ctx, char *cmd) | |
-{ | |
- char *argv[max_args]; | |
- int argc; | |
- argc = tokenize_cmd(cmd, argv); | |
- if (argc) | |
- wpa_request(ctrl_conn, argc, argv); | |
-} | |
- | |
- | |
-static void hostapd_cli_edit_eof_cb(void *ctx) | |
-{ | |
- eloop_terminate(); | |
-} | |
- | |
- | |
-static void hostapd_cli_interactive(void) | |
-{ | |
- printf("\nInteractive mode\n\n"); | |
- | |
- eloop_register_signal_terminate(hostapd_cli_eloop_terminate, NULL); | |
- edit_init(hostapd_cli_edit_cmd_cb, hostapd_cli_edit_eof_cb, | |
- NULL, NULL, NULL); | |
- eloop_register_timeout(ping_interval, 0, hostapd_cli_ping, NULL, NULL); | |
- | |
- eloop_run(); | |
- | |
- edit_deinit(NULL, NULL); | |
- eloop_cancel_timeout(hostapd_cli_ping, NULL, NULL); | |
-} | |
- | |
- | |
-static void hostapd_cli_cleanup(void) | |
-{ | |
- hostapd_cli_close_connection(); | |
- if (pid_file) | |
- os_daemonize_terminate(pid_file); | |
- | |
- os_program_deinit(); | |
+ alarm(ping_interval); | |
} | |
@@ -970,6 +926,7 @@ | |
int main(int argc, char *argv[]) | |
{ | |
+ int interactive; | |
int warning_displayed = 0; | |
int c; | |
int daemonize = 0; | |
@@ -1017,9 +974,6 @@ | |
hostapd_cli_license); | |
} | |
- if (eloop_init()) | |
- return -1; | |
- | |
for (;;) { | |
if (ctrl_ifname == NULL) { | |
struct dirent *dent; | |
@@ -1059,6 +1013,10 @@ | |
continue; | |
} | |
+ signal(SIGINT, hostapd_cli_terminate); | |
+ signal(SIGTERM, hostapd_cli_terminate); | |
+ signal(SIGALRM, hostapd_cli_alarm); | |
+ | |
if (interactive || action_file) { | |
if (wpa_ctrl_attach(ctrl_conn) == 0) { | |
hostapd_cli_attached = 1; | |
@@ -1080,7 +1038,6 @@ | |
wpa_request(ctrl_conn, argc - optind, &argv[optind]); | |
os_free(ctrl_ifname); | |
- eloop_destroy(); | |
hostapd_cli_cleanup(); | |
return 0; | |
} | |
diff -ur /var/tmp/hostapd/hostapd/hostapd.conf ./hostapd.conf | |
--- /var/tmp/hostapd/hostapd/hostapd.conf 2021-08-13 23:32:56.880413502 +0300 | |
+++ ./hostapd.conf 2021-08-13 23:22:08.957399008 +0300 | |
@@ -99,18 +99,19 @@ | |
# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g, | |
# Default: IEEE 802.11b | |
-hw_mode=g | |
+hw_mode=a | |
# Channel number (IEEE 802.11) | |
# (default: 0, i.e., not set) | |
-# Please note that some drivers do not use this value from hostapd and the | |
-# channel will need to be configured separately with iwconfig. | |
-channel=1 | |
+# Please note that some drivers (e.g., madwifi) do not use this value from | |
+# hostapd and the channel will need to be configuration separately with | |
+# iwconfig. | |
+channel=60 | |
# Beacon interval in kus (1.024 ms) (default: 100; range 15..65535) | |
beacon_int=100 | |
-# DTIM (delivery traffic information message) period (range 1..255): | |
+# DTIM (delivery trafic information message) period (range 1..255): | |
# number of beacons between DTIMs (1 = every beacon includes DTIM element) | |
# (default: 2) | |
dtim_period=2 | |
@@ -769,13 +770,6 @@ | |
# dot11AssociationSAQueryRetryTimeout, 1...4294967295 | |
#assoc_sa_query_retry_timeout=201 | |
-# disable_pmksa_caching: Disable PMKSA caching | |
-# This parameter can be used to disable caching of PMKSA created through EAP | |
-# authentication. RSN preauthentication may still end up using PMKSA caching if | |
-# it is enabled (rsn_preauth=1). | |
-# 0 = PMKSA caching enabled (default) | |
-# 1 = PMKSA caching disabled | |
-#disable_pmksa_caching=0 | |
# okc: Opportunistic Key Caching (aka Proactive Key Caching) | |
# Allow PMK cache to be shared opportunistically among configured interfaces | |
@@ -927,18 +921,6 @@ | |
# virtual_push_button physical_push_button | |
#config_methods=label virtual_display virtual_push_button keypad | |
-# WPS capability discovery workaround for PBC with Windows 7 | |
-# Windows 7 uses incorrect way of figuring out AP's WPS capabilities by acting | |
-# as a Registrar and using M1 from the AP. The config methods attribute in that | |
-# message is supposed to indicate only the configuration method supported by | |
-# the AP in Enrollee role, i.e., to add an external Registrar. For that case, | |
-# PBC shall not be used and as such, the PushButton config method is removed | |
-# from M1 by default. If pbc_in_m1=1 is included in the configuration file, | |
-# the PushButton config method is left in M1 (if included in config_methods | |
-# parameter) to allow Windows 7 to use PBC instead of PIN (e.g., from a label | |
-# in the AP). | |
-#pbc_in_m1=1 | |
- | |
# Static access point PIN for initial configuration and adding Registrars | |
# If not set, hostapd will not allow external WPS Registrars to control the | |
# access point. The AP PIN can also be set at runtime with hostapd_cli | |
@@ -1023,75 +1005,6 @@ | |
# Prohibit use of TDLS Channel Switching in this BSS | |
#tdls_prohibit_chan_switch=1 | |
-##### IEEE 802.11v-2011 ####################################################### | |
- | |
-# Time advertisement | |
-# 0 = disabled (default) | |
-# 2 = UTC time at which the TSF timer is 0 | |
-#time_advertisement=2 | |
- | |
-# Local time zone as specified in 8.3 of IEEE Std 1003.1-2004: | |
-# stdoffset[dst[offset][,start[/time],end[/time]]] | |
-#time_zone=EST5 | |
- | |
-##### IEEE 802.11u-2011 ####################################################### | |
- | |
-# Enable Interworking service | |
-#interworking=1 | |
- | |
-# Access Network Type | |
-# 0 = Private network | |
-# 1 = Private network with guest access | |
-# 2 = Chargeable public network | |
-# 3 = Free public network | |
-# 4 = Personal device network | |
-# 5 = Emergency services only network | |
-# 14 = Test or experimental | |
-# 15 = Wildcard | |
-#access_network_type=0 | |
- | |
-# Whether the network provides connectivity to the Internet | |
-# 0 = Unspecified | |
-# 1 = Network provides connectivity to the Internet | |
-#internet=1 | |
- | |
-# Additional Step Required for Access | |
-# Note: This is only used with open network, i.e., ASRA shall ne set to 0 if | |
-# RSN is used. | |
-#asra=0 | |
- | |
-# Emergency services reachable | |
-#esr=0 | |
- | |
-# Unauthenticated emergency service accessible | |
-#uesa=0 | |
- | |
-# Venue Info (optional) | |
-# The available values are defined in IEEE Std 802.11u-2011, 7.3.1.34. | |
-# Example values (group,type): | |
-# 0,0 = Unspecified | |
-# 1,7 = Convention Center | |
-# 1,13 = Coffee Shop | |
-# 2,0 = Unspecified Business | |
-# 7,1 Private Residence | |
-#venue_group=7 | |
-#venue_type=1 | |
- | |
-# Homogeneous ESS identifier (optional; dot11HESSID) | |
-# If set, this shall be identifical to one of the BSSIDs in the homogeneous | |
-# ESS and this shall be set to the same value across all BSSs in homogeneous | |
-# ESS. | |
-#hessid=02:03:04:05:06:07 | |
- | |
-# Roaming Consortium List | |
-# Arbitrary number of Roaming Consortium OIs can be configured with each line | |
-# adding a new OI to the list. The first three entries are available through | |
-# Beacon and Probe Response frames. Any additional entry will be available only | |
-# through ANQP queries. Each OI is between 3 and 15 octets and is configured a | |
-# a hexstring. | |
-#roaming_consortium=021122 | |
-#roaming_consortium=2233445566 | |
- | |
##### Multiple BSSID support ################################################## | |
# | |
# Above configuration is using the default interface (wlan#, or multi-SSID VLAN | |
diff -ur /var/tmp/hostapd/hostapd/main.c ./main.c | |
--- /var/tmp/hostapd/hostapd/main.c 2021-08-13 23:32:56.881413503 +0300 | |
+++ ./main.c 2021-08-13 23:22:08.957399008 +0300 | |
@@ -37,16 +37,6 @@ | |
extern int wpa_debug_show_keys; | |
extern int wpa_debug_timestamp; | |
-extern struct wpa_driver_ops *wpa_drivers[]; | |
- | |
- | |
-struct hapd_global { | |
- void **drv_priv; | |
- size_t drv_count; | |
-}; | |
- | |
-static struct hapd_global global; | |
- | |
struct hapd_interfaces { | |
size_t count; | |
@@ -256,24 +246,6 @@ | |
b = NULL; | |
os_memset(¶ms, 0, sizeof(params)); | |
- for (i = 0; wpa_drivers[i]; i++) { | |
- if (wpa_drivers[i] != hapd->driver) | |
- continue; | |
- | |
- if (global.drv_priv[i] == NULL && | |
- wpa_drivers[i]->global_init) { | |
- global.drv_priv[i] = wpa_drivers[i]->global_init(); | |
- if (global.drv_priv[i] == NULL) { | |
- wpa_printf(MSG_ERROR, "Failed to initialize " | |
- "driver '%s'", | |
- wpa_drivers[i]->name); | |
- return -1; | |
- } | |
- } | |
- | |
- params.global_priv = global.drv_priv[i]; | |
- break; | |
- } | |
params.bssid = b; | |
params.ifname = hapd->conf->iface; | |
params.ssid = (const u8 *) hapd->conf->ssid.ssid; | |
@@ -397,13 +369,8 @@ | |
#endif /* CONFIG_NATIVE_WINDOWS */ | |
-static int hostapd_global_init(struct hapd_interfaces *interfaces, | |
- const char *entropy_file) | |
+static int hostapd_global_init(struct hapd_interfaces *interfaces) | |
{ | |
- int i; | |
- | |
- os_memset(&global, 0, sizeof(global)); | |
- | |
hostapd_logger_register_cb(hostapd_logger_cb); | |
if (eap_server_register_methods()) { | |
@@ -416,7 +383,7 @@ | |
return -1; | |
} | |
- random_init(entropy_file); | |
+ random_init(); | |
#ifndef CONFIG_NATIVE_WINDOWS | |
eloop_register_signal(SIGHUP, handle_reload, interfaces); | |
@@ -428,32 +395,12 @@ | |
openlog("hostapd", 0, LOG_DAEMON); | |
#endif /* CONFIG_NATIVE_WINDOWS */ | |
- for (i = 0; wpa_drivers[i]; i++) | |
- global.drv_count++; | |
- if (global.drv_count == 0) { | |
- wpa_printf(MSG_ERROR, "No drivers enabled"); | |
- return -1; | |
- } | |
- global.drv_priv = os_zalloc(global.drv_count * sizeof(void *)); | |
- if (global.drv_priv == NULL) | |
- return -1; | |
- | |
return 0; | |
} | |
static void hostapd_global_deinit(const char *pid_file) | |
{ | |
- int i; | |
- | |
- for (i = 0; wpa_drivers[i] && global.drv_priv; i++) { | |
- if (!global.drv_priv[i]) | |
- continue; | |
- wpa_drivers[i]->global_deinit(global.drv_priv[i]); | |
- } | |
- os_free(global.drv_priv); | |
- global.drv_priv = NULL; | |
- | |
#ifdef EAP_SERVER_TNC | |
tncs_global_deinit(); | |
#endif /* EAP_SERVER_TNC */ | |
@@ -521,14 +468,13 @@ | |
show_version(); | |
fprintf(stderr, | |
"\n" | |
- "usage: hostapd [-hdBKtv] [-P <PID file>] [-e <entropy file>] " | |
+ "usage: hostapd [-hdBKtv] [-P <PID file>] " | |
"<configuration file(s)>\n" | |
"\n" | |
"options:\n" | |
" -h show this usage\n" | |
" -d show more debug messages (-dd for even more)\n" | |
" -B run daemon in the background\n" | |
- " -e entropy file\n" | |
" -P PID file\n" | |
" -K include key data in debug messages\n" | |
#ifdef CONFIG_DEBUG_FILE | |
@@ -558,13 +504,12 @@ | |
int c, debug = 0, daemonize = 0; | |
char *pid_file = NULL; | |
const char *log_file = NULL; | |
- const char *entropy_file = NULL; | |
if (os_program_init()) | |
return -1; | |
for (;;) { | |
- c = getopt(argc, argv, "Bde:f:hKP:tv"); | |
+ c = getopt(argc, argv, "Bdf:hKP:tv"); | |
if (c < 0) | |
break; | |
switch (c) { | |
@@ -579,9 +524,6 @@ | |
case 'B': | |
daemonize++; | |
break; | |
- case 'e': | |
- entropy_file = optarg; | |
- break; | |
case 'f': | |
log_file = optarg; | |
break; | |
@@ -622,7 +564,7 @@ | |
return -1; | |
} | |
- if (hostapd_global_init(&interfaces, entropy_file)) | |
+ if (hostapd_global_init(&interfaces)) | |
return -1; | |
/* Initialize interfaces */ | |
diff -ur /var/tmp/hostapd/hostapd/Makefile ./Makefile | |
--- /var/tmp/hostapd/hostapd/Makefile 2021-08-13 23:32:56.874413502 +0300 | |
+++ ./Makefile 2021-08-13 23:22:08.955399008 +0300 | |
@@ -51,10 +51,6 @@ | |
OBJS += ../src/ap/wpa_auth_ie.o | |
OBJS += ../src/ap/preauth_auth.o | |
OBJS += ../src/ap/pmksa_cache_auth.o | |
-OBJS += ../src/ap/ieee802_11_shared.o | |
-OBJS += ../src/ap/beacon.o | |
- | |
-OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o | |
NEED_RC4=y | |
NEED_AES=y | |
@@ -78,14 +74,9 @@ | |
endif | |
endif | |
-ifndef CONFIG_ELOOP | |
-CONFIG_ELOOP=eloop | |
-endif | |
-OBJS += ../src/utils/$(CONFIG_ELOOP).o | |
-OBJS_c += ../src/utils/$(CONFIG_ELOOP).o | |
+OBJS += ../src/utils/eloop.o | |
OBJS += ../src/utils/common.o | |
OBJS += ../src/utils/wpa_debug.o | |
-OBJS_c += ../src/utils/wpa_debug.o | |
OBJS += ../src/utils/wpabuf.o | |
OBJS += ../src/utils/os_$(CONFIG_OS).o | |
OBJS += ../src/utils/ip_addr.o | |
@@ -436,10 +427,6 @@ | |
CONFIG_TLS=openssl | |
endif | |
-ifdef CONFIG_TLSV11 | |
-CFLAGS += -DCONFIG_TLSV11 | |
-endif | |
- | |
ifeq ($(CONFIG_TLS), openssl) | |
ifdef TLS_FUNCS | |
OBJS += ../src/crypto/tls_openssl.o | |
@@ -458,6 +445,10 @@ | |
ifdef TLS_FUNCS | |
OBJS += ../src/crypto/tls_gnutls.o | |
LIBS += -lgnutls -lgpg-error | |
+ifdef CONFIG_GNUTLS_EXTRA | |
+CFLAGS += -DCONFIG_GNUTLS_EXTRA | |
+LIBS += -lgnutls-extra | |
+endif | |
endif | |
OBJS += ../src/crypto/crypto_gnutls.o | |
HOBJS += ../src/crypto/crypto_gnutls.o | |
@@ -701,7 +692,6 @@ | |
else | |
OBJS += ../src/crypto/random.o | |
HOBJS += ../src/crypto/random.o | |
-HOBJS += ../src/utils/eloop.o | |
HOBJS += $(SHA1OBJS) | |
HOBJS += ../src/crypto/md5.o | |
endif | |
@@ -730,6 +720,7 @@ | |
endif | |
ifdef NEED_AP_MLME | |
+OBJS += ../src/ap/beacon.o | |
OBJS += ../src/ap/wmm.o | |
OBJS += ../src/ap/ap_list.o | |
OBJS += ../src/ap/ieee802_11.o | |
@@ -745,16 +736,6 @@ | |
OBJS += ../src/ap/p2p_hostapd.o | |
endif | |
-ifdef CONFIG_INTERWORKING | |
-CFLAGS += -DCONFIG_INTERWORKING | |
-endif | |
- | |
-ifdef CONFIG_WPA_CLI_EDIT | |
-OBJS_c += ../src/utils/edit.o | |
-else | |
-OBJS_c += ../src/utils/edit_simple.o | |
-endif | |
- | |
ifdef CONFIG_NO_STDOUT_DEBUG | |
CFLAGS += -DCONFIG_NO_STDOUT_DEBUG | |
endif | |
@@ -790,6 +771,10 @@ | |
install: all | |
mkdir -p $(DESTDIR)/usr/local/bin | |
for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done | |
+ cp -f ../scripts/init /etc/init.d/hostapd | |
+ chmod +x /etc/init.d/hostapd | |
+ mkdir -p /etc/hostapd | |
+ cp -f ../scripts/hostapd.conf /etc/hostapd/ | |
../src/drivers/build.hostapd: | |
@if [ -f ../src/drivers/build.wpa_supplicant ]; then \ | |
@@ -803,8 +788,10 @@ | |
$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) | |
@$(E) " LD " $@ | |
+OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o | |
ifdef CONFIG_WPA_TRACE | |
OBJS_c += ../src/utils/trace.o | |
+OBJS_c += ../src/utils/wpa_debug.o | |
endif | |
hostapd_cli: $(OBJS_c) | |
$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) | |
Only in .: RTL8188-hostapd-1-bp.patch | |
Only in .: src |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment