Skip to content

Commit 3670561

Browse files
gjc13pull[bot]
authored andcommitted
esp32: support ICMPv6 RIO handling (#11412)
* esp32: support ICMPv6 RIO handling * Add support for ICMPv6 RIO handling * Update ESP-IDF release to v4.4 for route hook support. * esp32: better rio message parsing * esp32: update v4.4 release branch README * fix review comments
1 parent 3a1aef8 commit 3670561

25 files changed

+556
-18
lines changed

examples/all-clusters-app/esp32/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ The VSCode devcontainer has these components pre-installed, so you can skip this
4141
step. To install these components manually, follow these steps:
4242

4343
- Clone the Espressif ESP-IDF and checkout
44-
[v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3)
44+
[v4.4 tag](https://github.com/espressif/esp-idf/releases/v4.4)
4545

4646
$ mkdir ${HOME}/tools
4747
$ cd ${HOME}/tools
4848
$ git clone https://github.com/espressif/esp-idf.git
4949
$ cd esp-idf
50-
$ git checkout v4.3
50+
$ git checkout release/v4.4
5151
$ git submodule update --init
5252
$ ./install.sh
5353

examples/all-clusters-app/esp32/main/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set(SRC_DIRS_LIST
2727
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/all-clusters-app/zap-generated"
2828
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes"
2929
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated"
30+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook"
3031
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension"
3132
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
3233
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"

examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
#include "Globals.h"
2929
#include "LEDWidget.h"
3030
#include "WiFiWidget.h"
31+
#include "esp_check.h"
32+
#include "esp_err.h"
3133
#include "esp_heap_caps.h"
3234
#include "esp_log.h"
35+
#include "route_hook/esp_route_hook.h"
3336
#include <app-common/zap-generated/attribute-id.h>
3437
#include <app-common/zap-generated/cluster-id.h>
3538
#include <app/Command.h>
@@ -83,6 +86,10 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
8386
// newly selected address.
8487
chip::app::DnssdServer::Instance().StartServer();
8588
}
89+
if (event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned)
90+
{
91+
ESP_ERROR_CHECK(esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")));
92+
}
8693
break;
8794
}
8895

examples/all-clusters-app/esp32/sdkconfig.defaults

+4
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ CONFIG_DEVICE_PRODUCT_ID=0x4541
4444

4545
#enable debug shell
4646
CONFIG_ENABLE_CHIP_SHELL=y
47+
48+
#enable lwIP route hooks
49+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
50+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

examples/all-clusters-app/esp32/sdkconfig_c3devkit.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ CONFIG_LWIP_IPV6_AUTOCONFIG=y
4040
CONFIG_PARTITION_TABLE_CUSTOM=y
4141
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
4242

43+
#enable lwIP route hooks
44+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
45+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

examples/all-clusters-app/esp32/sdkconfig_m5stack.defaults

+4
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120
5050

5151
#enable debug shell
5252
CONFIG_ENABLE_CHIP_SHELL=y
53+
54+
#enable lwIP route hooks
55+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
56+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

examples/bridge-app/esp32/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ The VSCode devcontainer has these components pre-installed, so you can skip this
8484
step. To install these components manually, follow these steps:
8585

8686
- Clone the Espressif ESP-IDF and checkout
87-
[v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3)
87+
[v4.4 tag](https://github.com/espressif/esp-idf/releases/v4.4)
8888

8989
$ mkdir ${HOME}/tools
9090
$ cd ${HOME}/tools
9191
$ git clone https://github.com/espressif/esp-idf.git
9292
$ cd esp-idf
93-
$ git checkout v4.3
93+
$ git checkout release/v4.4
9494
$ git submodule update --init
9595
$ ./install.sh
9696

examples/bridge-app/esp32/main/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ idf_component_register(PRIV_INCLUDE_DIRS
3333
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread_network_diagnostics_server"
3434
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi_network_diagnostics_server"
3535
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software_diagnostics_server"
36-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general_diagnostics_server"
36+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general_diagnostics_server"
3737
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor"
3838
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
3939
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
4040
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
4141
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
42+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook"
4243
PRIV_REQUIRES chip QRCode bt)
4344

44-
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
45+
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
4546
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")

examples/bridge-app/esp32/main/DeviceCallbacks.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
*/
1818

1919
#include "DeviceCallbacks.h"
20+
#include "esp_check.h"
21+
#include "esp_err.h"
2022
#include "esp_heap_caps.h"
2123
#include "esp_log.h"
24+
#include "route_hook/esp_route_hook.h"
2225
#include <app-common/zap-generated/attribute-id.h>
2326
#include <app-common/zap-generated/cluster-id.h>
2427
#include <app/server/Dnssd.h>
@@ -81,6 +84,7 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event
8184
{
8285
ESP_LOGI(TAG, "IPv6 Server ready...");
8386
chip::app::DnssdServer::Instance().StartServer();
87+
ESP_ERROR_CHECK(esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")));
8488
}
8589
else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost)
8690
{

examples/bridge-app/esp32/sdkconfig.defaults

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ CONFIG_LWIP_IPV6_AUTOCONFIG=y
3636
# Use a custom partition table
3737
CONFIG_PARTITION_TABLE_CUSTOM=y
3838
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
39+
40+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
41+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

examples/ipv6only-app/esp32/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ step. To install these components manually, follow these steps:
2626
$ cd ${HOME}/tools
2727
$ git clone https://github.com/espressif/esp-idf.git
2828
$ cd esp-idf
29-
$ git checkout release/v4.3
29+
$ git checkout release/v4.4
3030
$ git submodule update --init
3131
$ ./install.sh
3232

examples/lock-app/esp32/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ The VSCode devcontainer has these components pre-installed, so you can skip this
2424
step. To install these components manually, follow these steps:
2525

2626
- Clone the Espressif ESP-IDF and checkout
27-
[v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3)
27+
[v4.4 tag](https://github.com/espressif/esp-idf/releases/v4.4)
2828

2929
$ mkdir ${HOME}/tools
3030
$ cd ${HOME}/tools
3131
$ git clone https://github.com/espressif/esp-idf.git
3232
$ cd esp-idf
33-
$ git checkout v4.3
33+
$ git checkout release/v4.4
3434
$ git submodule update --init
3535
$ ./install.sh
3636

examples/lock-app/esp32/main/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
127127
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes"
128128
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated"
129129
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/lock-app/zap-generated"
130+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook"
130131
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension"
131132
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
132133
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"

examples/lock-app/esp32/main/DeviceCallbacks.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727
#include "AppConfig.h"
2828
#include "BoltLockManager.h"
2929

30+
#include "esp_check.h"
31+
#include "esp_err.h"
3032
#include "esp_heap_caps.h"
3133
#include "esp_log.h"
34+
#include "route_hook/esp_route_hook.h"
3235
#include <app-common/zap-generated/attribute-id.h>
3336
#include <app-common/zap-generated/cluster-id.h>
3437
#include <app/server/Dnssd.h>
@@ -63,11 +66,16 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
6366
// newly selected address.
6467
chip::app::DnssdServer::Instance().StartServer();
6568
}
69+
if (event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned)
70+
{
71+
ESP_ERROR_CHECK(esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")));
72+
}
6673
break;
6774
}
6875

6976
ESP_LOGI(TAG, "Current free heap: %d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
7077
}
78+
7179
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
7280
uint8_t type, uint16_t size, uint8_t * value)
7381
{

examples/lock-app/esp32/sdkconfig.defaults

+4
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ CONFIG_LWIP_IPV6_AUTOCONFIG=y
3636
# Use a custom partition table
3737
CONFIG_PARTITION_TABLE_CUSTOM=y
3838
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
39+
40+
#enable lwIP route hooks
41+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
42+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y

examples/persistent-storage/esp32/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ The VSCode devcontainer has these components pre-installed, so you can skip this
4343
step. To install these components manually, follow these steps:
4444

4545
- Clone the Espressif ESP-IDF and checkout
46-
[v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3)
46+
[v4.4 tag](https://github.com/espressif/esp-idf/releases/v4.4)
4747

4848
$ mkdir ${HOME}/tools
4949
$ cd ${HOME}/tools
5050
$ git clone https://github.com/espressif/esp-idf.git
5151
$ cd esp-idf
52-
$ git checkout v4.3
52+
$ git checkout release/v4.4
5353
$ git submodule update --init
5454
$ ./install.sh
5555

examples/pigweed-app/esp32/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ The VSCode devcontainer has these components pre-installed, so you can skip this
3636
step. To install these components manually, follow these steps:
3737

3838
- Clone the Espressif ESP-IDF and checkout
39-
[v4.3 tag](https://github.com/espressif/esp-idf/releases/v4.3)
39+
[v4.4 tag](https://github.com/espressif/esp-idf/releases/v4.4)
4040

4141
$ mkdir ${HOME}/tools
4242
$ cd ${HOME}/tools
4343
$ git clone https://github.com/espressif/esp-idf.git
4444
$ cd esp-idf
45-
$ git checkout v4.3
45+
$ git checkout release/v4.4
4646
$ git submodule update --init
4747
$ ./install.sh
4848

0 commit comments

Comments
 (0)