diff --git a/package/network/services/hostapd/patches/004-hostapd-Add-possibility-to-send-debug-messages-to-sy.patch b/package/network/services/hostapd/patches/004-hostapd-Add-possibility-to-send-debug-messages-to-sy.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3417b5ac3c3f2e5fbea85ab2ab96302c84200676
--- /dev/null
+++ b/package/network/services/hostapd/patches/004-hostapd-Add-possibility-to-send-debug-messages-to-sy.patch
@@ -0,0 +1,145 @@
+From cc3dae85bd694506cdea66ae532d452fb8716297 Mon Sep 17 00:00:00 2001
+From: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
+Date: Mon, 23 Jan 2017 13:55:04 +0100
+Subject: [PATCH] hostapd: Add possibility to send debug messages to syslog
+
+We can only send module specific messages to syslog and not debug
+messages printed with wpa_printf. Add an extra command line parameter
+'-s' to allow it. The feature is enabled with compile flag
+CONFIG_DEBUG_SYSLOG as for wpa_supplicant and behaves in the same manner
+as the wpa_supplicant -s command line argument.
+
+Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
+---
+ hostapd/Android.mk    |  4 ++++
+ hostapd/Makefile      |  4 ++++
+ hostapd/defconfig     |  3 +++
+ hostapd/main.c        | 19 ++++++++++++++++++-
+ src/utils/wpa_debug.c |  2 +-
+ src/utils/wpa_debug.h |  3 +++
+ 6 files changed, 33 insertions(+), 2 deletions(-)
+
+--- a/hostapd/Android.mk
++++ b/hostapd/Android.mk
+@@ -952,6 +952,10 @@ ifdef CONFIG_NO_STDOUT_DEBUG
+ L_CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
+ endif
+ 
++ifdef CONFIG_DEBUG_SYSLOG
++L_CFLAGS += -DCONFIG_DEBUG_SYSLOG
++endif
++
+ ifdef CONFIG_DEBUG_LINUX_TRACING
+ L_CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
+ endif
+--- a/hostapd/Makefile
++++ b/hostapd/Makefile
+@@ -997,6 +997,10 @@ ifdef CONFIG_NO_STDOUT_DEBUG
+ CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
+ endif
+ 
++ifdef CONFIG_DEBUG_SYSLOG
++CFLAGS += -DCONFIG_DEBUG_SYSLOG
++endif
++
+ ifdef CONFIG_DEBUG_LINUX_TRACING
+ CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
+ endif
+--- a/hostapd/defconfig
++++ b/hostapd/defconfig
+@@ -166,6 +166,9 @@ CONFIG_IPV6=y
+ # Disabled by default.
+ #CONFIG_DEBUG_FILE=y
+ 
++# Send debug messages to syslog instead of stdout
++#CONFIG_DEBUG_SYSLOG=y
++
+ # Add support for sending all debug messages (regardless of debug verbosity)
+ # to the Linux kernel tracing facility. This helps debug the entire stack by
+ # making it easy to record everything happening from the driver up into the
+--- a/hostapd/main.c
++++ b/hostapd/main.c
+@@ -108,6 +108,10 @@ static void hostapd_logger_cb(void *ctx,
+ 			    module_str ? module_str : "",
+ 			    module_str ? ": " : "", txt);
+ 
++#ifdef CONFIG_DEBUG_SYSLOG
++	if (wpa_debug_syslog)
++		conf_stdout = 0;
++#endif /* CONFIG_DEBUG_SYSLOG */
+ 	if ((conf_stdout & module) && level >= conf_stdout_level) {
+ 		wpa_debug_print_timestamp();
+ 		wpa_printf(MSG_INFO, "%s", format);
+@@ -484,6 +488,9 @@ static void usage(void)
+ 		"        (records all messages regardless of debug verbosity)\n"
+ #endif /* CONFIG_DEBUG_LINUX_TRACING */
+ 		"   -i   list of interface names to use\n"
++#ifdef CONFIG_DEBUG_SYSLOG
++		"   -s   log output to syslog instead of stdout\n"
++#endif /* CONFIG_DEBUG_SYSLOG */
+ 		"   -S   start all the interfaces synchronously\n"
+ 		"   -t   include timestamps in some debug messages\n"
+ 		"   -v   show hostapd version\n");
+@@ -661,7 +668,7 @@ int main(int argc, char *argv[])
+ 	dl_list_init(&interfaces.global_ctrl_dst);
+ 
+ 	for (;;) {
+-		c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
++		c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
+ 		if (c < 0)
+ 			break;
+ 		switch (c) {
+@@ -718,6 +725,11 @@ int main(int argc, char *argv[])
+ 			bss_config = tmp_bss;
+ 			bss_config[num_bss_configs++] = optarg;
+ 			break;
++#ifdef CONFIG_DEBUG_SYSLOG
++		case 's':
++			wpa_debug_syslog = 1;
++			break;
++#endif /* CONFIG_DEBUG_SYSLOG */
+ 		case 'S':
+ 			start_ifaces_in_sync = 1;
+ 			break;
+@@ -746,6 +758,10 @@ int main(int argc, char *argv[])
+ 		wpa_debug_open_file(log_file);
+ 	else
+ 		wpa_debug_setup_stdout();
++#ifdef CONFIG_DEBUG_SYSLOG
++	if (wpa_debug_syslog)
++		wpa_debug_open_syslog();
++#endif /* CONFIG_DEBUG_SYSLOG */
+ #ifdef CONFIG_DEBUG_LINUX_TRACING
+ 	if (enable_trace_dbg) {
+ 		int tret = wpa_debug_open_linux_tracing();
+@@ -882,6 +898,7 @@ int main(int argc, char *argv[])
+ 	hostapd_global_deinit(pid_file, interfaces.eloop_initialized);
+ 	os_free(pid_file);
+ 
++	wpa_debug_close_syslog();
+ 	if (log_file)
+ 		wpa_debug_close_file();
+ 	wpa_debug_close_linux_tracing();
+--- a/src/utils/wpa_debug.c
++++ b/src/utils/wpa_debug.c
+@@ -13,7 +13,7 @@
+ #ifdef CONFIG_DEBUG_SYSLOG
+ #include <syslog.h>
+ 
+-static int wpa_debug_syslog = 0;
++int wpa_debug_syslog = 0;
+ #endif /* CONFIG_DEBUG_SYSLOG */
+ 
+ #ifdef CONFIG_DEBUG_LINUX_TRACING
+--- a/src/utils/wpa_debug.h
++++ b/src/utils/wpa_debug.h
+@@ -14,6 +14,9 @@
+ extern int wpa_debug_level;
+ extern int wpa_debug_show_keys;
+ extern int wpa_debug_timestamp;
++#ifdef CONFIG_DEBUG_SYSLOG
++extern int wpa_debug_syslog;
++#endif /* CONFIG_DEBUG_SYSLOG */
+ 
+ /* Debugging function - conditional printf and hex dump. Driver wrappers can
+  * use these for debugging purposes. */
diff --git a/package/network/services/hostapd/patches/100-daemonize_fix.patch b/package/network/services/hostapd/patches/100-daemonize_fix.patch
index 0389406a98a11a9eb4d5df64a30896e57dea103b..fad84669a6b646d39d18d0381c0d98b7e1fd1e76 100644
--- a/package/network/services/hostapd/patches/100-daemonize_fix.patch
+++ b/package/network/services/hostapd/patches/100-daemonize_fix.patch
@@ -60,13 +60,13 @@
 +	if (chdir("/") < 0)
  		return -1;
 -	}
- 
+-
 -	return 0;
 -}
 -#else /* __APPLE__ */
 -#define os_daemon daemon
 -#endif /* __APPLE__ */
--
+ 
 -
 -int os_daemonize(const char *pid_file)
 -{
diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
index 9ea3ef9c2d22e013abfef47a38b1d3c6ceadf561..f0348201ffad25669147ac60dea3490d62d24fd1 100644
--- a/package/network/services/hostapd/patches/200-multicall.patch
+++ b/package/network/services/hostapd/patches/200-multicall.patch
@@ -36,7 +36,7 @@
  LIBS += $(DRV_AP_LIBS)
  
  ifdef CONFIG_L2_PACKET
-@@ -1073,6 +1079,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
+@@ -1077,6 +1083,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  
  BCHECK=../src/drivers/build.hostapd
  
@@ -49,7 +49,7 @@
  hostapd: $(BCHECK) $(OBJS)
  	$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  	@$(E) "  LD " $@
-@@ -1114,6 +1126,12 @@ HOBJS += ../src/crypto/aes-internal.o
+@@ -1118,6 +1130,12 @@ HOBJS += ../src/crypto/aes-internal.o
  HOBJS += ../src/crypto/aes-internal-enc.o
  endif
  
@@ -293,7 +293,7 @@
  		wpa_debug_open_file(params->wpa_debug_file_path);
 --- a/hostapd/main.c
 +++ b/hostapd/main.c
-@@ -583,6 +583,11 @@ fail:
+@@ -590,6 +590,11 @@ fail:
  	return -1;
  }
  
@@ -305,14 +305,14 @@
  
  #ifdef CONFIG_WPS
  static int gen_uuid(const char *txt_addr)
-@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
+@@ -667,6 +672,8 @@ int main(int argc, char *argv[])
  	interfaces.global_ctrl_sock = -1;
  	dl_list_init(&interfaces.global_ctrl_dst);
  
 +	wpa_supplicant_event = hostapd_wpa_event;
 +	wpa_supplicant_event_global = hostapd_wpa_event_global;
  	for (;;) {
- 		c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
+ 		c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
  		if (c < 0)
 --- a/src/drivers/drivers.c
 +++ b/src/drivers/drivers.c
diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
index a48b6962ee3e420f4abc79e772b9bcb049559dee..b7dbbd0dc7e29c63347075657794080a65ede06d 100644
--- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
+++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
@@ -84,7 +84,7 @@
  	char *buf;
 --- a/src/utils/wpa_debug.h
 +++ b/src/utils/wpa_debug.h
-@@ -49,6 +49,17 @@ int wpa_debug_reopen_file(void);
+@@ -52,6 +52,17 @@ int wpa_debug_reopen_file(void);
  void wpa_debug_close_file(void);
  void wpa_debug_setup_stdout(void);
  
@@ -102,7 +102,7 @@
  /**
   * wpa_debug_printf_timestamp - Print timestamp for debug output
   *
-@@ -69,9 +80,15 @@ void wpa_debug_print_timestamp(void);
+@@ -72,9 +83,15 @@ void wpa_debug_print_timestamp(void);
   *
   * Note: New line '\n' is added to the end of the text when printing to stdout.
   */
@@ -119,7 +119,7 @@
  /**
   * wpa_hexdump - conditional hex dump
   * @level: priority level (MSG_*) of the message
-@@ -83,7 +100,13 @@ PRINTF_FORMAT(2, 3);
+@@ -86,7 +103,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.
   */
@@ -134,7 +134,7 @@
  
  static inline void wpa_hexdump_buf(int level, const char *title,
  				   const struct wpabuf *buf)
-@@ -105,7 +128,13 @@ static inline void wpa_hexdump_buf(int l
+@@ -108,7 +131,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.
   */
@@ -149,7 +149,7 @@
  
  static inline void wpa_hexdump_buf_key(int level, const char *title,
  				       const struct wpabuf *buf)
-@@ -127,8 +156,14 @@ static inline void wpa_hexdump_buf_key(i
+@@ -130,8 +159,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.
   */
@@ -166,7 +166,7 @@
  
  /**
   * wpa_hexdump_ascii_key - conditional hex dump, hide keys
-@@ -144,8 +179,14 @@ void wpa_hexdump_ascii(int level, const
+@@ -147,8 +182,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
-@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
+@@ -185,7 +226,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
-@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
+@@ -199,8 +245,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-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
index 8abeafcaceaff21c38cf3dc067ecd63d32a719f7..ac699f4e495d43eaec7ef6503706ca483c4ce9e7 100644
--- a/package/network/services/hostapd/patches/420-indicate-features.patch
+++ b/package/network/services/hostapd/patches/420-indicate-features.patch
@@ -8,16 +8,16 @@
  #include "crypto/random.h"
  #include "crypto/tls.h"
  #include "common/version.h"
-@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
+@@ -675,7 +676,7 @@ int main(int argc, char *argv[])
  	wpa_supplicant_event = hostapd_wpa_event;
  	wpa_supplicant_event_global = hostapd_wpa_event_global;
  	for (;;) {
--		c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
-+		c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
+-		c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
++		c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:v::");
  		if (c < 0)
  			break;
  		switch (c) {
-@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
+@@ -712,6 +713,8 @@ int main(int argc, char *argv[])
  			break;
  #endif /* CONFIG_DEBUG_LINUX_TRACING */
  		case 'v':
diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
index 78cf3064fa6fbf5abf89d5c7388e8a99e8ba988e..463a36291114f760ad9f53f4ff8ab35be4beb774 100644
--- a/package/network/services/hostapd/patches/450-scan_wait.patch
+++ b/package/network/services/hostapd/patches/450-scan_wait.patch
@@ -9,7 +9,7 @@
  
  
  #ifndef CONFIG_NO_HOSTAPD_LOGGER
-@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
+@@ -147,6 +149,14 @@ static void hostapd_logger_cb(void *ctx,
  }
  #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  
@@ -24,7 +24,7 @@
  
  /**
   * hostapd_driver_init - Preparate driver interface
-@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
+@@ -165,6 +175,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;
-@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
+@@ -405,8 +417,6 @@ static void hostapd_global_deinit(const
  #endif /* CONFIG_NATIVE_WINDOWS */
  
  	eap_server_unregister_methods();
@@ -42,7 +42,7 @@
  }
  
  
-@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
+@@ -432,18 +442,6 @@ static int hostapd_global_run(struct hap
  	}
  #endif /* EAP_SERVER_TNC */
  
@@ -61,7 +61,7 @@
  	eloop_run();
  
  	return 0;
-@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
+@@ -645,8 +643,7 @@ int main(int argc, char *argv[])
  	struct hapd_interfaces interfaces;
  	int ret = 1;
  	size_t i, j;