diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 7ad19499c9..7201b3faf6 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, + and TCP initial 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. 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..0b2f9dc55b 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, @@ -148,13 +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_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; 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 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;