diff --git a/components/openthread/CMakeLists.txt b/components/openthread/CMakeLists.txt index 73569f24ff..5ba60c09b9 100644 --- a/components/openthread/CMakeLists.txt +++ b/components/openthread/CMakeLists.txt @@ -59,6 +59,7 @@ if(CONFIG_OPENTHREAD_ENABLED) list(APPEND exclude_srcs "openthread/examples/apps/ncp/main.c" "openthread/src/core/api/backbone_router_api.cpp" + "openthread/src/core/api/child_supervision_api.cpp" "openthread/src/core/api/dataset_api.cpp" "openthread/src/core/api/dns_api.cpp" "openthread/src/core/api/entropy_api.cpp" @@ -86,6 +87,7 @@ if(CONFIG_OPENTHREAD_ENABLED) "openthread/src/core/thread/announce_begin_server.cpp" "openthread/src/core/thread/announce_sender.cpp" "openthread/src/core/thread/address_resolver.cpp" + "openthread/src/core/thread/child_supervision.cpp" "openthread/src/core/thread/discover_scanner.cpp" "openthread/src/core/thread/energy_scan_server.cpp" "openthread/src/core/thread/key_manager.cpp" diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index 133a157f4a..1171857c9f 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -130,6 +130,13 @@ menu "OpenThread" Select this option to enable SRP Client in OpenThread. This allows a device to register SRP services to SRP Server. + config OPENTHREAD_DNS_CLIENT + bool "Enable DNS Client" + depends on OPENTHREAD_ENABLED + default y + help + Select this option to enable DNS Client in OpenThread. + config OPENTHREAD_BORDER_ROUTER bool "Enable Border Router" depends on OPENTHREAD_ENABLED diff --git a/components/openthread/openthread b/components/openthread/openthread index 19e18753c1..091f68ed70 160000 --- a/components/openthread/openthread +++ b/components/openthread/openthread @@ -1 +1 @@ -Subproject commit 19e18753c1ca97ffc68566f4852444f341e0319c +Subproject commit 091f68ed706ce7a4831802408cdd0b0b4f309e3b diff --git a/components/openthread/port/esp_openthread_radio_uart.cpp b/components/openthread/port/esp_openthread_radio_uart.cpp index 25006f9894..cccf9bd1b1 100644 --- a/components/openthread/port/esp_openthread_radio_uart.cpp +++ b/components/openthread/port/esp_openthread_radio_uart.cpp @@ -241,7 +241,7 @@ void otPlatRadioSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKe void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter) { - SuccessOrDie(s_radio.SetMacFrameCounter(aMacFrameCounter)); + SuccessOrDie(s_radio.SetMacFrameCounter(aMacFrameCounter, true)); } #if OPENTHREAD_CONFIG_DIAG_ENABLE diff --git a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h index 2bb5ea4d68..18747d2d3a 100644 --- a/components/openthread/private_include/openthread-core-esp32x-ftd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-ftd-config.h @@ -213,6 +213,9 @@ #define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 #endif +#endif // CONFIG_OPENTHREAD_BORDER_ROUTER + +#if !CONFIG_OPENTHREAD_RADIO_NATIVE /** * @def OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT * @@ -224,7 +227,19 @@ #define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 1 #endif -#endif // CONFIG_OPENTHREAD_BORDER_ROUTER +/** + * @def OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL + * + * This setting configures the interval (in units of microseconds) for host-rcp + * time sync. The host will recalculate the time offset between host and RCP + * every interval. + * + */ +#ifndef OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL +#define OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL (60 * 1000 * 1000) +#endif + +#endif /** * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE @@ -234,16 +249,6 @@ */ #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 1 -/** - * @def OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE - * - * Define to 1 to enable Child Supervision support. - * - */ -#ifndef OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE -#define OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE 1 -#endif - /** * @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE * @@ -264,16 +269,6 @@ #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 #endif -/** - * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE - * - * Define to 1 to enable DNS Client support. - * - */ -#ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE -#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 -#endif - /** * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE * @@ -431,4 +426,12 @@ #endif #endif +/** + * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE + * + * Define to 1 to enable DNS Client support. + * + */ +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT + #define OPENTHREAD_FTD 1 diff --git a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h index 4f62a551e1..463934f433 100644 --- a/components/openthread/private_include/openthread-core-esp32x-mtd-config.h +++ b/components/openthread/private_include/openthread-core-esp32x-mtd-config.h @@ -230,4 +230,12 @@ #endif #endif +/** + * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE + * + * Define to 1 to enable DNS Client support. + * + */ +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE CONFIG_OPENTHREAD_DNS_CLIENT + #define OPENTHREAD_MTD 1 diff --git a/examples/openthread/ot_ci_function.py b/examples/openthread/ot_ci_function.py index 546eb43129..4d20a82811 100644 --- a/examples/openthread/ot_ci_function.py +++ b/examples/openthread/ot_ci_function.py @@ -147,8 +147,7 @@ def get_linklocal_addr(dut:IdfDut) -> str: def get_global_unicast_addr(dut:IdfDut, br:IdfDut) -> str: dut_adress = '' clean_buffer(br) - br.write('br omrprefix') - omrprefix = br.expect(r'\n((?:\w+:){4}):/\d+\r', timeout=5)[1].decode() + omrprefix = get_omrprefix(br) clean_buffer(dut) dut.write('ipaddr') dut_adress = dut.expect(r'(%s(?:\w+:){3}\w+)\r' % str(omrprefix), timeout=5)[1].decode() @@ -231,8 +230,7 @@ def clean_buffer(dut:IdfDut) -> None: def check_if_host_receive_ra(br:IdfDut) -> bool: interface_name = get_host_interface_name() clean_buffer(br) - br.write('br omrprefix') - omrprefix = br.expect(r'\n((?:\w+:){4}):/\d+\r', timeout=5)[1].decode() + omrprefix = get_omrprefix(br) command = 'ip -6 route | grep ' + str(interface_name) out_str = subprocess.getoutput(command) print('br omrprefix: ', str(omrprefix)) @@ -448,12 +446,11 @@ def create_host_tcp_server(mytcp:tcp_parameter) -> None: def get_ipv6_from_ipv4(ipv4_address:str, br:IdfDut) -> str: clean_buffer(br) - br.write('br nat64prefix') - omrprefix = br.expect(r'\n((?:\w+:){6}):/\d+', timeout=5)[1].decode() + nat64prefix = get_nat64prefix(br) ipv4_find = re.findall(r'\d+', ipv4_address) ipv6_16_1 = decimal_to_hex(ipv4_find[0]) + decimal_to_hex(ipv4_find[1]) ipv6_16_2 = decimal_to_hex(ipv4_find[2]) + decimal_to_hex(ipv4_find[3]) - ipv6_get_from_ipv4 = omrprefix + ':' + ipv6_16_1 + ':' + ipv6_16_2 + ipv6_get_from_ipv4 = nat64prefix + ':' + ipv6_16_1 + ':' + ipv6_16_2 return str(ipv6_get_from_ipv4) @@ -461,3 +458,15 @@ def decimal_to_hex(decimal_str:str) -> str: decimal_int = int(decimal_str) hex_str = hex(decimal_int)[2:] return hex_str + + +def get_omrprefix(br:IdfDut) -> str: + br.write('br omrprefix') + omrprefix = br.expect(r'Local: ((?:\w+:){4}):/\d+\r', timeout=5)[1].decode() + return str(omrprefix) + + +def get_nat64prefix(br:IdfDut) -> str: + br.write('br nat64prefix') + nat64prefix = br.expect(r'Local: ((?:\w+:){6}):/\d+', timeout=5)[1].decode() + return str(nat64prefix)