From f70a81976129e6cf5a1480d3000e26ff1deccf44 Mon Sep 17 00:00:00 2001 From: dongyou Date: Tue, 20 Oct 2020 16:26:12 +0800 Subject: [PATCH 1/6] WIFI: Iperf example's parameter opt was uninitialized, may leads setsockoption invalide if it equal to 0 --- examples/wifi/iperf/components/iperf/iperf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/wifi/iperf/components/iperf/iperf.c b/examples/wifi/iperf/components/iperf/iperf.c index 3e729d8f3d..5ee304671d 100644 --- a/examples/wifi/iperf/components/iperf/iperf.c +++ b/examples/wifi/iperf/components/iperf/iperf.c @@ -135,7 +135,7 @@ static esp_err_t IRAM_ATTR iperf_run_tcp_server(void) int listen_socket; struct timeval t; int sockfd; - int opt; + int opt = 1; listen_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listen_socket < 0) { @@ -206,7 +206,7 @@ static esp_err_t IRAM_ATTR iperf_run_udp_server(void) int want_recv = 0; uint8_t *buffer; int sockfd; - int opt; + int opt = 1; bool udp_recv_start = true ; sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -264,7 +264,7 @@ static esp_err_t iperf_run_udp_client(void) int want_send = 0; uint8_t *buffer; int sockfd; - int opt; + int opt = 1; int err; int id; From e6bc6951af00e1bcba1f5b5574ae8ba29972c912 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Frintrop Date: Sat, 25 Apr 2020 22:28:45 +0200 Subject: [PATCH 2/6] Fixed links to example directories for fast_scan and scan Signed-off-by: ronghulin https://github.com/espressif/esp-idf/pull/5186 --- examples/wifi/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/wifi/README.md b/examples/wifi/README.md index f08f410384..0aab2e2dc2 100644 --- a/examples/wifi/README.md +++ b/examples/wifi/README.md @@ -30,13 +30,13 @@ See the [README.md](./espnow/README.md) file in the project [espnow](./espnow/). Show how to use fast scan while connecting to an AP. -See the [README.md](./fast_scan/README.md) file in the project [espnow](./espnow/). +See the [README.md](./fast_scan/README.md) file in the project [fast_scan](./fast_scan/). ## scan Show how to scan for all the available APs. -See the [README.md](./scan/README.md) file in the project [espnow](./espnow/). +See the [README.md](./scan/README.md) file in the project [scan](./scan/). # More From d77991744f72ee559d010b6e1c5eaf2110b90ea3 Mon Sep 17 00:00:00 2001 From: ronghulin Date: Fri, 16 Oct 2020 11:47:35 +0800 Subject: [PATCH 3/6] fix TCP retransmission interval --- components/lwip/Kconfig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 7ad19499c9..0818c8dc84 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -333,6 +333,13 @@ menu "LWIP" change the memory usage of LWIP, except for preventing new listening TCP connections after the limit is reached. + config LWIP_TCP_HIGH_SPEED_RETRANSMISSION + bool "TCP high speed retransmissions" + default y + help + Speed up the TCP retransmission interval. If disabled, + it is recommended to change the number of SYN retransmissions to 6, + TCP timer interval to 250, and TCP rto time to 3000. config TCP_MAXRTX int "Maximum number of retransmissions of data segments" @@ -343,7 +350,8 @@ menu "LWIP" config TCP_SYNMAXRTX int "Maximum number of retransmissions of SYN segments" - default 6 + default 6 if !LWIP_TCP_HIGH_SPEED_RETRANSMISSION + default 12 if LWIP_TCP_HIGH_SPEED_RETRANSMISSION range 3 12 help Set maximum number of retransmissions of SYN segments. @@ -477,7 +485,8 @@ menu "LWIP" config LWIP_TCP_RTO_TIME int "Default TCP rto time" - default 3000 + default 3000 if !LWIP_TCP_HIGH_SPEED_RETRANSMISSION + default 1500 if LWIP_TCP_HIGH_SPEED_RETRANSMISSION help Set default TCP rto time for a reasonable initial rto. In bad network environment, recommend set value of rto time to 1500. From 6d82b0a749a3336c68f70acc0c4cb9390d1185a0 Mon Sep 17 00:00:00 2001 From: ronghulin Date: Thu, 29 Oct 2020 11:15:53 +0800 Subject: [PATCH 4/6] bugfix: fix TCP timer interval --- components/lwip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 0818c8dc84..7201b3faf6 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -339,7 +339,7 @@ menu "LWIP" help Speed up the TCP retransmission interval. If disabled, it is recommended to change the number of SYN retransmissions to 6, - TCP timer interval to 250, and TCP rto time to 3000. + and TCP initial rto time to 3000. config TCP_MAXRTX int "Maximum number of retransmissions of data segments" From b4b51f5a5eb698b75f461f129818a9df272673a8 Mon Sep 17 00:00:00 2001 From: "GOPTIONS\\pfrost" Date: Fri, 26 Jul 2019 15:56:40 +0100 Subject: [PATCH 5/6] Reduce log level of hexdumps to verbose Revert "Reduce log level of hexdumps to verbose" Add a menuconfig option to enable or disable the logging in wpa_supplicant Clarify help message --- components/wpa_supplicant/Kconfig | 11 +++++++ .../wpa_supplicant/include/wpa/wpa_debug.h | 32 ++++++++++--------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/components/wpa_supplicant/Kconfig b/components/wpa_supplicant/Kconfig index 21175c963a..b3ec10e289 100644 --- a/components/wpa_supplicant/Kconfig +++ b/components/wpa_supplicant/Kconfig @@ -18,4 +18,15 @@ menu "Supplicant" which will cause M2 validation fail, bypassing WPS-Config method validation. + config WPA_DEBUG_PRINT + bool "Print debug messages from WPA Supplicant" + default n + help + Select this option to print logging information from WPA supplicant, + this includes handshake information and key hex dumps depending + on the project logging level. + + Enabling this could increase the build size ~60kb + depending on the project logging level. + endmenu diff --git a/components/wpa_supplicant/include/wpa/wpa_debug.h b/components/wpa_supplicant/include/wpa/wpa_debug.h index 10fe928c3e..06037c6aed 100644 --- a/components/wpa_supplicant/include/wpa/wpa_debug.h +++ b/components/wpa_supplicant/include/wpa/wpa_debug.h @@ -47,6 +47,11 @@ void wpa_debug_close_file(void); */ void wpa_debug_print_timestamp(void); +#if CONFIG_WPA_DEBUG_PRINT +#define DEBUG_PRINT +#endif + +#ifdef DEBUG_PRINT /** * wpa_printf - conditional printf * @level: priority level (MSG_*) of the message @@ -58,8 +63,17 @@ void wpa_debug_print_timestamp(void); * * Note: New line '\n' is added to the end of the text when printing to stdout. */ -#define DEBUG_PRINT -#define MSG_PRINT + +#define wpa_printf(level,fmt, args...) ESP_LOG_LEVEL_LOCAL(level, TAG, fmt, ##args) + +static inline void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) +{ + +} + +static inline void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, size_t len) +{ +} /** * wpa_hexdump - conditional hex dump @@ -72,19 +86,6 @@ void wpa_debug_print_timestamp(void); * output may be directed to stdout, stderr, and/or syslog based on * configuration. The contents of buf is printed out has hex dump. */ -#ifdef DEBUG_PRINT -#define wpa_printf(level,fmt, args...) ESP_LOG_LEVEL_LOCAL(level, TAG, fmt, ##args) - -static inline void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len) -{ - -} - -static inline void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, size_t len) -{ -} - - void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len); static inline void wpa_hexdump_buf(int level, const char *title, @@ -150,6 +151,7 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, #else #define wpa_printf(level,fmt, args...) #define wpa_hexdump(...) +#define wpa_dump_mem(...) #define wpa_hexdump_buf(...) #define wpa_hexdump_key(...) #define wpa_hexdump_buf_key(...) From e456bfedd738cf3cbb280dcd086b4d95c6c41af9 Mon Sep 17 00:00:00 2001 From: Hrudaynath Dhabe Date: Thu, 30 Jan 2020 19:25:45 +0530 Subject: [PATCH 6/6] wpa_supplicant: Fix configurable debug log feature's warning issue --- .../wpa_supplicant/include/wpa/wpa_debug.h | 16 ++++++++-------- .../src/wpa2/eap_peer/eap_tls_common.c | 2 ++ .../wpa_supplicant/src/wps/wps_registrar.c | 12 ++++++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/components/wpa_supplicant/include/wpa/wpa_debug.h b/components/wpa_supplicant/include/wpa/wpa_debug.h index 06037c6aed..0b2f9dc55b 100644 --- a/components/wpa_supplicant/include/wpa/wpa_debug.h +++ b/components/wpa_supplicant/include/wpa/wpa_debug.h @@ -149,14 +149,14 @@ void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, size_t len); #else -#define wpa_printf(level,fmt, args...) -#define wpa_hexdump(...) -#define wpa_dump_mem(...) -#define wpa_hexdump_buf(...) -#define wpa_hexdump_key(...) -#define wpa_hexdump_buf_key(...) -#define wpa_hexdump_ascii(...) -#define wpa_hexdump_ascii_key(...) +#define wpa_printf(level,fmt, args...) do {} while(0) +#define wpa_hexdump(...) do {} while(0) +#define wpa_dump_mem(...) do {} while(0) +#define wpa_hexdump_buf(...) do {} while(0) +#define wpa_hexdump_key(...) do {} while(0) +#define wpa_hexdump_buf_key(...) do {} while(0) +#define wpa_hexdump_ascii(...) do {} while(0) +#define wpa_hexdump_ascii_key(...) do {} while(0) #endif #define wpa_auth_logger diff --git a/components/wpa_supplicant/src/wpa2/eap_peer/eap_tls_common.c b/components/wpa_supplicant/src/wpa2/eap_peer/eap_tls_common.c index 5766af8037..9bde1e90c3 100644 --- a/components/wpa_supplicant/src/wpa2/eap_peer/eap_tls_common.c +++ b/components/wpa_supplicant/src/wpa2/eap_peer/eap_tls_common.c @@ -1038,7 +1038,9 @@ get_defaults: int eap_peer_tls_phase2_nak(struct eap_method_type *types, size_t num_types, struct eap_hdr *hdr, struct wpabuf **resp) { +#ifdef DEBUG_PRINT u8 *pos = (u8 *) (hdr + 1); +#endif size_t i; /* TODO: add support for expanded Nak */ diff --git a/components/wpa_supplicant/src/wps/wps_registrar.c b/components/wpa_supplicant/src/wps/wps_registrar.c index 1efb3c88b6..c4a43ec329 100644 --- a/components/wpa_supplicant/src/wps/wps_registrar.c +++ b/components/wpa_supplicant/src/wps/wps_registrar.c @@ -2486,14 +2486,18 @@ static int wps_process_wps_state(struct wps_data *wps, const u8 *state) static int wps_process_assoc_state(struct wps_data *wps, const u8 *assoc) { - u16 a; +#ifdef DEBUG_PRINT + u16 a; +#endif if (assoc == NULL) { wpa_printf(MSG_DEBUG, "WPS: No Association State received"); return -1; } +#ifdef DEBUG_PRINT a = WPA_GET_BE16(assoc); +#endif wpa_printf(MSG_DEBUG, "WPS: Enrollee Association State %d", a); return 0; @@ -2502,14 +2506,18 @@ static int wps_process_assoc_state(struct wps_data *wps, const u8 *assoc) static int wps_process_config_error(struct wps_data *wps, const u8 *err) { - u16 e; +#ifdef DEBUG_PRINT + u16 e; +#endif if (err == NULL) { wpa_printf(MSG_DEBUG, "WPS: No Configuration Error received"); return -1; } +#ifdef DEBUG_PRINT e = WPA_GET_BE16(err); +#endif wpa_printf(MSG_DEBUG, "WPS: Enrollee Configuration Error %d", e); return 0;