From c0c62a2909b93ae342e4deae482726e3902fd8e6 Mon Sep 17 00:00:00 2001 From: shripad621git Date: Fri, 21 Jun 2024 12:04:25 +0530 Subject: [PATCH] Addressed review comments and documented the IPv4 disabled change --- config/esp32/components/chip/CMakeLists.txt | 6 +++++- docs/guides/esp32/README.md | 1 + docs/guides/esp32/config_options.md | 13 +++++++++++++ src/platform/ESP32/BUILD.gn | 2 ++ src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 docs/guides/esp32/config_options.md diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index 672cf849af1244..f921855f666ce4 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -118,7 +118,11 @@ chip_gn_arg_append("chip_config_network_layer_ble" "false") endif() if(CONFIG_DISABLE_IPV4) - chip_gn_arg_append("chip_inet_config_enable_ipv4" "false") + if(NOT CONFIG_LWIP_IPV4) + chip_gn_arg_append("chip_inet_config_enable_ipv4" "false") + else() + message(FATAL_ERROR "Disable both IPV4 options i.e CONFIG_DISABLE_IPV4=y and CONFIG_LWIP_IPV4=n") + endif() endif() if(CONFIG_DISABLE_READ_CLIENT) diff --git a/docs/guides/esp32/README.md b/docs/guides/esp32/README.md index 443058a17b07aa..86cb3a94256257 100644 --- a/docs/guides/esp32/README.md +++ b/docs/guides/esp32/README.md @@ -19,3 +19,4 @@ example on ESP32 series of SoCs - [Generating and Using ESP Secure Cert Partition](secure_cert_partition.md) - [BLE Settings](ble_settings.md) - [Providers](providers.md) +- [Configuration Options](config_options.md) diff --git a/docs/guides/esp32/config_options.md b/docs/guides/esp32/config_options.md new file mode 100644 index 00000000000000..baa918d80cf413 --- /dev/null +++ b/docs/guides/esp32/config_options.md @@ -0,0 +1,13 @@ +# Configuration options + +This file lists down few config options to be enabled in through menuconfig for +specific scenarios. + +### Building with IPV4 Disabled + +Enable the options below through `idf.py menuconfig` and build the app. + +``` +CONFIG_DISABLE_IPV4=y +CONFIG_LWIP_IPV4=n +``` diff --git a/src/platform/ESP32/BUILD.gn b/src/platform/ESP32/BUILD.gn index 1b84a21b06d9d7..65b081fa031a3e 100644 --- a/src/platform/ESP32/BUILD.gn +++ b/src/platform/ESP32/BUILD.gn @@ -14,6 +14,7 @@ import("//build_overrides/chip.gni") +import("${chip_root}/src/inet/inet.gni") import("${chip_root}/src/platform/device.gni") assert(chip_device_platform == "esp32") @@ -36,6 +37,7 @@ declare_args() { defines = [ "CHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}", + "CHIP_DEVICE_CONFIG_ENABLE_IPV4=${chip_inet_config_enable_ipv4}", ] static_library("ESP32") { diff --git a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp index 50fa86396c8358..380edfd3e7adc9 100644 --- a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp @@ -999,7 +999,7 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) // If the station interface has been assigned an IPv4 address, and has // an IPv4 gateway, then presume that the device has IPv4 Internet // connectivity. -#if LWIP_IPV4 +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 if (!ip4_addr_isany_val(*netif_ip4_addr(netif)) && !ip4_addr_isany_val(*netif_ip4_gw(netif))) { haveIPv4Conn = true;