diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 47d808995ec209293c56f96339406f0f62d77763..116fbf5c8a193bbcd8d5048330b2a1ec2e63c223 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 76a3968857fe13326d915c7fa7321dd36434f10a..0000000000000000000000000000000000000000
--- 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 <j@w1.fi>
-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 <j@w1.fi>
----
---- 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 c1db0464106c3b838b67ccf06c1a546290161e2a..0000000000000000000000000000000000000000
--- 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 <jouni@qca.qualcomm.com>
-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 <jouni@qca.qualcomm.com>
----
- 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 <time.h>
-+#include <sys/wait.h>
- 
- #ifdef ANDROID
- #include <sys/capability.h>
-@@ -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 7fe44bf907e8de395b771bc36fc07aa619cdc086..0000000000000000000000000000000000000000
--- 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 <jouni@qca.qualcomm.com>
-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 <jouni@qca.qualcomm.com>
----
- 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 4f08ee517505dcb568fc48418653175d9b6a56c8..0000000000000000000000000000000000000000
--- 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 <jouni@qca.qualcomm.com>
-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 <jouni@qca.qualcomm.com>
----
- 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 1ad84bf4054dd2d0167b3638e265cb6e7076a03a..9cab8abdb1262463887c8836b78440a200925d10 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 032e2072a35770628f96831ab3b6c4bbebdb7cf2..54ace76793d83604523c4bbd4adcf0a73f20edc8 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 <sys/capability.h>
-@@ -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 efe151c3a3cc44fa6cd729047b29b7127d2db826..23180b924afb3a177ab18d8241fb9d885b2c65bd 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 ac296b8e38f7543a35d7e0e62044f592f75d916c..9910f89b7ba8d9e8515e14a0416f63d3b5ac4ba0 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 dac0f6e4e6c5b37a6590065f680958b6c481085f..878b61a6554121b8dbe6a3681c248bb9f06d0472 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 3808f9bcb68a3b69892afc1c2ff269c2e2abeb4e..5cf80e52d515841bd998d4f7c58a43205714e0bd 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 dbc9ef8ef5a686c1051082dd53489c52eba7415d..097f5c8383560b6309cc47e934770416e8f432c5 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 d3e8918d710dee2ab570f3ad5e36891e425e3e3f..72ff21cc617e2e15e7fa9ec3645fbbf0084d4e76 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 e6f6cf3b5d62c018821bcc8c7ad035bb69355a22..46f0a2531cb679271f4987479fe07585ea7b38a8 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 e69c3d38b6afdba91e7c183c9bfc9f4c07c8c2f3..f5557fd8ed5f2e0ada7be8cf5c926cdde60983b6 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 4b1f2abd47002e18d4aa26cb7231af362225d9dd..2f2c2d605478525d2dc8a5095293a3209220716d 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 8c4e9bdcc481bb35ba8a196d9b1f075a9164231f..ef4f961bfcdf8f682d533caad8e69332403ceef4 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 40148fc60e5d80074beea4d28368d91940f79d8d..21f6ec0208f5e34cafffaa75c460d63429e8ac17 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/430-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
similarity index 100%
rename from package/network/services/hostapd/patches/430-wps_single_auth_enc_type.patch
rename to package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
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 165484b5533a39754f7140f4b7977c081bd83e07..0000000000000000000000000000000000000000
--- 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/450-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
similarity index 95%
rename from package/network/services/hostapd/patches/450-limit_debug_messages.patch
rename to package/network/services/hostapd/patches/410-limit_debug_messages.patch
index 7030ef2bc722218a29945dcd01c3cfd6dbebd236..4643140ebae17f43d1265a6c0468f0c1762490b7 100644
--- a/package/network/services/hostapd/patches/450-limit_debug_messages.patch
+++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
@@ -64,7 +64,7 @@
  #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_
+@@ -594,7 +568,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  }
  
  
@@ -73,7 +73,7 @@
  {
  	va_list ap;
  	char *buf;
-@@ -630,7 +604,7 @@ void wpa_msg(void *ctx, int level, const
+@@ -632,7 +606,7 @@ void wpa_msg(void *ctx, int level, const
  }
  
  
@@ -166,7 +166,7 @@
  
  /**
   * wpa_hexdump_ascii_key - conditional hex dump, hide keys
-@@ -142,8 +177,14 @@ void wpa_hexdump_ascii(int level, const
+@@ -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.
   */
@@ -183,7 +183,7 @@
  
  /*
   * 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
+@@ -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.
   */
@@ -197,7 +197,7 @@
  
  /**
   * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
-@@ -192,8 +238,13 @@ void wpa_msg(void *ctx, int level, const
+@@ -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.
   */
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 31995c43fe6bdee6ff124d6f60b4e5c13544198d..0000000000000000000000000000000000000000
--- 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/460-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
similarity index 94%
rename from package/network/services/hostapd/patches/460-indicate-features.patch
rename to package/network/services/hostapd/patches/420-indicate-features.patch
index cee3e7677763201325b2bcf6be58ba97b4aae7fc..b20947ee87f167afb44914142bf47778d3fc7508 100644
--- a/package/network/services/hostapd/patches/460-indicate-features.patch
+++ b/package/network/services/hostapd/patches/420-indicate-features.patch
@@ -8,7 +8,7 @@
  #include "crypto/random.h"
  #include "crypto/tls.h"
  #include "common/version.h"
-@@ -558,7 +559,7 @@ int main(int argc, char *argv[])
+@@ -560,7 +561,7 @@ int main(int argc, char *argv[])
  
  	wpa_supplicant_event = hostapd_wpa_event;
  	for (;;) {
@@ -17,7 +17,7 @@
  		if (c < 0)
  			break;
  		switch (c) {
-@@ -595,6 +596,8 @@ int main(int argc, char *argv[])
+@@ -597,6 +598,8 @@ int main(int argc, char *argv[])
  			break;
  #endif /* CONFIG_DEBUG_LINUX_TRACING */
  		case 'v':
diff --git a/package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
similarity index 93%
rename from package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch
rename to package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
index 7d670919f5578ab43163f21da8cac38fdeb974da..1cf3fee86204dd36f627a4bd2745cf59fb00905d 100644
--- a/package/network/services/hostapd/patches/470-hostapd_cli_ifdef.patch
+++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
@@ -32,7 +32,7 @@
  
  
  static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
-@@ -970,7 +966,6 @@ static struct hostapd_cli_cmd hostapd_cl
+@@ -993,7 +989,6 @@ static struct hostapd_cli_cmd hostapd_cl
  #ifdef CONFIG_IEEE80211W
  	{ "sa_query", hostapd_cli_cmd_sa_query },
  #endif /* CONFIG_IEEE80211W */
@@ -40,7 +40,7 @@
  	{ "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
+@@ -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 },
diff --git a/package/network/services/hostapd/patches/471-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
similarity index 100%
rename from package/network/services/hostapd/patches/471-wpa_cli_ifdef.patch
rename to package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
diff --git a/package/network/services/hostapd/patches/480-max_num_sta_probe.patch b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
similarity index 85%
rename from package/network/services/hostapd/patches/480-max_num_sta_probe.patch
rename to package/network/services/hostapd/patches/440-max_num_sta_probe.patch
index e238bf4b8c3bf116f2d09d795a5d9e113b885081..059a2d3522a6db3e27474c9da85eec534869d6b9 100644
--- a/package/network/services/hostapd/patches/480-max_num_sta_probe.patch
+++ b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
@@ -1,6 +1,6 @@
 --- a/src/ap/beacon.c
 +++ b/src/ap/beacon.c
-@@ -599,6 +599,10 @@ void handle_probe_req(struct hostapd_dat
+@@ -614,6 +614,10 @@ void handle_probe_req(struct hostapd_dat
  		return;
  	}
  
diff --git a/package/network/services/hostapd/patches/490-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
similarity index 79%
rename from package/network/services/hostapd/patches/490-scan_wait.patch
rename to package/network/services/hostapd/patches/450-scan_wait.patch
index 2c0f284567e614531ec29b6181df92bb84cb83c7..629786d9c6e008755dd62d7605c525e35632ca05 100644
--- a/package/network/services/hostapd/patches/490-scan_wait.patch
+++ b/package/network/services/hostapd/patches/450-scan_wait.patch
@@ -9,7 +9,7 @@
  
  
  #ifndef CONFIG_NO_HOSTAPD_LOGGER
-@@ -141,6 +143,14 @@ static void hostapd_logger_cb(void *ctx,
+@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  }
  #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  
@@ -24,7 +24,7 @@
  
  /**
   * hostapd_driver_init - Preparate driver interface
-@@ -159,6 +169,8 @@ static int hostapd_driver_init(struct ho
+@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  		return -1;
  	}
  
@@ -33,7 +33,7 @@
  	/* 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
+@@ -374,8 +386,6 @@ static void hostapd_global_deinit(const 
  #endif /* CONFIG_NATIVE_WINDOWS */
  
  	eap_server_unregister_methods();
@@ -42,7 +42,7 @@
  }
  
  
-@@ -399,11 +409,6 @@ static int hostapd_global_run(struct hap
+@@ -401,11 +411,6 @@ static int hostapd_global_run(struct hap
  	}
  #endif /* EAP_SERVER_TNC */
  
@@ -54,7 +54,7 @@
  	eloop_run();
  
  	return 0;
-@@ -533,8 +538,7 @@ int main(int argc, char *argv[])
+@@ -535,8 +540,7 @@ int main(int argc, char *argv[])
  	struct hapd_interfaces interfaces;
  	int ret = 1;
  	size_t i, j;
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/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
similarity index 93%
rename from package/network/services/hostapd/patches/500-wpa_supplicant-add-new-config-params-to-be-used-with.patch
rename to package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
index 9f4a5f5ec00b0eff4225acdbf7ced964522ccab6..2dad2738f0235567d7170259f79761b7312ac1cf 100644
--- a/package/network/services/hostapd/patches/500-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
@@ -22,7 +22,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  #include "common/defs.h"
  #include "utils/list.h"
  
-@@ -414,6 +415,11 @@ struct wpa_driver_associate_params {
+@@ -442,6 +443,11 @@ struct wpa_driver_associate_params {
  	 * responsible for selecting with which BSS to associate. */
  	const u8 *bssid;
  
@@ -44,7 +44,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  #include "config.h"
  
  
-@@ -1527,6 +1528,97 @@ static char * wpa_config_write_psk_list(
+@@ -1576,6 +1577,97 @@ static char * wpa_config_write_psk_list(
  
  #endif /* CONFIG_P2P */
  
@@ -142,7 +142,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  /* Helper macros for network block parser */
  
  #ifdef OFFSET
-@@ -1733,6 +1825,9 @@ static const struct parse_data ssid_fiel
+@@ -1788,6 +1880,9 @@ static const struct parse_data ssid_fiel
  	{ INT(ap_max_inactivity) },
  	{ INT(dtim_period) },
  	{ INT(beacon_int) },
@@ -162,7 +162,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  
  #define MAX_SSID_LEN 32
  
-@@ -637,6 +638,10 @@ struct wpa_ssid {
+@@ -640,6 +641,10 @@ struct wpa_ssid {
  	 */
  	void *parent_cred;
  
@@ -175,7 +175,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  	 * 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
+@@ -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;
diff --git a/package/network/services/hostapd/patches/501-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
similarity index 94%
rename from package/network/services/hostapd/patches/501-driver_nl80211-use-new-parameters-during-ibss-join.patch
rename to package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
index e7484d927cd97d01b2376baeea91dc500a71b0d3..46a0ef162e1e709de24a58340cb2456d28e0c4ac 100644
--- a/package/network/services/hostapd/patches/501-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
@@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
 
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -8581,7 +8581,7 @@ static int wpa_driver_nl80211_ibss(struc
+@@ -9023,7 +9023,7 @@ static int wpa_driver_nl80211_ibss(struc
  				   struct wpa_driver_associate_params *params)
  {
  	struct nl_msg *msg;
@@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  	int count = 0;
  
  	wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
-@@ -8620,6 +8620,37 @@ retry:
+@@ -9069,6 +9069,37 @@ retry:
  			    params->beacon_int);
  	}
  
diff --git a/package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
similarity index 92%
rename from package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch
rename to package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
index b4c403453acdfe12b497130815847b22e546e3d3..543e2a6193b9f63f280a1f12a21c29dd74b7f247 100644
--- a/package/network/services/hostapd/patches/502-wpa_s-support-htmode-param.patch
+++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
@@ -16,7 +16,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
 
 --- a/src/drivers/driver.h
 +++ b/src/drivers/driver.h
-@@ -419,6 +419,8 @@ struct wpa_driver_associate_params {
+@@ -447,6 +447,8 @@ struct wpa_driver_associate_params {
  	int fixed_freq;
  	unsigned char rates[NL80211_MAX_SUPP_RATES];
  	int mcast_rate;
@@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  	 * bssid_hint - BSSID of a proposed AP
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -8651,6 +8651,22 @@ retry:
+@@ -9100,6 +9100,22 @@ retry:
  		NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  	}
  
@@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  		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
+@@ -1608,6 +1608,71 @@ static char * wpa_config_write_mcast_rat
  }
  #endif /* NO_CONFIG_WRITE */
  
@@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  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
+@@ -1883,6 +1948,7 @@ static const struct parse_data ssid_fiel
  	{ INT_RANGE(fixed_freq, 0, 1) },
  	{ FUNC(rates) },
  	{ FUNC(mcast_rate) },
@@ -134,7 +134,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  #endif /* CONFIG_MACSEC */
 --- a/wpa_supplicant/config_ssid.h
 +++ b/wpa_supplicant/config_ssid.h
-@@ -641,6 +641,8 @@ struct wpa_ssid {
+@@ -644,6 +644,8 @@ struct wpa_ssid {
  	int fixed_freq;
  	unsigned char rates[NL80211_MAX_SUPP_RATES];
  	double mcast_rate;
@@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  	/**
 --- a/wpa_supplicant/wpa_supplicant.c
 +++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1813,6 +1813,8 @@ static void wpas_start_assoc_cb(struct w
+@@ -1956,6 +1956,8 @@ static void wpas_start_assoc_cb(struct w
  			i++;
  		}
  		params.mcast_rate = ssid->mcast_rate;
diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
index e57c01f749f0184c35c0c0b4a6979936a93027ce..fcaddbc4cef98353aa8fe178d75b51c4ecabeab6 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 */