From 5d91a27a1eed9f3b4602e0874b7b216750f6cdd9 Mon Sep 17 00:00:00 2001 From: ryan kurte Date: Tue, 1 Dec 2020 13:09:38 +1300 Subject: [PATCH 1/2] lwip: Added KConfig option to control checksum validation on IP/UDP/ICMP This maintains the current default, but could be swapped if desired Merges https://github.com/espressif/esp-idf/pull/6187 --- components/lwip/Kconfig | 22 +++++++++++++++++++ components/lwip/port/esp32/include/lwipopts.h | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 41d9ea6f97..bf07b1f580 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -559,6 +559,28 @@ menu "LWIP" endmenu # UDP + menu "Checksums" + + config LWIP_CHECKSUM_CHECK_IP + bool "Enable LWIP IP checksums" + default n + help + Enable checksum checking for received IP messages + + config LWIP_CHECKSUM_CHECK_UDP + bool "Enable LWIP UDP checksums" + default n + help + Enable checksum checking for received UDP messages + + config LWIP_CHECKSUM_CHECK_ICMP + bool "Enable LWIP ICMP checksums" + default y + help + Enable checksum checking for received ICMP messages + + endmenu # Checksums + config LWIP_TCPIP_TASK_STACK_SIZE int "TCP/IP Task Stack Size" default 3072 diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index 7d2a4c4868..e66c5fe446 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -968,8 +968,9 @@ #define LWIP_DEBUG LWIP_DBG_OFF #define TCP_DEBUG LWIP_DBG_OFF -#define CHECKSUM_CHECK_UDP 0 -#define CHECKSUM_CHECK_IP 0 +#define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP +#define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP +#define CHECKSUM_CHECK_ICMP CONFIG_LWIP_CHECKSUM_CHECK_ICMP #define LWIP_NETCONN_FULLDUPLEX 1 #define LWIP_NETCONN_SEM_PER_THREAD 1 From 85083ddc3dffae4202a4de6801b5db0cf09e95ee Mon Sep 17 00:00:00 2001 From: ryan kurte Date: Tue, 1 Dec 2020 15:33:01 +1300 Subject: [PATCH 2/2] lwip: Added debug config options for DHCP and TCP --- components/lwip/Kconfig | 8 +++++++ components/lwip/port/esp32/include/lwipopts.h | 24 +++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index bf07b1f580..21b18bf323 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -859,6 +859,10 @@ menu "LWIP" bool "Enable ICMP debug messages" default n + config LWIP_DHCP_DEBUG + bool "Enable DHCP debug messages" + default n + config LWIP_IP6_DEBUG bool "Enable IP6 debug messages" default n @@ -867,5 +871,9 @@ menu "LWIP" bool "Enable ICMP6 debug messages" default n + config LWIP_TCP_DEBUG + bool "Enable TCP debug messages" + default n + endmenu #debug endmenu diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index e66c5fe446..3480ef0cbd 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -837,6 +837,15 @@ #define ICMP6_DEBUG LWIP_DBG_OFF #endif +/** + * DHCP_DEBUG: Enable debugging in dhcp.c. + */ +#ifdef CONFIG_LWIP_DHCP_DEBUG +#define DHCP_DEBUG LWIP_DBG_ON +#else +#define DHCP_DEBUG LWIP_DBG_OFF +#endif + /** * IP_DEBUG: Enable debugging for IP. */ @@ -847,7 +856,7 @@ #endif /** - * IP_DEBUG: Enable debugging for IP. + * IP6_DEBUG: Enable debugging for IP6. */ #ifdef CONFIG_LWIP_IP6_DEBUG #define IP6_DEBUG LWIP_DBG_ON @@ -855,6 +864,15 @@ #define IP6_DEBUG LWIP_DBG_OFF #endif +/** + * TCP_DEBUG: Enable debugging for TCP. + */ +#ifdef CONFIG_LWIP_TCP_DEBUG +#define TCP_DEBUG LWIP_DBG_ON +#else +#define TCP_DEBUG LWIP_DBG_OFF +#endif + /** * MEMP_DEBUG: Enable debugging in memp.c. */ @@ -962,11 +980,9 @@ #define TCP_WND CONFIG_LWIP_TCP_WND_DEFAULT /** - * DHCP_DEBUG: Enable debugging in dhcp.c. + * LWIP_DEBUG: Enable lwip debugging in other modules. */ -#define DHCP_DEBUG LWIP_DBG_OFF #define LWIP_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF #define CHECKSUM_CHECK_UDP CONFIG_LWIP_CHECKSUM_CHECK_UDP #define CHECKSUM_CHECK_IP CONFIG_LWIP_CHECKSUM_CHECK_IP