From: Felix Fietkau Date: Sat, 25 Oct 2014 16:48:45 +0000 (+0000) Subject: hostapd: update to 2014-10-25 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3c9fcd2526e8a25a618851453ceb6a63e83c53b3;p=openwrt%2Fstaging%2Fldir.git hostapd: update to 2014-10-25 Signed-off-by: Felix Fietkau SVN-Revision: 43059 --- diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 47d808995e..116fbf5c8a 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_VERSION:=2014-06-03.1 +PKG_VERSION:=2014-10-25 PKG_RELEASE:=1 -PKG_REV:=84df167554569af8c87f0a8ac1fb508192417d8e +PKG_REV:=01e2231fdc4fbec61fbc382238e3606a1d2826e4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git diff --git a/package/network/services/hostapd/patches/001-fix_pmksa_cache.patch b/package/network/services/hostapd/patches/001-fix_pmksa_cache.patch deleted file mode 100644 index 76a3968857..0000000000 --- a/package/network/services/hostapd/patches/001-fix_pmksa_cache.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9c829900bb01d6fb22e78ba78195c78de39f64b9 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Sat, 04 Oct 2014 19:11:00 +0000 -Subject: Fix authenticator OKC fetch from PMKSA cache to avoid infinite loop - -If the first entry in the PMKSA cache did not match the station's MAC -address, an infinite loop could be reached in pmksa_cache_get_okc() when -trying to find a PMKSA cache entry for opportunistic key caching cases. -This would only happen if OKC is enabled (okc=1 included in the -configuration file). - -Signed-off-by: Jouni Malinen ---- ---- a/src/ap/pmksa_cache_auth.c -+++ b/src/ap/pmksa_cache_auth.c -@@ -394,15 +394,13 @@ struct rsn_pmksa_cache_entry * pmksa_cac - struct rsn_pmksa_cache_entry *entry; - u8 new_pmkid[PMKID_LEN]; - -- entry = pmksa->pmksa; -- while (entry) { -+ for (entry = pmksa->pmksa; entry; entry = entry->next) { - if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0) - continue; - rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid, - wpa_key_mgmt_sha256(entry->akmp)); - if (os_memcmp(new_pmkid, pmkid, PMKID_LEN) == 0) - return entry; -- entry = entry->next; - } - return NULL; - } diff --git a/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch b/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch deleted file mode 100644 index c1db046410..0000000000 --- a/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 89de07a9442072f88d49869d8ecd8d42bae050a0 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 6 Oct 2014 16:27:44 +0300 -Subject: [PATCH 1/3] Add os_exec() helper to run external programs - -Signed-off-by: Jouni Malinen ---- - src/utils/os.h | 9 +++++++++ - src/utils/os_unix.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/utils/os_win32.c | 6 ++++++ - 3 files changed, 70 insertions(+) - ---- a/src/utils/os.h -+++ b/src/utils/os.h -@@ -584,6 +584,15 @@ static inline void os_remove_in_array(vo - */ - size_t os_strlcpy(char *dest, const char *src, size_t siz); - -+/** -+ * os_exec - Execute an external program -+ * @program: Path to the program -+ * @arg: Command line argument string -+ * @wait_completion: Whether to wait until the program execution completes -+ * Returns: 0 on success, -1 on error -+ */ -+int os_exec(const char *program, const char *arg, int wait_completion); -+ - - #ifdef OS_REJECT_C_LIB_FUNCTIONS - #define malloc OS_DO_NOT_USE_malloc ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -9,6 +9,7 @@ - #include "includes.h" - - #include -+#include - - #ifdef ANDROID - #include -@@ -540,3 +541,57 @@ char * os_strdup(const char *s) - } - - #endif /* WPA_TRACE */ -+ -+ -+int os_exec(const char *program, const char *arg, int wait_completion) -+{ -+ pid_t pid; -+ int pid_status; -+ -+ pid = fork(); -+ if (pid < 0) { -+ perror("fork"); -+ return -1; -+ } -+ -+ if (pid == 0) { -+ /* run the external command in the child process */ -+ const int MAX_ARG = 30; -+ char *_program, *_arg, *pos; -+ char *argv[MAX_ARG + 1]; -+ int i; -+ -+ _program = os_strdup(program); -+ _arg = os_strdup(arg); -+ -+ argv[0] = _program; -+ -+ i = 1; -+ pos = _arg; -+ while (i < MAX_ARG && pos && *pos) { -+ while (*pos == ' ') -+ pos++; -+ if (*pos == '\0') -+ break; -+ argv[i++] = pos; -+ pos = os_strchr(pos, ' '); -+ if (pos) -+ *pos++ = '\0'; -+ } -+ argv[i] = NULL; -+ -+ execv(program, argv); -+ perror("execv"); -+ os_free(_program); -+ os_free(_arg); -+ exit(0); -+ return -1; -+ } -+ -+ if (wait_completion) { -+ /* wait for the child process to complete in the parent */ -+ waitpid(pid, &pid_status, 0); -+ } -+ -+ return 0; -+} ---- a/src/utils/os_win32.c -+++ b/src/utils/os_win32.c -@@ -244,3 +244,9 @@ size_t os_strlcpy(char *dest, const char - - return s - src - 1; - } -+ -+ -+int os_exec(const char *program, const char *arg, int wait_completion) -+{ -+ return -1; -+} diff --git a/package/network/services/hostapd/patches/003-wpa_cli-Use-os_exec-for-action-script-execution.patch b/package/network/services/hostapd/patches/003-wpa_cli-Use-os_exec-for-action-script-execution.patch deleted file mode 100644 index 7fe44bf907..0000000000 --- a/package/network/services/hostapd/patches/003-wpa_cli-Use-os_exec-for-action-script-execution.patch +++ /dev/null @@ -1,54 +0,0 @@ -From c5f258de76dbb67fb64beab39a99e5c5711f41fe Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 6 Oct 2014 17:25:52 +0300 -Subject: [PATCH 2/3] wpa_cli: Use os_exec() for action script execution - -Use os_exec() to run the action script operations to avoid undesired -command line processing for control interface event strings. Previously, -it could have been possible for some of the event strings to include -unsanitized data which is not suitable for system() use. (CVE-2014-3686) - -Signed-off-by: Jouni Malinen ---- - wpa_supplicant/wpa_cli.c | 25 ++++++++----------------- - 1 file changed, 8 insertions(+), 17 deletions(-) - ---- a/wpa_supplicant/wpa_cli.c -+++ b/wpa_supplicant/wpa_cli.c -@@ -3149,28 +3149,19 @@ static int str_match(const char *a, cons - static int wpa_cli_exec(const char *program, const char *arg1, - const char *arg2) - { -- char *cmd; -+ char *arg; - size_t len; - int res; -- int ret = 0; - -- len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3; -- cmd = os_malloc(len); -- if (cmd == NULL) -+ len = os_strlen(arg1) + os_strlen(arg2) + 2; -+ arg = os_malloc(len); -+ if (arg == NULL) - return -1; -- res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2); -- if (res < 0 || (size_t) res >= len) { -- os_free(cmd); -- return -1; -- } -- cmd[len - 1] = '\0'; --#ifndef _WIN32_WCE -- if (system(cmd) < 0) -- ret = -1; --#endif /* _WIN32_WCE */ -- os_free(cmd); -+ os_snprintf(arg, len, "%s %s", arg1, arg2); -+ res = os_exec(program, arg, 1); -+ os_free(arg); - -- return ret; -+ return res; - } - - diff --git a/package/network/services/hostapd/patches/004-hostapd_cli-Use-os_exec-for-action-script-execution.patch b/package/network/services/hostapd/patches/004-hostapd_cli-Use-os_exec-for-action-script-execution.patch deleted file mode 100644 index 4f08ee5175..0000000000 --- a/package/network/services/hostapd/patches/004-hostapd_cli-Use-os_exec-for-action-script-execution.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 5d4fa2a29bef013e61185beb21a3ec110885eb9a Mon Sep 17 00:00:00 2001 -From: Jouni Malinen -Date: Mon, 6 Oct 2014 18:49:01 +0300 -Subject: [PATCH 3/3] hostapd_cli: Use os_exec() for action script execution - -Use os_exec() to run the action script operations to avoid undesired -command line processing for control interface event strings. Previously, -it could have been possible for some of the event strings to include -unsanitized data which is not suitable for system() use. (CVE-2014-3686) - -Signed-off-by: Jouni Malinen ---- - hostapd/hostapd_cli.c | 25 ++++++++----------------- - 1 file changed, 8 insertions(+), 17 deletions(-) - ---- a/hostapd/hostapd_cli.c -+++ b/hostapd/hostapd_cli.c -@@ -238,28 +238,19 @@ static int hostapd_cli_cmd_mib(struct wp - static int hostapd_cli_exec(const char *program, const char *arg1, - const char *arg2) - { -- char *cmd; -+ char *arg; - size_t len; - int res; -- int ret = 0; - -- len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3; -- cmd = os_malloc(len); -- if (cmd == NULL) -+ len = os_strlen(arg1) + os_strlen(arg2) + 2; -+ arg = os_malloc(len); -+ if (arg == NULL) - return -1; -- res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2); -- if (res < 0 || (size_t) res >= len) { -- os_free(cmd); -- return -1; -- } -- cmd[len - 1] = '\0'; --#ifndef _WIN32_WCE -- if (system(cmd) < 0) -- ret = -1; --#endif /* _WIN32_WCE */ -- os_free(cmd); -+ os_snprintf(arg, len, "%s %s", arg1, arg2); -+ res = os_exec(program, arg, 1); -+ os_free(arg); - -- return ret; -+ return res; - } - - diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch index 1ad84bf405..9cab8abdb1 100644 --- a/package/network/services/hostapd/patches/110-bool_fix.patch +++ b/package/network/services/hostapd/patches/110-bool_fix.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2119,9 +2119,9 @@ void ieee802_1x_notify_pre_auth(struct e +@@ -2232,9 +2232,9 @@ void ieee802_1x_notify_pre_auth(struct e } diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch index 032e2072a3..54ace76793 100644 --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch @@ -8,7 +8,7 @@ #ifdef ANDROID #include -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm +@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm return 0; } diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch index efe151c3a3..23180b924a 100644 --- a/package/network/services/hostapd/patches/200-multicall.patch +++ b/package/network/services/hostapd/patches/200-multicall.patch @@ -8,7 +8,7 @@ ifdef CONFIG_TESTING_OPTIONS CFLAGS += -DCONFIG_TESTING_OPTIONS -@@ -223,10 +224,14 @@ ifdef CONFIG_IEEE80211AC +@@ -224,10 +225,14 @@ ifdef CONFIG_IEEE80211AC CFLAGS += -DCONFIG_IEEE80211AC endif @@ -26,7 +26,7 @@ LIBS += $(DRV_AP_LIBS) ifdef CONFIG_L2_PACKET -@@ -913,6 +918,12 @@ install: all +@@ -914,6 +919,12 @@ install: all BCHECK=../src/drivers/build.hostapd @@ -39,7 +39,7 @@ hostapd: $(BCHECK) $(OBJS) $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) @$(E) " LD " $@ -@@ -951,6 +962,12 @@ HOBJS += ../src/crypto/aes-internal.o +@@ -952,6 +963,12 @@ HOBJS += ../src/crypto/aes-internal.o HOBJS += ../src/crypto/aes-internal-enc.o endif @@ -62,7 +62,7 @@ ifdef CONFIG_TESTING_OPTIONS CFLAGS += -DCONFIG_TESTING_OPTIONS -@@ -741,6 +742,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS +@@ -745,6 +746,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS LIBS += -ldl -rdynamic endif @@ -73,7 +73,7 @@ endif ifdef CONFIG_MACSEC -@@ -762,9 +767,11 @@ NEED_EAP_COMMON=y +@@ -765,9 +770,11 @@ NEED_EAP_COMMON=y NEED_RSN_AUTHENTICATOR=y CFLAGS += -DCONFIG_AP OBJS += ap.o @@ -85,7 +85,7 @@ OBJS += ../src/ap/hostapd.o OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o -@@ -826,10 +833,18 @@ endif +@@ -830,10 +837,18 @@ endif ifdef CONFIG_HS20 OBJS += ../src/ap/hs20.o endif @@ -104,7 +104,7 @@ NEED_AES_WRAP=y OBJS += ../src/ap/wpa_auth.o OBJS += ../src/ap/wpa_auth_ie.o -@@ -1602,6 +1617,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) +@@ -1589,6 +1604,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config @@ -117,7 +117,7 @@ wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) @$(E) " LD " $@ -@@ -1682,6 +1703,12 @@ endif +@@ -1669,6 +1690,12 @@ endif %@.service: %.service.arg.in sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ @@ -132,7 +132,7 @@ wpa_cli.exe: wpa_cli --- a/src/drivers/driver.h +++ b/src/drivers/driver.h -@@ -4117,8 +4117,8 @@ union wpa_event_data { +@@ -4294,8 +4294,8 @@ union wpa_event_data { * Driver wrapper code should call this function whenever an event is received * from the driver. */ @@ -145,7 +145,7 @@ /* --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c -@@ -926,8 +926,8 @@ static void hostapd_event_dfs_nop_finish +@@ -989,8 +989,8 @@ static void hostapd_event_dfs_nop_finish #endif /* NEED_AP_MLME */ @@ -179,7 +179,7 @@ for (;;) { --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c -@@ -2919,8 +2919,8 @@ static void wpa_supplicant_notify_avoid_ +@@ -2924,8 +2924,8 @@ static void wpa_supplicant_event_assoc_a } @@ -192,7 +192,7 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3811,6 +3811,9 @@ static void wpa_supplicant_deinit_iface( +@@ -3980,6 +3980,9 @@ static void wpa_supplicant_deinit_iface( os_free(wpa_s); } @@ -202,7 +202,7 @@ /** * wpa_supplicant_add_iface - Add a new network interface -@@ -4002,6 +4005,7 @@ struct wpa_global * wpa_supplicant_init( +@@ -4181,6 +4184,7 @@ struct wpa_global * wpa_supplicant_init( wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); #endif /* CONFIG_NO_WPA_MSG */ @@ -212,7 +212,7 @@ wpa_debug_open_syslog(); --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -502,6 +502,9 @@ static int hostapd_get_ctrl_iface_group( +@@ -504,6 +504,9 @@ static int hostapd_get_ctrl_iface_group( return 0; } @@ -222,7 +222,7 @@ #ifdef CONFIG_WPS static int gen_uuid(const char *txt_addr) -@@ -553,6 +556,7 @@ int main(int argc, char *argv[]) +@@ -555,6 +558,7 @@ int main(int argc, char *argv[]) interfaces.global_iface_name = NULL; interfaces.global_ctrl_sock = -1; @@ -257,7 +257,7 @@ struct wpa_driver_ops *wpa_drivers[] = { NULL }; -@@ -1185,6 +1189,8 @@ static void usage(void) +@@ -1194,6 +1198,8 @@ static void usage(void) "option several times.\n"); } @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) { -@@ -1203,6 +1209,7 @@ int main(int argc, char *argv[]) +@@ -1212,6 +1218,7 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch index ac296b8e38..9910f89b7b 100644 --- a/package/network/services/hostapd/patches/300-noscan.patch +++ b/package/network/services/hostapd/patches/300-noscan.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2639,6 +2639,8 @@ static int hostapd_config_fill(struct ho +@@ -2651,6 +2651,8 @@ static int hostapd_config_fill(struct ho } #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_IEEE80211N @@ -11,7 +11,7 @@ } else if (os_strcmp(buf, "ht_capab") == 0) { --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -576,6 +576,7 @@ struct hostapd_config { +@@ -605,6 +605,7 @@ struct hostapd_config { int ht_op_mode_fixed; u16 ht_capab; @@ -32,17 +32,17 @@ hostapd_set_state(iface, HAPD_IFACE_HT_SCAN); --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos +@@ -220,6 +220,9 @@ void hostapd_2040_coex_action(struct hos if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) return; + if (iface->conf->noscan) + return; + - hdr_len = data - (u8 *) mgmt; - if (hdr_len > len) + if (len < IEEE80211_HDRLEN + 1) return; -@@ -319,6 +322,9 @@ void ht40_intolerant_add(struct hostapd_ + data++; +@@ -317,6 +320,9 @@ void ht40_intolerant_add(struct hostapd_ if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) return; diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch index dac0f6e4e6..878b61a655 100644 --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -2752,7 +2752,7 @@ static struct wpa_supplicant * wpa_suppl +@@ -2914,7 +2914,7 @@ static struct wpa_supplicant * wpa_suppl if (wpa_s == NULL) return NULL; wpa_s->scan_req = INITIAL_SCAN_REQ; diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch index 3808f9bcb6..5cf80e52d5 100644 --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch @@ -8,7 +8,7 @@ ifdef CONFIG_LIBNL32 DRV_LIBS += -lnl-3 -@@ -114,7 +113,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT +@@ -115,7 +114,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT CONFIG_WIRELESS_EXTENSION=y NEED_NETLINK=y NEED_LINUX_IOCTL=y @@ -16,7 +16,7 @@ endif ifdef CONFIG_DRIVER_NDIS -@@ -140,7 +138,6 @@ endif +@@ -141,7 +139,6 @@ endif ifdef CONFIG_WIRELESS_EXTENSION DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION DRV_WPA_OBJS += ../src/drivers/driver_wext.o @@ -24,7 +24,7 @@ endif ifdef NEED_NETLINK -@@ -153,6 +150,7 @@ endif +@@ -154,6 +151,7 @@ endif ifdef NEED_RFKILL DRV_OBJS += ../src/drivers/rfkill.o diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch index dbc9ef8ef5..097f5c8383 100644 --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -7488,7 +7488,7 @@ static int nl80211_set_channel(struct i8 +@@ -7840,7 +7840,7 @@ static int nl80211_set_channel(struct i8 nl80211_cmd(drv, msg, 0, set_chan ? NL80211_CMD_SET_CHANNEL : NL80211_CMD_SET_WIPHY); @@ -9,12 +9,3 @@ if (nl80211_put_freq_params(msg, freq) < 0) goto nla_put_failure; -@@ -12047,7 +12047,7 @@ static int nl80211_switch_channel(void * - return -ENOMEM; - - nl80211_cmd(drv, msg, 0, NL80211_CMD_CHANNEL_SWITCH); -- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); -+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex); - NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count); - ret = nl80211_put_freq_params(msg, &settings->freq_params); - if (ret) diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch index d3e8918d71..72ff21cc61 100644 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch @@ -1,6 +1,6 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -70,6 +70,16 @@ static void hostapd_reload_bss(struct ho +@@ -71,6 +71,16 @@ static void hostapd_reload_bss(struct ho #endif /* CONFIG_NO_RADIUS */ ssid = &hapd->conf->ssid; @@ -17,7 +17,7 @@ if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && ssid->wpa_passphrase_set && ssid->wpa_passphrase) { /* -@@ -170,20 +180,12 @@ int hostapd_reload_config(struct hostapd +@@ -171,20 +181,12 @@ int hostapd_reload_config(struct hostapd oldconf = hapd->iconf; iface->conf = newconf; diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch index e6f6cf3b5d..46f0a2531c 100644 --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch @@ -1,6 +1,6 @@ --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -4817,18 +4817,20 @@ wpa_driver_nl80211_finish_drv_init(struc +@@ -5083,18 +5083,20 @@ wpa_driver_nl80211_finish_drv_init(struc } @@ -24,7 +24,7 @@ return send_and_recv_msgs(drv, msg, NULL, NULL); nla_put_failure: -@@ -4836,6 +4838,15 @@ static int wpa_driver_nl80211_del_beacon +@@ -5102,6 +5104,15 @@ static int wpa_driver_nl80211_del_beacon return -ENOBUFS; } @@ -40,7 +40,7 @@ /** * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface -@@ -10617,7 +10628,6 @@ static int wpa_driver_nl80211_stop_ap(vo +@@ -11147,7 +11158,6 @@ static int wpa_driver_nl80211_stop_ap(vo if (!is_ap_interface(drv->nlmode)) return -1; wpa_driver_nl80211_del_beacon(drv); diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch index e69c3d38b6..f5557fd8ed 100644 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch @@ -1,6 +1,6 @@ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -37,6 +37,7 @@ +@@ -43,6 +43,7 @@ #include "wps/wps.h" #include "config_file.h" #include "ctrl_iface.h" @@ -8,7 +8,7 @@ struct wpa_ctrl_dst { -@@ -47,6 +48,7 @@ struct wpa_ctrl_dst { +@@ -53,6 +54,7 @@ struct wpa_ctrl_dst { int errors; }; @@ -16,7 +16,7 @@ static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level, const char *buf, size_t len); -@@ -156,6 +158,68 @@ static int hostapd_ctrl_iface_new_sta(st +@@ -162,6 +164,68 @@ static int hostapd_ctrl_iface_new_sta(st return 0; } @@ -85,7 +85,7 @@ #ifdef CONFIG_IEEE80211W #ifdef NEED_AP_MLME -@@ -1546,6 +1610,10 @@ static void hostapd_ctrl_iface_receive(i +@@ -1761,6 +1825,10 @@ static void hostapd_ctrl_iface_receive(i } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, reply_size); diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch index 4b1f2abd47..2f2c2d6054 100644 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -108,6 +108,11 @@ struct wpa_interface { +@@ -109,6 +109,11 @@ struct wpa_interface { const char *ifname; /** @@ -12,7 +12,7 @@ * bridge_ifname - Optional bridge interface name * * If the driver interface (ifname) is included in a Linux bridge -@@ -395,6 +400,8 @@ struct wpa_supplicant { +@@ -406,6 +411,8 @@ struct wpa_supplicant { #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ char bridge_ifname[16]; @@ -101,8 +101,8 @@ /* Configure default/group WEP keys for static WEP */ int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { -@@ -711,8 +760,12 @@ void wpa_supplicant_set_state(struct wpa - #endif /* CONFIG_P2P */ +@@ -731,8 +780,12 @@ void wpa_supplicant_set_state(struct wpa + wpas_p2p_completed(wpa_s); sme_sched_obss_scan(wpa_s, 1); + if (wpa_s->hostapd) @@ -114,7 +114,7 @@ wpa_s->new_connection = 1; wpa_drv_set_operstate(wpa_s, 0); #ifndef IEEE8021X_EAPOL -@@ -3595,6 +3648,20 @@ static int wpa_supplicant_init_iface(str +@@ -3753,6 +3806,20 @@ static int wpa_supplicant_init_iface(str sizeof(wpa_s->bridge_ifname)); } @@ -135,7 +135,7 @@ /* RSNA Supplicant Key Management - INITIALIZE */ eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); eapol_sm_notify_portValid(wpa_s->eapol, FALSE); -@@ -3798,6 +3865,11 @@ static void wpa_supplicant_deinit_iface( +@@ -3967,6 +4034,11 @@ static void wpa_supplicant_deinit_iface( if (terminate) wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); @@ -157,7 +157,7 @@ #include "drivers/driver.h" #include "wpa_supplicant_i.h" #include "config.h" -@@ -247,6 +248,10 @@ static void calculate_update_time(const +@@ -247,6 +248,10 @@ static void calculate_update_time(const static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, struct os_reltime *fetch_time) { diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 8c4e9bdcc4..ef4f961bfc 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -163,6 +163,9 @@ endif +@@ -164,6 +164,9 @@ endif ifdef CONFIG_NO_CTRL_IFACE CFLAGS += -DCONFIG_NO_CTRL_IFACE else @@ -12,7 +12,7 @@ endif --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -1447,6 +1447,7 @@ static void hostapd_ctrl_iface_receive(i +@@ -1653,6 +1653,7 @@ static void hostapd_ctrl_iface_receive(i reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -1488,6 +1489,7 @@ static void hostapd_ctrl_iface_receive(i +@@ -1694,6 +1695,7 @@ static void hostapd_ctrl_iface_receive(i } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -805,6 +805,9 @@ ifdef CONFIG_WNM +@@ -809,6 +809,9 @@ ifdef CONFIG_WNM OBJS += ../src/ap/wnm_ap.o endif ifdef CONFIG_CTRL_IFACE @@ -42,7 +42,7 @@ --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c -@@ -1602,7 +1602,7 @@ static int wpa_supplicant_ctrl_iface_sta +@@ -1628,7 +1628,7 @@ static int wpa_supplicant_ctrl_iface_sta pos += ret; } @@ -51,7 +51,7 @@ if (wpa_s->ap_iface) { pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos, end - pos, -@@ -6243,6 +6243,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -6720,6 +6720,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = -1; } else if (os_strncmp(buf, "NOTE ", 5) == 0) { wpa_printf(MSG_INFO, "NOTE: %s", buf + 5); @@ -59,7 +59,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size); if (reply_len >= 0) { -@@ -6254,6 +6255,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -6731,6 +6732,7 @@ char * wpa_supplicant_ctrl_iface_process else reply_len += res; } @@ -67,7 +67,7 @@ } else if (os_strncmp(buf, "STATUS", 6) == 0) { reply_len = wpa_supplicant_ctrl_iface_status( wpa_s, buf + 6, reply, reply_size); -@@ -6661,6 +6663,7 @@ char * wpa_supplicant_ctrl_iface_process +@@ -7140,6 +7142,7 @@ char * wpa_supplicant_ctrl_iface_process reply_len = wpa_supplicant_ctrl_iface_bss( wpa_s, buf + 4, reply, reply_size); #ifdef CONFIG_AP @@ -75,7 +75,7 @@ } else if (os_strcmp(buf, "STA-FIRST") == 0) { reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size); } else if (os_strncmp(buf, "STA ", 4) == 0) { -@@ -6669,12 +6672,15 @@ char * wpa_supplicant_ctrl_iface_process +@@ -7148,12 +7151,15 @@ char * wpa_supplicant_ctrl_iface_process } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply, reply_size); @@ -109,14 +109,14 @@ #ifdef CONFIG_P2P_MANAGER static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype, -@@ -526,3 +528,4 @@ int hostapd_parse_csa_settings(const cha +@@ -527,3 +529,4 @@ int hostapd_parse_csa_settings(const cha return 0; } + --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c -@@ -2124,6 +2124,7 @@ static const char * bool_txt(Boolean boo +@@ -2237,6 +2237,7 @@ static const char * bool_txt(Boolean boo return bool_val ? "TRUE" : "FALSE"; } @@ -124,7 +124,7 @@ int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen) { -@@ -2291,6 +2292,7 @@ int ieee802_1x_get_mib_sta(struct hostap +@@ -2404,6 +2405,7 @@ int ieee802_1x_get_mib_sta(struct hostap return len; } @@ -134,7 +134,7 @@ struct sta_info *sta, int success, --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c -@@ -2832,6 +2832,7 @@ static const char * wpa_bool_txt(int boo +@@ -2835,6 +2835,7 @@ static const char * wpa_bool_txt(int boo return bool ? "TRUE" : "FALSE"; } @@ -142,7 +142,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ -@@ -2976,7 +2977,7 @@ int wpa_get_mib_sta(struct wpa_state_mac +@@ -2979,7 +2980,7 @@ int wpa_get_mib_sta(struct wpa_state_mac return len; } @@ -153,7 +153,7 @@ { --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c -@@ -1911,6 +1911,8 @@ static u32 wpa_key_mgmt_suite(struct wpa +@@ -1928,6 +1928,8 @@ static u32 wpa_key_mgmt_suite(struct wpa } @@ -162,7 +162,7 @@ #define RSN_SUITE "%02x-%02x-%02x-%d" #define RSN_SUITE_ARG(s) \ ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff -@@ -1994,6 +1996,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch +@@ -2011,6 +2013,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch return (int) len; } @@ -172,7 +172,7 @@ --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c -@@ -984,7 +984,7 @@ int wpas_ap_wps_nfc_report_handover(stru +@@ -975,7 +975,7 @@ int wpas_ap_wps_nfc_report_handover(stru #endif /* CONFIG_WPS */ diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch index 40148fc60e..21f6ec0208 100644 --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch @@ -1,6 +1,6 @@ --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c -@@ -1002,6 +1002,31 @@ const char * wpa_key_mgmt_txt(int key_mg +@@ -1026,6 +1026,31 @@ u32 wpa_akm_to_suite(int akm) } @@ -32,7 +32,7 @@ int wpa_compare_rsn_ie(int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len) -@@ -1009,8 +1034,19 @@ int wpa_compare_rsn_ie(int ft_initial_as +@@ -1033,8 +1058,19 @@ int wpa_compare_rsn_ie(int ft_initial_as if (ie1 == NULL || ie2 == NULL) return -1; diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch new file mode 100644 index 0000000000..8dae52b277 --- /dev/null +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch @@ -0,0 +1,25 @@ +--- a/src/ap/wps_hostapd.c ++++ b/src/ap/wps_hostapd.c +@@ -1051,11 +1051,9 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->rsn_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; +- } +- +- if (conf->wpa & WPA_PROTO_WPA) { ++ } else if (conf->wpa & WPA_PROTO_WPA) { + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) + wps->auth_types |= WPS_AUTH_WPAPSK; + if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) +@@ -1063,7 +1061,7 @@ int hostapd_init_wps(struct hostapd_data + + if (conf->wpa_pairwise & WPA_CIPHER_CCMP) + wps->encr_types |= WPS_ENCR_AES; +- if (conf->wpa_pairwise & WPA_CIPHER_TKIP) ++ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP) + wps->encr_types |= WPS_ENCR_TKIP; + } + diff --git a/package/network/services/hostapd/patches/410-bring_down_interface.patch b/package/network/services/hostapd/patches/410-bring_down_interface.patch deleted file mode 100644 index 165484b553..0000000000 --- a/package/network/services/hostapd/patches/410-bring_down_interface.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -9070,12 +9070,7 @@ static int wpa_driver_nl80211_set_mode(s - /* Try to set the mode again while the interface is - * down */ - ret = nl80211_set_mode(drv, drv->ifindex, nlmode); -- if (ret == -EACCES) -- break; -- res = i802_set_iface_flags(bss, 1); -- if (res && !ret) -- ret = -1; -- else if (ret != -EBUSY) -+ if (ret != -EBUSY) - break; - } else - wpa_printf(MSG_DEBUG, "nl80211: Failed to set " -@@ -9088,6 +9083,8 @@ static int wpa_driver_nl80211_set_mode(s - "interface is down"); - drv->nlmode = nlmode; - drv->ignore_if_down_event = 1; -+ if (i802_set_iface_flags(bss, 1)) -+ ret = -1; - } - - done: diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch new file mode 100644 index 0000000000..4643140eba --- /dev/null +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch @@ -0,0 +1,214 @@ +--- a/src/utils/wpa_debug.c ++++ b/src/utils/wpa_debug.c +@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void) + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + { + va_list ap; + +@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f + } + + +-static void _wpa_hexdump(int level, const char *title, const u8 *buf, +- size_t len, int show) ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show) + { + size_t i; + +@@ -375,20 +375,8 @@ static void _wpa_hexdump(int level, cons + #endif /* CONFIG_ANDROID_LOG */ + } + +-void wpa_hexdump(int level, const char *title, const void *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len) +-{ +- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); +-} +- +- +-static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, +- size_t len, int show) ++void _wpa_hexdump_ascii(int level, const char *title, const void *buf, ++ size_t len, int show) + { + size_t i, llen; + const u8 *pos = buf; +@@ -495,20 +483,6 @@ static void _wpa_hexdump_ascii(int level + } + + +-void wpa_hexdump_ascii(int level, const char *title, const void *buf, +- size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, 1); +-} +- +- +-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, +- size_t len) +-{ +- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); +-} +- +- + #ifdef CONFIG_DEBUG_FILE + static char *last_path = NULL; + #endif /* CONFIG_DEBUG_FILE */ +@@ -594,7 +568,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ + } + + +-void wpa_msg(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +@@ -632,7 +606,7 @@ void wpa_msg(void *ctx, int level, const + } + + +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + { + va_list ap; + char *buf; +--- a/src/utils/wpa_debug.h ++++ b/src/utils/wpa_debug.h +@@ -47,6 +47,17 @@ int wpa_debug_open_file(const char *path + int wpa_debug_reopen_file(void); + void wpa_debug_close_file(void); + ++/* internal */ ++void _wpa_hexdump(int level, const char *title, const u8 *buf, ++ size_t len, int show); ++void _wpa_hexdump_ascii(int level, const char *title, const void *buf, ++ size_t len, int show); ++extern int wpa_debug_show_keys; ++ ++#ifndef CONFIG_MSG_MIN_PRIORITY ++#define CONFIG_MSG_MIN_PRIORITY 0 ++#endif ++ + /** + * wpa_debug_printf_timestamp - Print timestamp for debug output + * +@@ -67,9 +78,15 @@ void wpa_debug_print_timestamp(void); + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_printf(int level, const char *fmt, ...) ++void _wpa_printf(int level, const char *fmt, ...) + PRINTF_FORMAT(2, 3); + ++#define wpa_printf(level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_printf(level, __VA_ARGS__); \ ++ } while(0) ++ + /** + * wpa_hexdump - conditional hex dump + * @level: priority level (MSG_*) of the message +@@ -81,7 +98,13 @@ PRINTF_FORMAT(2, 3); + * output may be directed to stdout, stderr, and/or syslog based on + * configuration. The contents of buf is printed out has hex dump. + */ +-void wpa_hexdump(int level, const char *title, const void *buf, size_t len); ++static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, 1); ++} + + static inline void wpa_hexdump_buf(int level, const char *title, + const struct wpabuf *buf) +@@ -103,7 +126,13 @@ static inline void wpa_hexdump_buf(int l + * like wpa_hexdump(), but by default, does not include secret keys (passwords, + * etc.) in debug output. + */ +-void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len); ++static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); ++} + + static inline void wpa_hexdump_buf_key(int level, const char *title, + const struct wpabuf *buf) +@@ -125,8 +154,14 @@ static inline void wpa_hexdump_buf_key(i + * the hex numbers and ASCII characters (for printable range) are shown. 16 + * bytes per line will be shown. + */ +-void wpa_hexdump_ascii(int level, const char *title, const void *buf, +- size_t len); ++static inline void wpa_hexdump_ascii(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, 1); ++} + + /** + * wpa_hexdump_ascii_key - conditional hex dump, hide keys +@@ -142,8 +177,14 @@ void wpa_hexdump_ascii(int level, const + * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by + * default, does not include secret keys (passwords, etc.) in debug output. + */ +-void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, +- size_t len); ++static inline void wpa_hexdump_ascii_key(int level, const char *title, ++ const u8 *buf, size_t len) ++{ ++ if (level < CONFIG_MSG_MIN_PRIORITY) ++ return; ++ ++ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); ++} + + /* + * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce +@@ -179,7 +220,12 @@ void wpa_hexdump_ascii_key(int level, co + * + * Note: New line '\n' is added to the end of the text when printing to stdout. + */ +-void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); ++#define wpa_msg(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg(ctx, level, __VA_ARGS__); \ ++ } while(0) + + /** + * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors +@@ -193,8 +239,13 @@ void wpa_msg(void *ctx, int level, const + * attached ctrl_iface monitors. In other words, it can be used for frequent + * events that do not need to be sent to syslog. + */ +-void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) ++void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) + PRINTF_FORMAT(3, 4); ++#define wpa_msg_ctrl(ctx, level, ...) \ ++ do { \ ++ if (level >= CONFIG_MSG_MIN_PRIORITY) \ ++ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \ ++ } while(0) + + /** + * wpa_msg_global - Global printf for ctrl_iface monitors diff --git a/package/network/services/hostapd/patches/420-fix_wps_pin_crash.patch b/package/network/services/hostapd/patches/420-fix_wps_pin_crash.patch deleted file mode 100644 index 31995c43fe..0000000000 --- a/package/network/services/hostapd/patches/420-fix_wps_pin_crash.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -540,6 +540,9 @@ static int hostapd_ctrl_iface_wps_ap_pin - char *pos; - const char *pin_txt; - -+ if (!hapd->wps) -+ return -1; -+ - pos = os_strchr(txt, ' '); - if (pos) - *pos++ = '\0'; diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch new file mode 100644 index 0000000000..b20947ee87 --- /dev/null +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -0,0 +1,82 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -15,6 +15,7 @@ + #include "utils/common.h" + #include "utils/eloop.h" + #include "utils/uuid.h" ++#include "utils/build_features.h" + #include "crypto/random.h" + #include "crypto/tls.h" + #include "common/version.h" +@@ -560,7 +561,7 @@ int main(int argc, char *argv[]) + + wpa_supplicant_event = hostapd_wpa_event; + for (;;) { +- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:"); ++ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::"); + if (c < 0) + break; + switch (c) { +@@ -597,6 +598,8 @@ int main(int argc, char *argv[]) + break; + #endif /* CONFIG_DEBUG_LINUX_TRACING */ + case 'v': ++ if (optarg) ++ exit(!has_feature(optarg)); + show_version(); + exit(1); + break; +--- a/wpa_supplicant/main.c ++++ b/wpa_supplicant/main.c +@@ -12,6 +12,7 @@ + #endif /* __linux__ */ + + #include "common.h" ++#include "build_features.h" + #include "wpa_supplicant_i.h" + #include "driver_i.h" + #include "p2p_supplicant.h" +@@ -176,7 +177,7 @@ int main(int argc, char *argv[]) + + for (;;) { + c = getopt(argc, argv, +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W"); + if (c < 0) + break; + switch (c) { +@@ -279,8 +280,12 @@ int main(int argc, char *argv[]) + break; + #endif /* CONFIG_DBUS */ + case 'v': +- printf("%s\n", wpa_supplicant_version); +- exitcode = 0; ++ if (optarg) { ++ exitcode = !has_feature(optarg); ++ } else { ++ printf("%s\n", wpa_supplicant_version); ++ exitcode = 0; ++ } + goto out; + case 'W': + params.wait_for_monitor++; +--- /dev/null ++++ b/src/utils/build_features.h +@@ -0,0 +1,17 @@ ++#ifndef BUILD_FEATURES_H ++#define BUILD_FEATURES_H ++ ++static inline int has_feature(const char *feat) ++{ ++#ifdef IEEE8021X_EAPOL ++ if (!strcmp(feat, "eap")) ++ return 1; ++#endif ++#ifdef IEEE80211N ++ if (!strcmp(feat, "11n")) ++ return 1; ++#endif ++ return 0; ++} ++ ++#endif /* BUILD_FEATURES_H */ diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch new file mode 100644 index 0000000000..1cf3fee862 --- /dev/null +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch @@ -0,0 +1,50 @@ +--- a/hostapd/hostapd_cli.c ++++ b/hostapd/hostapd_cli.c +@@ -67,7 +67,6 @@ static const char *commands_help = + #ifdef CONFIG_IEEE80211W + " sa_query send SA Query to a station\n" + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + " wps_pin [timeout] [addr] add WPS Enrollee PIN\n" + " wps_check_pin verify PIN checksum\n" + " wps_pbc indicate button pushed to initiate PBC\n" +@@ -80,7 +79,6 @@ static const char *commands_help = + " wps_ap_pin [params..] enable/disable AP PIN\n" + " wps_config configure AP\n" + " wps_get_status show current WPS status\n" +-#endif /* CONFIG_WPS */ + " get_config show current configuration\n" + " help show this usage help\n" + " interface [ifname] show interfaces/select interface\n" +@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru + #endif /* CONFIG_IEEE80211W */ + + +-#ifdef CONFIG_WPS + static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, + char *argv[]) + { +@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st + ssid_hex, argv[1]); + return wpa_ctrl_command(ctrl, buf); + } +-#endif /* CONFIG_WPS */ + + + static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, +@@ -993,7 +989,6 @@ static struct hostapd_cli_cmd hostapd_cl + #ifdef CONFIG_IEEE80211W + { "sa_query", hostapd_cli_cmd_sa_query }, + #endif /* CONFIG_IEEE80211W */ +-#ifdef CONFIG_WPS + { "wps_pin", hostapd_cli_cmd_wps_pin }, + { "wps_check_pin", hostapd_cli_cmd_wps_check_pin }, + { "wps_pbc", hostapd_cli_cmd_wps_pbc }, +@@ -1007,7 +1002,6 @@ static struct hostapd_cli_cmd hostapd_cl + { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin }, + { "wps_config", hostapd_cli_cmd_wps_config }, + { "wps_get_status", hostapd_cli_cmd_wps_get_status }, +-#endif /* CONFIG_WPS */ + { "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent }, + { "ess_disassoc", hostapd_cli_cmd_ess_disassoc }, + { "get_config", hostapd_cli_cmd_get_config }, diff --git a/package/network/services/hostapd/patches/430-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/430-wps_single_auth_enc_type.patch deleted file mode 100644 index 8dae52b277..0000000000 --- a/package/network/services/hostapd/patches/430-wps_single_auth_enc_type.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/src/ap/wps_hostapd.c -+++ b/src/ap/wps_hostapd.c -@@ -1051,11 +1051,9 @@ int hostapd_init_wps(struct hostapd_data - - if (conf->rsn_pairwise & WPA_CIPHER_CCMP) - wps->encr_types |= WPS_ENCR_AES; -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) - wps->encr_types |= WPS_ENCR_TKIP; -- } -- -- if (conf->wpa & WPA_PROTO_WPA) { -+ } else if (conf->wpa & WPA_PROTO_WPA) { - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK) - wps->auth_types |= WPS_AUTH_WPAPSK; - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X) -@@ -1063,7 +1061,7 @@ int hostapd_init_wps(struct hostapd_data - - if (conf->wpa_pairwise & WPA_CIPHER_CCMP) - wps->encr_types |= WPS_ENCR_AES; -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP) -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP) - wps->encr_types |= WPS_ENCR_TKIP; - } - diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch new file mode 100644 index 0000000000..36b5a441f9 --- /dev/null +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch @@ -0,0 +1,13 @@ +--- a/wpa_supplicant/wpa_cli.c ++++ b/wpa_supplicant/wpa_cli.c +@@ -26,6 +26,10 @@ + #endif /* ANDROID */ + + ++#ifndef CONFIG_P2P ++#define CONFIG_P2P ++#endif ++ + static const char *wpa_cli_version = + "wpa_cli v" VERSION_STR "\n" + "Copyright (c) 2004-2014, Jouni Malinen and contributors"; diff --git a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch new file mode 100644 index 0000000000..059a2d3522 --- /dev/null +++ b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch @@ -0,0 +1,13 @@ +--- a/src/ap/beacon.c ++++ b/src/ap/beacon.c +@@ -614,6 +614,10 @@ void handle_probe_req(struct hostapd_dat + return; + } + ++ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta) ++ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored," ++ " too many connected stations.", MAC2STR(mgmt->sa)); ++ + #ifdef CONFIG_INTERWORKING + if (hapd->conf->interworking && + elems.interworking && elems.interworking_len >= 1) { diff --git a/package/network/services/hostapd/patches/450-limit_debug_messages.patch b/package/network/services/hostapd/patches/450-limit_debug_messages.patch deleted file mode 100644 index 7030ef2bc7..0000000000 --- a/package/network/services/hostapd/patches/450-limit_debug_messages.patch +++ /dev/null @@ -1,214 +0,0 @@ ---- a/src/utils/wpa_debug.c -+++ b/src/utils/wpa_debug.c -@@ -201,7 +201,7 @@ void wpa_debug_close_linux_tracing(void) - * - * Note: New line '\n' is added to the end of the text when printing to stdout. - */ --void wpa_printf(int level, const char *fmt, ...) -+void _wpa_printf(int level, const char *fmt, ...) - { - va_list ap; - -@@ -248,8 +248,8 @@ void wpa_printf(int level, const char *f - } - - --static void _wpa_hexdump(int level, const char *title, const u8 *buf, -- size_t len, int show) -+void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show) - { - size_t i; - -@@ -375,20 +375,8 @@ static void _wpa_hexdump(int level, cons - #endif /* CONFIG_ANDROID_LOG */ - } - --void wpa_hexdump(int level, const char *title, const void *buf, size_t len) --{ -- _wpa_hexdump(level, title, buf, len, 1); --} -- -- --void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len) --{ -- _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); --} -- -- --static void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len, int show) -+void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -+ size_t len, int show) - { - size_t i, llen; - const u8 *pos = buf; -@@ -495,20 +483,6 @@ static void _wpa_hexdump_ascii(int level - } - - --void wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len) --{ -- _wpa_hexdump_ascii(level, title, buf, len, 1); --} -- -- --void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, -- size_t len) --{ -- _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); --} -- -- - #ifdef CONFIG_DEBUG_FILE - static char *last_path = NULL; - #endif /* CONFIG_DEBUG_FILE */ -@@ -592,7 +566,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_ - } - - --void wpa_msg(void *ctx, int level, const char *fmt, ...) -+void _wpa_msg(void *ctx, int level, const char *fmt, ...) - { - va_list ap; - char *buf; -@@ -630,7 +604,7 @@ void wpa_msg(void *ctx, int level, const - } - - --void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) -+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) - { - va_list ap; - char *buf; ---- a/src/utils/wpa_debug.h -+++ b/src/utils/wpa_debug.h -@@ -47,6 +47,17 @@ int wpa_debug_open_file(const char *path - int wpa_debug_reopen_file(void); - void wpa_debug_close_file(void); - -+/* internal */ -+void _wpa_hexdump(int level, const char *title, const u8 *buf, -+ size_t len, int show); -+void _wpa_hexdump_ascii(int level, const char *title, const void *buf, -+ size_t len, int show); -+extern int wpa_debug_show_keys; -+ -+#ifndef CONFIG_MSG_MIN_PRIORITY -+#define CONFIG_MSG_MIN_PRIORITY 0 -+#endif -+ - /** - * wpa_debug_printf_timestamp - Print timestamp for debug output - * -@@ -67,9 +78,15 @@ void wpa_debug_print_timestamp(void); - * - * Note: New line '\n' is added to the end of the text when printing to stdout. - */ --void wpa_printf(int level, const char *fmt, ...) -+void _wpa_printf(int level, const char *fmt, ...) - PRINTF_FORMAT(2, 3); - -+#define wpa_printf(level, ...) \ -+ do { \ -+ if (level >= CONFIG_MSG_MIN_PRIORITY) \ -+ _wpa_printf(level, __VA_ARGS__); \ -+ } while(0) -+ - /** - * wpa_hexdump - conditional hex dump - * @level: priority level (MSG_*) of the message -@@ -81,7 +98,13 @@ PRINTF_FORMAT(2, 3); - * output may be directed to stdout, stderr, and/or syslog based on - * configuration. The contents of buf is printed out has hex dump. - */ --void wpa_hexdump(int level, const char *title, const void *buf, size_t len); -+static inline void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len) -+{ -+ if (level < CONFIG_MSG_MIN_PRIORITY) -+ return; -+ -+ _wpa_hexdump(level, title, buf, len, 1); -+} - - static inline void wpa_hexdump_buf(int level, const char *title, - const struct wpabuf *buf) -@@ -103,7 +126,13 @@ static inline void wpa_hexdump_buf(int l - * like wpa_hexdump(), but by default, does not include secret keys (passwords, - * etc.) in debug output. - */ --void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len); -+static inline void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len) -+{ -+ if (level < CONFIG_MSG_MIN_PRIORITY) -+ return; -+ -+ _wpa_hexdump(level, title, buf, len, wpa_debug_show_keys); -+} - - static inline void wpa_hexdump_buf_key(int level, const char *title, - const struct wpabuf *buf) -@@ -125,8 +154,14 @@ static inline void wpa_hexdump_buf_key(i - * the hex numbers and ASCII characters (for printable range) are shown. 16 - * bytes per line will be shown. - */ --void wpa_hexdump_ascii(int level, const char *title, const void *buf, -- size_t len); -+static inline void wpa_hexdump_ascii(int level, const char *title, -+ const u8 *buf, size_t len) -+{ -+ if (level < CONFIG_MSG_MIN_PRIORITY) -+ return; -+ -+ _wpa_hexdump_ascii(level, title, buf, len, 1); -+} - - /** - * wpa_hexdump_ascii_key - conditional hex dump, hide keys -@@ -142,8 +177,14 @@ void wpa_hexdump_ascii(int level, const - * bytes per line will be shown. This works like wpa_hexdump_ascii(), but by - * default, does not include secret keys (passwords, etc.) in debug output. - */ --void wpa_hexdump_ascii_key(int level, const char *title, const void *buf, -- size_t len); -+static inline void wpa_hexdump_ascii_key(int level, const char *title, -+ const u8 *buf, size_t len) -+{ -+ if (level < CONFIG_MSG_MIN_PRIORITY) -+ return; -+ -+ _wpa_hexdump_ascii(level, title, buf, len, wpa_debug_show_keys); -+} - - /* - * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce -@@ -178,7 +219,12 @@ void wpa_hexdump_ascii_key(int level, co - * - * Note: New line '\n' is added to the end of the text when printing to stdout. - */ --void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); -+void _wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4); -+#define wpa_msg(ctx, level, ...) \ -+ do { \ -+ if (level >= CONFIG_MSG_MIN_PRIORITY) \ -+ _wpa_msg(ctx, level, __VA_ARGS__); \ -+ } while(0) - - /** - * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors -@@ -192,8 +238,13 @@ void wpa_msg(void *ctx, int level, const - * attached ctrl_iface monitors. In other words, it can be used for frequent - * events that do not need to be sent to syslog. - */ --void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) -+void _wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...) - PRINTF_FORMAT(3, 4); -+#define wpa_msg_ctrl(ctx, level, ...) \ -+ do { \ -+ if (level >= CONFIG_MSG_MIN_PRIORITY) \ -+ _wpa_msg_ctrl(ctx, level, __VA_ARGS__); \ -+ } while(0) - - /** - * wpa_msg_global - Global printf for ctrl_iface monitors diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch new file mode 100644 index 0000000000..629786d9c6 --- /dev/null +++ b/package/network/services/hostapd/patches/450-scan_wait.patch @@ -0,0 +1,66 @@ +--- a/hostapd/main.c ++++ b/hostapd/main.c +@@ -36,6 +36,8 @@ struct hapd_global { + }; + + static struct hapd_global global; ++static int daemonize = 0; ++static char *pid_file = NULL; + + + #ifndef CONFIG_NO_HOSTAPD_LOGGER +@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx, + } + #endif /* CONFIG_NO_HOSTAPD_LOGGER */ + ++static void hostapd_setup_complete_cb(void *ctx) ++{ ++ if (daemonize && os_daemonize(pid_file)) { ++ perror("daemon"); ++ return; ++ } ++ daemonize = 0; ++} + + /** + * hostapd_driver_init - Preparate driver interface +@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho + return -1; + } + ++ hapd->setup_complete_cb = hostapd_setup_complete_cb; ++ + /* Initialize the driver interface */ + if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) + b = NULL; +@@ -374,8 +386,6 @@ static void hostapd_global_deinit(const + #endif /* CONFIG_NATIVE_WINDOWS */ + + eap_server_unregister_methods(); +- +- os_daemonize_terminate(pid_file); + } + + +@@ -401,11 +411,6 @@ static int hostapd_global_run(struct hap + } + #endif /* EAP_SERVER_TNC */ + +- if (daemonize && os_daemonize(pid_file)) { +- perror("daemon"); +- return -1; +- } +- + eloop_run(); + + return 0; +@@ -535,8 +540,7 @@ int main(int argc, char *argv[]) + struct hapd_interfaces interfaces; + int ret = 1; + size_t i, j; +- int c, debug = 0, daemonize = 0; +- char *pid_file = NULL; ++ int c, debug = 0; + const char *log_file = NULL; + const char *entropy_file = NULL; + char **bss_config = NULL, **tmp_bss; diff --git a/package/network/services/hostapd/patches/460-indicate-features.patch b/package/network/services/hostapd/patches/460-indicate-features.patch deleted file mode 100644 index cee3e76777..0000000000 --- a/package/network/services/hostapd/patches/460-indicate-features.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -15,6 +15,7 @@ - #include "utils/common.h" - #include "utils/eloop.h" - #include "utils/uuid.h" -+#include "utils/build_features.h" - #include "crypto/random.h" - #include "crypto/tls.h" - #include "common/version.h" -@@ -558,7 +559,7 @@ int main(int argc, char *argv[]) - - wpa_supplicant_event = hostapd_wpa_event; - for (;;) { -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:"); -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::"); - if (c < 0) - break; - switch (c) { -@@ -595,6 +596,8 @@ int main(int argc, char *argv[]) - break; - #endif /* CONFIG_DEBUG_LINUX_TRACING */ - case 'v': -+ if (optarg) -+ exit(!has_feature(optarg)); - show_version(); - exit(1); - break; ---- a/wpa_supplicant/main.c -+++ b/wpa_supplicant/main.c -@@ -12,6 +12,7 @@ - #endif /* __linux__ */ - - #include "common.h" -+#include "build_features.h" - #include "wpa_supplicant_i.h" - #include "driver_i.h" - #include "p2p_supplicant.h" -@@ -176,7 +177,7 @@ int main(int argc, char *argv[]) - - for (;;) { - c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W"); - if (c < 0) - break; - switch (c) { -@@ -279,8 +280,12 @@ int main(int argc, char *argv[]) - break; - #endif /* CONFIG_DBUS */ - case 'v': -- printf("%s\n", wpa_supplicant_version); -- exitcode = 0; -+ if (optarg) { -+ exitcode = !has_feature(optarg); -+ } else { -+ printf("%s\n", wpa_supplicant_version); -+ exitcode = 0; -+ } - goto out; - case 'W': - params.wait_for_monitor++; ---- /dev/null -+++ b/src/utils/build_features.h -@@ -0,0 +1,17 @@ -+#ifndef BUILD_FEATURES_H -+#define BUILD_FEATURES_H -+ -+static inline int has_feature(const char *feat) -+{ -+#ifdef IEEE8021X_EAPOL -+ if (!strcmp(feat, "eap")) -+ return 1; -+#endif -+#ifdef IEEE80211N -+ if (!strcmp(feat, "11n")) -+ return 1; -+#endif -+ return 0; -+} -+ -+#endif /* BUILD_FEATURES_H */ diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch new file mode 100644 index 0000000000..2dad2738f0 --- /dev/null +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -0,0 +1,191 @@ +From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Sun, 3 Jun 2012 18:22:56 +0200 +Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used + with the ibss join command + +Signed-hostap: Antonio Quartulli +--- + src/drivers/driver.h | 6 +++ + wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 6 +++ + wpa_supplicant/wpa_supplicant.c | 23 +++++++--- + 4 files changed, 124 insertions(+), 7 deletions(-) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -19,6 +19,7 @@ + + #define WPA_SUPPLICANT_DRIVER_VERSION 4 + ++#include "drivers/nl80211_copy.h" + #include "common/defs.h" + #include "utils/list.h" + +@@ -442,6 +443,11 @@ struct wpa_driver_associate_params { + * responsible for selecting with which BSS to associate. */ + const u8 *bssid; + ++ int beacon_interval; ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ int mcast_rate; ++ + /** + * bssid_hint - BSSID of a proposed AP + * +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -15,6 +15,7 @@ + #include "rsn_supp/wpa.h" + #include "eap_peer/eap.h" + #include "p2p/p2p.h" ++#include "drivers/nl80211_copy.h" + #include "config.h" + + +@@ -1576,6 +1577,97 @@ static char * wpa_config_write_psk_list( + + #endif /* CONFIG_P2P */ + ++static int wpa_config_parse_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ ssid->mcast_rate = (int)(strtod(value, NULL) * 10); ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_mcast_rate(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ if (!ssid->mcast_rate == 0) ++ return NULL; ++ ++ value = os_malloc(6); /* longest: 300.0 */ ++ if (value == NULL) ++ return NULL; ++ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++static int wpa_config_parse_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ char *pos, *r, *sptr, *end; ++ double rate; ++ ++ pos = (char *)value; ++ r = strtok_r(pos, ",", &sptr); ++ i = 0; ++ while (pos && i < NL80211_MAX_SUPP_RATES) { ++ rate = 0.0; ++ if (r) ++ rate = strtod(r, &end); ++ ssid->rates[i] = rate * 2; ++ if (*end != '\0' || rate * 2 != ssid->rates[i]) ++ return 1; ++ ++ i++; ++ r = strtok_r(NULL, ",", &sptr); ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_rates(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value, *pos; ++ int res, i; ++ ++ if (ssid->rates[0] <= 0) ++ return NULL; ++ ++ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); ++ if (value == NULL) ++ return NULL; ++ pos = value; ++ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) { ++ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ pos += res; ++ } ++ res = os_snprintf(pos, 6, "%.1f", ++ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2); ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ + /* Helper macros for network block parser */ + + #ifdef OFFSET +@@ -1788,6 +1880,9 @@ static const struct parse_data ssid_fiel + { INT(ap_max_inactivity) }, + { INT(dtim_period) }, + { INT(beacon_int) }, ++ { INT_RANGE(fixed_freq, 0, 1) }, ++ { FUNC(rates) }, ++ { FUNC(mcast_rate) }, + #ifdef CONFIG_MACSEC + { INT_RANGE(macsec_policy, 0, 1) }, + #endif /* CONFIG_MACSEC */ +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -12,6 +12,7 @@ + #include "common/defs.h" + #include "utils/list.h" + #include "eap_peer/eap_config.h" ++#include "drivers/nl80211_copy.h" + + #define MAX_SSID_LEN 32 + +@@ -640,6 +641,10 @@ struct wpa_ssid { + */ + void *parent_cred; + ++ int fixed_freq; ++ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ double mcast_rate; ++ + #ifdef CONFIG_MACSEC + /** + * macsec_policy - Determines the policy for MACsec secure session +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1949,6 +1949,13 @@ static void wpas_start_assoc_cb(struct w + params.beacon_int = ssid->beacon_int; + else + params.beacon_int = wpa_s->conf->beacon_int; ++ params.fixed_freq = ssid->fixed_freq; ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES) { ++ params.rates[i] = ssid->rates[i]; ++ i++; ++ } ++ params.mcast_rate = ssid->mcast_rate; + } + + params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch new file mode 100644 index 0000000000..46a0ef162e --- /dev/null +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch @@ -0,0 +1,59 @@ +From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Sun, 3 Jun 2012 18:42:25 +0200 +Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join + +Signed-hostap: Antonio Quartulli +--- + src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++- + 1 file changed, 32 insertions(+), 1 deletion(-) + +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9023,7 +9023,7 @@ static int wpa_driver_nl80211_ibss(struc + struct wpa_driver_associate_params *params) + { + struct nl_msg *msg; +- int ret = -1; ++ int ret = -1, i; + int count = 0; + + wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); +@@ -9069,6 +9069,37 @@ retry: + params->beacon_int); + } + ++ if (params->fixed_freq) { ++ wpa_printf(MSG_DEBUG, " * fixed_freq"); ++ NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); ++ } ++ ++ if (params->beacon_interval > 0) { ++ wpa_printf(MSG_DEBUG, " * beacon_interval=%d", ++ params->beacon_interval); ++ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, ++ params->beacon_interval); ++ } ++ ++ if (params->rates[0] > 0) { ++ wpa_printf(MSG_DEBUG, " * basic_rates:"); ++ i = 0; ++ while (i < NL80211_MAX_SUPP_RATES && ++ params->rates[i] > 0) { ++ wpa_printf(MSG_DEBUG, " %.1f", ++ (double)params->rates[i] / 2); ++ i++; ++ } ++ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, i, ++ params->rates); ++ } ++ ++ if (params->mcast_rate > 0) { ++ wpa_printf(MSG_DEBUG, " * mcast_rates=%.1f", ++ (double)params->mcast_rate / 10); ++ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; diff --git a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch new file mode 100644 index 0000000000..543e2a6193 --- /dev/null +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch @@ -0,0 +1,156 @@ +From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001 +From: Antonio Quartulli +Date: Tue, 3 Jul 2012 00:36:24 +0200 +Subject: [PATCH] wpa_s: support htmode param + +possible values are HT20, HT40-, HT40+ and NOHT + +Signed-off-by: Antonio Quartulli +--- + src/drivers/driver.h | 2 ++ + src/drivers/driver_nl80211.c | 16 ++++++++++ + wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++ + wpa_supplicant/config_ssid.h | 2 ++ + wpa_supplicant/wpa_supplicant.c | 2 ++ + 5 files changed, 88 insertions(+) + +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -447,6 +447,8 @@ struct wpa_driver_associate_params { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + int mcast_rate; ++ int ht_set; ++ unsigned int htmode; + + /** + * bssid_hint - BSSID of a proposed AP +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -9100,6 +9100,22 @@ retry: + NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); + } + ++ if (params->ht_set) { ++ switch(params->htmode) { ++ case NL80211_CHAN_HT20: ++ wpa_printf(MSG_DEBUG, " * ht=HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ wpa_printf(MSG_DEBUG, " * ht=HT40-"); ++ break; ++ } ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, ++ params->htmode); ++ } ++ + ret = nl80211_set_conn_keys(params, msg); + if (ret) + goto nla_put_failure; +--- a/wpa_supplicant/config.c ++++ b/wpa_supplicant/config.c +@@ -1608,6 +1608,71 @@ static char * wpa_config_write_mcast_rat + } + #endif /* NO_CONFIG_WRITE */ + ++static int wpa_config_parse_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid, int line, ++ const char *value) ++{ ++ int i; ++ static const struct { ++ const char *name; ++ unsigned int val; ++ } htmap[] = { ++ { .name = "HT20", .val = NL80211_CHAN_HT20, }, ++ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, ++ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, ++ { .name = "NOHT", .val = NL80211_CHAN_NO_HT, }, ++ }; ++ ssid->ht_set = 0;; ++ for (i = 0; i < 4; i++) { ++ if (strcasecmp(htmap[i].name, value) == 0) { ++ ssid->htmode = htmap[i].val; ++ ssid->ht_set = 1; ++ break; ++ } ++ } ++ ++ return 0; ++} ++ ++#ifndef NO_CONFIG_WRITE ++static char * wpa_config_write_htmode(const struct parse_data *data, ++ struct wpa_ssid *ssid) ++{ ++ char *value; ++ int res; ++ ++ value = os_malloc(6); /* longest: HT40+ */ ++ if (value == NULL) ++ return NULL; ++ ++ switch(ssid->htmode) { ++ case NL80211_CHAN_HT20: ++ res = os_snprintf(value, 4, "HT20"); ++ break; ++ case NL80211_CHAN_HT40PLUS: ++ res = os_snprintf(value, 5, "HT40+"); ++ break; ++ case NL80211_CHAN_HT40MINUS: ++ res = os_snprintf(value, 5, "HT40-"); ++ break; ++ case NL80211_CHAN_NO_HT: ++ res = os_snprintf(value, 4, "NOHT"); ++ break; ++ default: ++ os_free(value); ++ return NULL; ++ } ++ ++ if (res < 0) { ++ os_free(value); ++ return NULL; ++ } ++ ++ return value; ++} ++#endif /* NO_CONFIG_WRITE */ ++ ++ + static int wpa_config_parse_rates(const struct parse_data *data, + struct wpa_ssid *ssid, int line, + const char *value) +@@ -1883,6 +1948,7 @@ static const struct parse_data ssid_fiel + { INT_RANGE(fixed_freq, 0, 1) }, + { FUNC(rates) }, + { FUNC(mcast_rate) }, ++ { FUNC(htmode) }, + #ifdef CONFIG_MACSEC + { INT_RANGE(macsec_policy, 0, 1) }, + #endif /* CONFIG_MACSEC */ +--- a/wpa_supplicant/config_ssid.h ++++ b/wpa_supplicant/config_ssid.h +@@ -644,6 +644,8 @@ struct wpa_ssid { + int fixed_freq; + unsigned char rates[NL80211_MAX_SUPP_RATES]; + double mcast_rate; ++ int ht_set; ++ unsigned int htmode; + + #ifdef CONFIG_MACSEC + /** +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -1956,6 +1956,8 @@ static void wpas_start_assoc_cb(struct w + i++; + } + params.mcast_rate = ssid->mcast_rate; ++ params.ht_set = ssid->ht_set; ++ params.htmode = ssid->htmode; + } + + params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch deleted file mode 100644 index 7d670919f5..0000000000 --- a/package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/hostapd/hostapd_cli.c -+++ b/hostapd/hostapd_cli.c -@@ -67,7 +67,6 @@ static const char *commands_help = - #ifdef CONFIG_IEEE80211W - " sa_query send SA Query to a station\n" - #endif /* CONFIG_IEEE80211W */ --#ifdef CONFIG_WPS - " wps_pin [timeout] [addr] add WPS Enrollee PIN\n" - " wps_check_pin verify PIN checksum\n" - " wps_pbc indicate button pushed to initiate PBC\n" -@@ -80,7 +79,6 @@ static const char *commands_help = - " wps_ap_pin [params..] enable/disable AP PIN\n" - " wps_config configure AP\n" - " wps_get_status show current WPS status\n" --#endif /* CONFIG_WPS */ - " get_config show current configuration\n" - " help show this usage help\n" - " interface [ifname] show interfaces/select interface\n" -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru - #endif /* CONFIG_IEEE80211W */ - - --#ifdef CONFIG_WPS - static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc, - char *argv[]) - { -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st - ssid_hex, argv[1]); - return wpa_ctrl_command(ctrl, buf); - } --#endif /* CONFIG_WPS */ - - - static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc, -@@ -970,7 +966,6 @@ static struct hostapd_cli_cmd hostapd_cl - #ifdef CONFIG_IEEE80211W - { "sa_query", hostapd_cli_cmd_sa_query }, - #endif /* CONFIG_IEEE80211W */ --#ifdef CONFIG_WPS - { "wps_pin", hostapd_cli_cmd_wps_pin }, - { "wps_check_pin", hostapd_cli_cmd_wps_check_pin }, - { "wps_pbc", hostapd_cli_cmd_wps_pbc }, -@@ -984,7 +979,6 @@ static struct hostapd_cli_cmd hostapd_cl - { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin }, - { "wps_config", hostapd_cli_cmd_wps_config }, - { "wps_get_status", hostapd_cli_cmd_wps_get_status }, --#endif /* CONFIG_WPS */ - { "disassoc_imminent", hostapd_cli_cmd_disassoc_imminent }, - { "ess_disassoc", hostapd_cli_cmd_ess_disassoc }, - { "get_config", hostapd_cli_cmd_get_config }, diff --git a/package/network/services/hostapd/patches/471-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/471-wpa_cli_ifdef.patch deleted file mode 100644 index 36b5a441f9..0000000000 --- a/package/network/services/hostapd/patches/471-wpa_cli_ifdef.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/wpa_supplicant/wpa_cli.c -+++ b/wpa_supplicant/wpa_cli.c -@@ -26,6 +26,10 @@ - #endif /* ANDROID */ - - -+#ifndef CONFIG_P2P -+#define CONFIG_P2P -+#endif -+ - static const char *wpa_cli_version = - "wpa_cli v" VERSION_STR "\n" - "Copyright (c) 2004-2014, Jouni Malinen and contributors"; diff --git a/package/network/services/hostapd/patches/480-max_num_sta_probe.patch b/package/network/services/hostapd/patches/480-max_num_sta_probe.patch deleted file mode 100644 index e238bf4b8c..0000000000 --- a/package/network/services/hostapd/patches/480-max_num_sta_probe.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/src/ap/beacon.c -+++ b/src/ap/beacon.c -@@ -599,6 +599,10 @@ void handle_probe_req(struct hostapd_dat - return; - } - -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta) -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored," -+ " too many connected stations.", MAC2STR(mgmt->sa)); -+ - #ifdef CONFIG_INTERWORKING - if (hapd->conf->interworking && - elems.interworking && elems.interworking_len >= 1) { diff --git a/package/network/services/hostapd/patches/490-scan_wait.patch b/package/network/services/hostapd/patches/490-scan_wait.patch deleted file mode 100644 index 2c0f284567..0000000000 --- a/package/network/services/hostapd/patches/490-scan_wait.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -36,6 +36,8 @@ struct hapd_global { - }; - - static struct hapd_global global; -+static int daemonize = 0; -+static char *pid_file = NULL; - - - #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -141,6 +143,14 @@ static void hostapd_logger_cb(void *ctx, - } - #endif /* CONFIG_NO_HOSTAPD_LOGGER */ - -+static void hostapd_setup_complete_cb(void *ctx) -+{ -+ if (daemonize && os_daemonize(pid_file)) { -+ perror("daemon"); -+ return; -+ } -+ daemonize = 0; -+} - - /** - * hostapd_driver_init - Preparate driver interface -@@ -159,6 +169,8 @@ static int hostapd_driver_init(struct ho - return -1; - } - -+ hapd->setup_complete_cb = hostapd_setup_complete_cb; -+ - /* Initialize the driver interface */ - if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) - b = NULL; -@@ -372,8 +384,6 @@ static void hostapd_global_deinit(const - #endif /* CONFIG_NATIVE_WINDOWS */ - - eap_server_unregister_methods(); -- -- os_daemonize_terminate(pid_file); - } - - -@@ -399,11 +409,6 @@ static int hostapd_global_run(struct hap - } - #endif /* EAP_SERVER_TNC */ - -- if (daemonize && os_daemonize(pid_file)) { -- perror("daemon"); -- return -1; -- } -- - eloop_run(); - - return 0; -@@ -533,8 +538,7 @@ int main(int argc, char *argv[]) - struct hapd_interfaces interfaces; - int ret = 1; - size_t i, j; -- int c, debug = 0, daemonize = 0; -- char *pid_file = NULL; -+ int c, debug = 0; - const char *log_file = NULL; - const char *entropy_file = NULL; - char **bss_config = NULL, **tmp_bss; diff --git a/package/network/services/hostapd/patches/500-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/500-wpa_supplicant-add-new-config-params-to-be-used-with.patch deleted file mode 100644 index 9f4a5f5ec0..0000000000 --- a/package/network/services/hostapd/patches/500-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 4bb69d15477e0f2b00e166845341dc933de47c58 Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -Date: Sun, 3 Jun 2012 18:22:56 +0200 -Subject: [PATCHv2 601/602] wpa_supplicant: add new config params to be used - with the ibss join command - -Signed-hostap: Antonio Quartulli ---- - src/drivers/driver.h | 6 +++ - wpa_supplicant/config.c | 96 +++++++++++++++++++++++++++++++++++++++ - wpa_supplicant/config_ssid.h | 6 +++ - wpa_supplicant/wpa_supplicant.c | 23 +++++++--- - 4 files changed, 124 insertions(+), 7 deletions(-) - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -19,6 +19,7 @@ - - #define WPA_SUPPLICANT_DRIVER_VERSION 4 - -+#include "drivers/nl80211_copy.h" - #include "common/defs.h" - #include "utils/list.h" - -@@ -414,6 +415,11 @@ struct wpa_driver_associate_params { - * responsible for selecting with which BSS to associate. */ - const u8 *bssid; - -+ int beacon_interval; -+ int fixed_freq; -+ unsigned char rates[NL80211_MAX_SUPP_RATES]; -+ int mcast_rate; -+ - /** - * bssid_hint - BSSID of a proposed AP - * ---- a/wpa_supplicant/config.c -+++ b/wpa_supplicant/config.c -@@ -15,6 +15,7 @@ - #include "rsn_supp/wpa.h" - #include "eap_peer/eap.h" - #include "p2p/p2p.h" -+#include "drivers/nl80211_copy.h" - #include "config.h" - - -@@ -1527,6 +1528,97 @@ static char * wpa_config_write_psk_list( - - #endif /* CONFIG_P2P */ - -+static int wpa_config_parse_mcast_rate(const struct parse_data *data, -+ struct wpa_ssid *ssid, int line, -+ const char *value) -+{ -+ ssid->mcast_rate = (int)(strtod(value, NULL) * 10); -+ -+ return 0; -+} -+ -+#ifndef NO_CONFIG_WRITE -+static char * wpa_config_write_mcast_rate(const struct parse_data *data, -+ struct wpa_ssid *ssid) -+{ -+ char *value; -+ int res; -+ -+ if (!ssid->mcast_rate == 0) -+ return NULL; -+ -+ value = os_malloc(6); /* longest: 300.0 */ -+ if (value == NULL) -+ return NULL; -+ res = os_snprintf(value, 5, "%.1f", (double)ssid->mcast_rate / 10); -+ if (res < 0) { -+ os_free(value); -+ return NULL; -+ } -+ return value; -+} -+#endif /* NO_CONFIG_WRITE */ -+ -+static int wpa_config_parse_rates(const struct parse_data *data, -+ struct wpa_ssid *ssid, int line, -+ const char *value) -+{ -+ int i; -+ char *pos, *r, *sptr, *end; -+ double rate; -+ -+ pos = (char *)value; -+ r = strtok_r(pos, ",", &sptr); -+ i = 0; -+ while (pos && i < NL80211_MAX_SUPP_RATES) { -+ rate = 0.0; -+ if (r) -+ rate = strtod(r, &end); -+ ssid->rates[i] = rate * 2; -+ if (*end != '\0' || rate * 2 != ssid->rates[i]) -+ return 1; -+ -+ i++; -+ r = strtok_r(NULL, ",", &sptr); -+ } -+ -+ return 0; -+} -+ -+#ifndef NO_CONFIG_WRITE -+static char * wpa_config_write_rates(const struct parse_data *data, -+ struct wpa_ssid *ssid) -+{ -+ char *value, *pos; -+ int res, i; -+ -+ if (ssid->rates[0] <= 0) -+ return NULL; -+ -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); -+ if (value == NULL) -+ return NULL; -+ pos = value; -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) { -+ res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2); -+ if (res < 0) { -+ os_free(value); -+ return NULL; -+ } -+ pos += res; -+ } -+ res = os_snprintf(pos, 6, "%.1f", -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2); -+ if (res < 0) { -+ os_free(value); -+ return NULL; -+ } -+ -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; -+ return value; -+} -+#endif /* NO_CONFIG_WRITE */ -+ - /* Helper macros for network block parser */ - - #ifdef OFFSET -@@ -1733,6 +1825,9 @@ static const struct parse_data ssid_fiel - { INT(ap_max_inactivity) }, - { INT(dtim_period) }, - { INT(beacon_int) }, -+ { INT_RANGE(fixed_freq, 0, 1) }, -+ { FUNC(rates) }, -+ { FUNC(mcast_rate) }, - #ifdef CONFIG_MACSEC - { INT_RANGE(macsec_policy, 0, 1) }, - #endif /* CONFIG_MACSEC */ ---- a/wpa_supplicant/config_ssid.h -+++ b/wpa_supplicant/config_ssid.h -@@ -12,6 +12,7 @@ - #include "common/defs.h" - #include "utils/list.h" - #include "eap_peer/eap_config.h" -+#include "drivers/nl80211_copy.h" - - #define MAX_SSID_LEN 32 - -@@ -637,6 +638,10 @@ struct wpa_ssid { - */ - void *parent_cred; - -+ int fixed_freq; -+ unsigned char rates[NL80211_MAX_SUPP_RATES]; -+ double mcast_rate; -+ - #ifdef CONFIG_MACSEC - /** - * macsec_policy - Determines the policy for MACsec secure session ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -1806,6 +1806,13 @@ static void wpas_start_assoc_cb(struct w - params.beacon_int = ssid->beacon_int; - else - params.beacon_int = wpa_s->conf->beacon_int; -+ params.fixed_freq = ssid->fixed_freq; -+ i = 0; -+ while (i < NL80211_MAX_SUPP_RATES) { -+ params.rates[i] = ssid->rates[i]; -+ i++; -+ } -+ params.mcast_rate = ssid->mcast_rate; - } - - params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/501-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/501-driver_nl80211-use-new-parameters-during-ibss-join.patch deleted file mode 100644 index e7484d927c..0000000000 --- a/package/network/services/hostapd/patches/501-driver_nl80211-use-new-parameters-during-ibss-join.patch +++ /dev/null @@ -1,59 +0,0 @@ -From ffc4445958a3ed4064f2e1bf73fa478a61c5cf7b Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -Date: Sun, 3 Jun 2012 18:42:25 +0200 -Subject: [PATCHv2 602/602] driver_nl80211: use new parameters during ibss join - -Signed-hostap: Antonio Quartulli ---- - src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++- - 1 file changed, 32 insertions(+), 1 deletion(-) - ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -8581,7 +8581,7 @@ static int wpa_driver_nl80211_ibss(struc - struct wpa_driver_associate_params *params) - { - struct nl_msg *msg; -- int ret = -1; -+ int ret = -1, i; - int count = 0; - - wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex); -@@ -8620,6 +8620,37 @@ retry: - params->beacon_int); - } - -+ if (params->fixed_freq) { -+ wpa_printf(MSG_DEBUG, " * fixed_freq"); -+ NLA_PUT_FLAG(msg, NL80211_ATTR_FREQ_FIXED); -+ } -+ -+ if (params->beacon_interval > 0) { -+ wpa_printf(MSG_DEBUG, " * beacon_interval=%d", -+ params->beacon_interval); -+ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, -+ params->beacon_interval); -+ } -+ -+ if (params->rates[0] > 0) { -+ wpa_printf(MSG_DEBUG, " * basic_rates:"); -+ i = 0; -+ while (i < NL80211_MAX_SUPP_RATES && -+ params->rates[i] > 0) { -+ wpa_printf(MSG_DEBUG, " %.1f", -+ (double)params->rates[i] / 2); -+ i++; -+ } -+ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, i, -+ params->rates); -+ } -+ -+ if (params->mcast_rate > 0) { -+ wpa_printf(MSG_DEBUG, " * mcast_rates=%.1f", -+ (double)params->mcast_rate / 10); -+ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); -+ } -+ - ret = nl80211_set_conn_keys(params, msg); - if (ret) - goto nla_put_failure; diff --git a/package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch deleted file mode 100644 index b4c403453a..0000000000 --- a/package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch +++ /dev/null @@ -1,156 +0,0 @@ -From b9329c5dfeed7d5c55d2117d8dfe326fc40c8fb1 Mon Sep 17 00:00:00 2001 -From: Antonio Quartulli -Date: Tue, 3 Jul 2012 00:36:24 +0200 -Subject: [PATCH] wpa_s: support htmode param - -possible values are HT20, HT40-, HT40+ and NOHT - -Signed-off-by: Antonio Quartulli ---- - src/drivers/driver.h | 2 ++ - src/drivers/driver_nl80211.c | 16 ++++++++++ - wpa_supplicant/config.c | 66 +++++++++++++++++++++++++++++++++++++++ - wpa_supplicant/config_ssid.h | 2 ++ - wpa_supplicant/wpa_supplicant.c | 2 ++ - 5 files changed, 88 insertions(+) - ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -419,6 +419,8 @@ struct wpa_driver_associate_params { - int fixed_freq; - unsigned char rates[NL80211_MAX_SUPP_RATES]; - int mcast_rate; -+ int ht_set; -+ unsigned int htmode; - - /** - * bssid_hint - BSSID of a proposed AP ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -8651,6 +8651,22 @@ retry: - NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); - } - -+ if (params->ht_set) { -+ switch(params->htmode) { -+ case NL80211_CHAN_HT20: -+ wpa_printf(MSG_DEBUG, " * ht=HT20"); -+ break; -+ case NL80211_CHAN_HT40PLUS: -+ wpa_printf(MSG_DEBUG, " * ht=HT40+"); -+ break; -+ case NL80211_CHAN_HT40MINUS: -+ wpa_printf(MSG_DEBUG, " * ht=HT40-"); -+ break; -+ } -+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, -+ params->htmode); -+ } -+ - ret = nl80211_set_conn_keys(params, msg); - if (ret) - goto nla_put_failure; ---- a/wpa_supplicant/config.c -+++ b/wpa_supplicant/config.c -@@ -1559,6 +1559,71 @@ static char * wpa_config_write_mcast_rat - } - #endif /* NO_CONFIG_WRITE */ - -+static int wpa_config_parse_htmode(const struct parse_data *data, -+ struct wpa_ssid *ssid, int line, -+ const char *value) -+{ -+ int i; -+ static const struct { -+ const char *name; -+ unsigned int val; -+ } htmap[] = { -+ { .name = "HT20", .val = NL80211_CHAN_HT20, }, -+ { .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, }, -+ { .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, }, -+ { .name = "NOHT", .val = NL80211_CHAN_NO_HT, }, -+ }; -+ ssid->ht_set = 0;; -+ for (i = 0; i < 4; i++) { -+ if (strcasecmp(htmap[i].name, value) == 0) { -+ ssid->htmode = htmap[i].val; -+ ssid->ht_set = 1; -+ break; -+ } -+ } -+ -+ return 0; -+} -+ -+#ifndef NO_CONFIG_WRITE -+static char * wpa_config_write_htmode(const struct parse_data *data, -+ struct wpa_ssid *ssid) -+{ -+ char *value; -+ int res; -+ -+ value = os_malloc(6); /* longest: HT40+ */ -+ if (value == NULL) -+ return NULL; -+ -+ switch(ssid->htmode) { -+ case NL80211_CHAN_HT20: -+ res = os_snprintf(value, 4, "HT20"); -+ break; -+ case NL80211_CHAN_HT40PLUS: -+ res = os_snprintf(value, 5, "HT40+"); -+ break; -+ case NL80211_CHAN_HT40MINUS: -+ res = os_snprintf(value, 5, "HT40-"); -+ break; -+ case NL80211_CHAN_NO_HT: -+ res = os_snprintf(value, 4, "NOHT"); -+ break; -+ default: -+ os_free(value); -+ return NULL; -+ } -+ -+ if (res < 0) { -+ os_free(value); -+ return NULL; -+ } -+ -+ return value; -+} -+#endif /* NO_CONFIG_WRITE */ -+ -+ - static int wpa_config_parse_rates(const struct parse_data *data, - struct wpa_ssid *ssid, int line, - const char *value) -@@ -1828,6 +1893,7 @@ static const struct parse_data ssid_fiel - { INT_RANGE(fixed_freq, 0, 1) }, - { FUNC(rates) }, - { FUNC(mcast_rate) }, -+ { FUNC(htmode) }, - #ifdef CONFIG_MACSEC - { INT_RANGE(macsec_policy, 0, 1) }, - #endif /* CONFIG_MACSEC */ ---- a/wpa_supplicant/config_ssid.h -+++ b/wpa_supplicant/config_ssid.h -@@ -641,6 +641,8 @@ struct wpa_ssid { - int fixed_freq; - unsigned char rates[NL80211_MAX_SUPP_RATES]; - double mcast_rate; -+ int ht_set; -+ unsigned int htmode; - - #ifdef CONFIG_MACSEC - /** ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -1813,6 +1813,8 @@ static void wpas_start_assoc_cb(struct w - i++; - } - params.mcast_rate = ssid->mcast_rate; -+ params.ht_set = ssid->ht_set; -+ params.htmode = ssid->htmode; - } - - params.wpa_ie = wpa_ie; diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index e57c01f749..fcaddbc4ce 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -1,6 +1,6 @@ --- a/hostapd/Makefile +++ b/hostapd/Makefile -@@ -116,6 +116,11 @@ OBJS += ../src/common/wpa_common.o +@@ -117,6 +117,11 @@ OBJS += ../src/common/wpa_common.o OBJS += ../src/eapol_auth/eapol_auth_sm.o @@ -22,7 +22,7 @@ struct wpa_ctrl_dst; struct radius_server_data; -@@ -99,6 +100,7 @@ struct hostapd_data { +@@ -102,6 +103,7 @@ struct hostapd_data { struct hostapd_iface *iface; struct hostapd_config *iconf; struct hostapd_bss_config *conf; @@ -30,7 +30,7 @@ int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; -@@ -254,6 +256,8 @@ struct hostapd_iface { +@@ -275,6 +277,8 @@ struct hostapd_iface { struct hostapd_config *conf; char phy[16]; /* Name of the PHY (radio) */ @@ -533,7 +533,7 @@ +#endif --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -262,6 +262,7 @@ static void hostapd_free_hapd_data(struc +@@ -263,6 +263,7 @@ static void hostapd_free_hapd_data(struc hapd->started = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -541,7 +541,7 @@ iapp_deinit(hapd->iapp); hapd->iapp = NULL; accounting_deinit(hapd); -@@ -890,6 +891,8 @@ static int hostapd_setup_bss(struct host +@@ -907,6 +908,8 @@ static int hostapd_setup_bss(struct host if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -550,7 +550,7 @@ return 0; } -@@ -1180,6 +1183,7 @@ int hostapd_setup_interface_complete(str +@@ -1192,6 +1195,7 @@ int hostapd_setup_interface_complete(str if (err) goto fail; @@ -558,7 +558,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->conf->channel) { #ifdef NEED_AP_MLME -@@ -1297,6 +1301,7 @@ int hostapd_setup_interface_complete(str +@@ -1322,6 +1326,7 @@ int hostapd_setup_interface_complete(str fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -566,7 +566,7 @@ hostapd_set_state(iface, HAPD_IFACE_DISABLED); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); if (iface->interfaces && iface->interfaces->terminate_on_error) -@@ -1623,6 +1628,7 @@ void hostapd_interface_deinit_free(struc +@@ -1648,6 +1653,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -576,7 +576,7 @@ __func__, driver, drv_priv); --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -540,7 +540,8 @@ failed: +@@ -545,7 +545,8 @@ failed: static void handle_auth(struct hostapd_data *hapd, @@ -586,7 +586,7 @@ { u16 auth_alg, auth_transaction, status_code; u16 resp = WLAN_STATUS_SUCCESS; -@@ -555,6 +556,11 @@ static void handle_auth(struct hostapd_d +@@ -560,6 +561,11 @@ static void handle_auth(struct hostapd_d size_t resp_ies_len = 0; char *identity = NULL; char *radius_cui = NULL; @@ -598,7 +598,7 @@ if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) { wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)", -@@ -638,6 +644,14 @@ static void handle_auth(struct hostapd_d +@@ -643,6 +649,14 @@ static void handle_auth(struct hostapd_d resp = WLAN_STATUS_UNSPECIFIED_FAILURE; goto fail; } @@ -613,7 +613,7 @@ if (res == HOSTAPD_ACL_PENDING) { wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR " waiting for an external authentication", -@@ -1272,13 +1286,18 @@ static void send_assoc_resp(struct hosta +@@ -1289,13 +1303,18 @@ static void send_assoc_resp(struct hosta static void handle_assoc(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -633,7 +633,7 @@ if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : sizeof(mgmt->u.assoc_req))) { -@@ -1377,6 +1396,13 @@ static void handle_assoc(struct hostapd_ +@@ -1394,6 +1413,13 @@ static void handle_assoc(struct hostapd_ goto fail; } @@ -647,7 +647,7 @@ sta->capability = capab_info; sta->listen_interval = listen_interval; -@@ -1765,7 +1791,7 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -1785,7 +1811,7 @@ int ieee802_11_mgmt(struct hostapd_data if (stype == WLAN_FC_STYPE_PROBE_REQ) { @@ -656,7 +656,7 @@ return 1; } -@@ -1780,17 +1806,17 @@ int ieee802_11_mgmt(struct hostapd_data +@@ -1800,17 +1826,17 @@ int ieee802_11_mgmt(struct hostapd_data switch (stype) { case WLAN_FC_STYPE_AUTH: wpa_printf(MSG_DEBUG, "mgmt::auth"); @@ -679,7 +679,7 @@ case WLAN_FC_STYPE_DISASSOC: --- a/src/ap/beacon.c +++ b/src/ap/beacon.c -@@ -498,7 +498,7 @@ static enum ssid_match_result ssid_match +@@ -513,7 +513,7 @@ static enum ssid_match_result ssid_match void handle_probe_req(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -688,7 +688,7 @@ { u8 *resp; struct ieee802_11_elems elems; -@@ -506,8 +506,14 @@ void handle_probe_req(struct hostapd_dat +@@ -521,8 +521,14 @@ void handle_probe_req(struct hostapd_dat size_t ie_len; struct sta_info *sta = NULL; size_t i, resp_len; @@ -703,7 +703,7 @@ ie = mgmt->u.probe_req.variable; if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req)) -@@ -645,6 +651,12 @@ void handle_probe_req(struct hostapd_dat +@@ -660,6 +666,12 @@ void handle_probe_req(struct hostapd_dat } #endif /* CONFIG_P2P */