From 8767aa7a4f92b490807cd72dfe0103bada858716 Mon Sep 17 00:00:00 2001 From: liuhan Date: Thu, 15 Apr 2021 20:48:52 +0800 Subject: [PATCH] lwip: Add CONFIG_LWIP_ICMP and CONFIG_LWIP_ICMP6 to sperate the code --- components/lwip/CMakeLists.txt | 10 +++++++--- components/lwip/Kconfig | 10 +++++++++- components/lwip/component.mk | 4 ++++ components/lwip/port/esp32/include/lwipopts.h | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index 8c59a8b6e0..1d0646e161 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -7,9 +7,6 @@ set(include_dirs ) set(srcs - "apps/ping/esp_ping.c" - "apps/ping/ping.c" - "apps/ping/ping_sock.c" "apps/sntp/sntp.c" "lwip/src/api/api_lib.c" "lwip/src/api/api_msg.c" @@ -140,6 +137,13 @@ if(CONFIG_LWIP_DHCPS) list(APPEND srcs "apps/dhcpserver/dhcpserver.c") endif() +if(CONFIG_LWIP_ICMP) + list(APPEND srcs + "apps/ping/esp_ping.c" + "apps/ping/ping.c" + "apps/ping/ping_sock.c") +endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" LDFRAGMENTS linker.lf diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 6f3914874a..5ba4b4ca47 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -741,13 +741,21 @@ menu "LWIP" menu "ICMP" + config LWIP_ICMP + bool "ICMP: Enable ICMP" + default y + help + Enable ICMP module for check network stability + config LWIP_MULTICAST_PING bool "Respond to multicast pings" default n + depends on LWIP_ICMP6 || LWIP_ICMP config LWIP_BROADCAST_PING bool "Respond to broadcast pings" default n + depends on LWIP_ICMP endmenu # ICMP @@ -902,7 +910,7 @@ menu "LWIP" config LWIP_ICMP_DEBUG bool "Enable ICMP debug messages" - depends on LWIP_DEBUG + depends on LWIP_DEBUG && LWIP_ICMP default n config LWIP_DHCP_STATE_DEBUG diff --git a/components/lwip/component.mk b/components/lwip/component.mk index 04a5dcdaa7..ee3f80d824 100644 --- a/components/lwip/component.mk +++ b/components/lwip/component.mk @@ -36,6 +36,10 @@ else COMPONENT_OBJEXCLUDE += port/esp32/no_vfs_syscalls.o endif +ifndef CONFIG_LWIP_ICMP + COMPONENT_OBJEXCLUDE += apps/ping/esp_ping.o apps/ping/ping.o apps/ping/ping_sock.o +endif + ifdef CONFIG_LWIP_PPP_SUPPORT COMPONENT_SRCDIRS += lwip/src/netif/ppp lwip/src/netif/ppp/polarssl endif diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index db9f03beda..98a85fc2d9 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -217,6 +217,7 @@ ---------- ICMP options ---------- ---------------------------------- */ +#define LWIP_ICMP CONFIG_LWIP_ICMP #define LWIP_BROADCAST_PING CONFIG_LWIP_BROADCAST_PING