Merge branch 'feat/update_ot_upstream_v53' into 'release/v5.3'

feat(openthread): update openthread upstream submodule to support BR DNS resolution (v5.3)

See merge request espressif/esp-idf!38187
This commit is contained in:
Shu Chen
2025-04-15 12:09:54 +08:00
12 changed files with 79 additions and 19 deletions

View File

@ -17,6 +17,7 @@ if(CONFIG_OPENTHREAD_ENABLED)
"openthread/examples/platforms"
"openthread/src"
"openthread/src/core"
"openthread/src/include"
"openthread/src/lib"
"openthread/src/lib/hdlc"
"openthread/src/lib/spinel"
@ -102,8 +103,10 @@ if(CONFIG_OPENTHREAD_ENABLED)
"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/csl_tx_scheduler.cpp"
"openthread/src/core/thread/discover_scanner.cpp"
"openthread/src/core/thread/energy_scan_server.cpp"
"openthread/src/core/thread/indirect_sender.cpp"
"openthread/src/core/thread/key_manager.cpp"
"openthread/src/core/thread/link_metrics.cpp"
"openthread/src/core/thread/lowpan.cpp"
@ -215,6 +218,7 @@ elseif(CONFIG_OPENTHREAD_SPINEL_ONLY)
"private_include"
"openthread/src"
"openthread/src/core"
"openthread/src/include"
"openthread/src/lib"
"openthread/src/lib/hdlc"
"openthread/src/lib/spinel")

View File

@ -440,6 +440,16 @@
#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE
*
* Define to 1 to enable upstream forwarding support.
*
*/
#ifndef OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
*

View File

@ -5,4 +5,4 @@ supplier: 'Organization: Espressif Systems (Shanghai) CO LTD'
originator: 'Organization: Google LLC'
description: OpenThread released by Google is an open-source implementation of the Thread networking
url: https://github.com/espressif/openthread
hash: 005c5cefc22aaf0396e4327ee7f2e0ad32a7733b
hash: 8c30b93feed13f2da38f8592b3ed94f4d0a077a4

View File

@ -93,6 +93,7 @@ esp_err_t esp_openthread_radio_init(const esp_openthread_platform_config_t *conf
iidList[0] = 0;
ot::Spinel::RadioSpinelCallbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks));
#if CONFIG_OPENTHREAD_DIAG
callbacks.mDiagReceiveDone = otPlatDiagRadioReceiveDone;
callbacks.mDiagTransmitDone = otPlatDiagRadioTransmitDone;

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -41,6 +41,7 @@ typedef struct {
typedef struct {
struct pbuf *p;
otSockAddr *source_addr;
} ot_trel_recv_task_t;
typedef struct {
@ -90,7 +91,8 @@ static void trel_browse_notifier(mdns_result_t *result)
static void trel_recv_task(void *ctx)
{
struct pbuf *recv_buf = (struct pbuf *)ctx;
ot_trel_recv_task_t *task_ctx = (ot_trel_recv_task_t *)ctx;
struct pbuf *recv_buf = task_ctx->p;
uint8_t *data_buf = (uint8_t *)recv_buf->payload;
uint8_t *data_buf_to_free = NULL;
uint16_t length = recv_buf->len;
@ -106,21 +108,49 @@ static void trel_recv_task(void *ctx)
ExitNow();
}
}
otPlatTrelHandleReceived(esp_openthread_get_instance(), data_buf, length);
otPlatTrelHandleReceived(esp_openthread_get_instance(), data_buf, length, task_ctx->source_addr);
exit:
if (data_buf_to_free) {
free(data_buf_to_free);
}
pbuf_free(recv_buf);
if(task_ctx) {
free(task_ctx->source_addr);
}
free(task_ctx);
}
static void handle_trel_udp_recv(void *ctx, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, uint16_t port)
{
ESP_LOGD(OT_PLAT_LOG_TAG, "Receive from %s:%d", ip6addr_ntoa(&(addr->u_addr.ip6)), port);
if (esp_openthread_task_queue_post(trel_recv_task, p) != ESP_OK) {
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to receive OpenThread TREL message");
ot_trel_recv_task_t *task_ctx = (ot_trel_recv_task_t *)malloc(sizeof(ot_trel_recv_task_t));
if (task_ctx == NULL) {
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to allocate buf for Thread TREL");
ExitNow();
}
task_ctx->p = p;
task_ctx->source_addr = (otSockAddr *)malloc(sizeof(otSockAddr));
if (task_ctx->source_addr == NULL) {
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to allocate buf for Thread TREL");
ExitNow();
}
memset(task_ctx->source_addr, 0, sizeof(otSockAddr));
task_ctx->source_addr->mPort = port;
memcpy(&task_ctx->source_addr->mAddress.mFields.m32, addr->u_addr.ip6.addr, sizeof(addr->u_addr.ip6.addr));
if (esp_openthread_task_queue_post(trel_recv_task, task_ctx) != ESP_OK) {
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to receive OpenThread TREL message");
ExitNow();
}
return;
exit:
if(task_ctx) {
free(task_ctx->source_addr);
}
free(task_ctx);
pbuf_free(p);
}
static esp_err_t ot_new_trel(void *ctx)
@ -198,6 +228,20 @@ void otPlatTrelSend(otInstance *aInstance,
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
}
void otPlatTrelNotifyPeerSocketAddressDifference(otInstance *aInstance,
const otSockAddr *aPeerSockAddr,
const otSockAddr *aRxSockAddr)
{
OT_UNUSED_VARIABLE(aInstance);
char peer_string[OT_IP6_SOCK_ADDR_STRING_SIZE];
char rx_string[OT_IP6_SOCK_ADDR_STRING_SIZE];
otIp6SockAddrToString(aPeerSockAddr, peer_string, sizeof(peer_string));
otIp6SockAddrToString(aRxSockAddr, rx_string, sizeof(rx_string));
ESP_LOGW(OT_PLAT_LOG_TAG, "TREL packet is received from a peer (%s) using a different socket address (%s)", peer_string, rx_string);
}
void otPlatTrelRegisterService(otInstance *aInstance, uint16_t aPort, const uint8_t *aTxtData, uint8_t aTxtLength)
{
esp_err_t ret = ESP_OK;

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -258,7 +258,7 @@ static uint8_t get_netif_index(otNetifIdentifier netif_identifier)
switch (netif_identifier) {
case OT_NETIF_UNSPECIFIED:
return NETIF_NO_INDEX;
case OT_NETIF_THREAD:
case OT_NETIF_THREAD_HOST:
return esp_netif_get_netif_impl_index(esp_openthread_get_netif());
case OT_NETIF_BACKBONE:
return esp_netif_get_netif_impl_index(esp_openthread_get_backbone_netif());
@ -351,7 +351,7 @@ static void udp_send_task(void *ctx)
VerifyOrExit(send_buf != NULL);
otMessageRead(task->message, 0, send_buf->payload, len);
if (task->netif_index == get_netif_index(OT_NETIF_THREAD)) {
if (task->netif_index == get_netif_index(OT_NETIF_THREAD_HOST)) {
// If the input arguments indicated the netif is OT, directly send the message.
err = udp_sendto_if_src(task->pcb, send_buf, &task->peer_addr, task->peer_port, netif_get_by_index(task->netif_index), &task->source_addr);
} else {
@ -402,12 +402,12 @@ otError otPlatUdpSend(otUdpSocket *udp_socket, otMessage *message, const otMessa
#endif
if (is_link_local(&message_info->mPeerAddr) || is_multicast(&message_info->mPeerAddr)) {
task->netif_index = get_netif_index(message_info->mIsHostInterface ? OT_NETIF_BACKBONE : OT_NETIF_THREAD);
task->netif_index = get_netif_index(message_info->mIsHostInterface ? OT_NETIF_BACKBONE : OT_NETIF_THREAD_HOST);
}
if (is_openthread_internal_mesh_local_addr(&message_info->mPeerAddr)) {
// If the destination address is a openthread mesh local address, set the netif OT.
task->netif_index = get_netif_index(OT_NETIF_THREAD);
task->netif_index = get_netif_index(OT_NETIF_THREAD_HOST);
}
esp_openthread_task_switching_lock_release();
tcpip_callback(udp_send_task, task);

View File

@ -18,8 +18,8 @@
#include "esp_openthread_types.h"
#include "esp_openthread_uart.h"
#include "driver/uart_vfs.h"
#include "core/common/code_utils.hpp"
#include "core/common/logging.hpp"
#include "common/code_utils.hpp"
#include "common/logging.hpp"
#include "driver/uart.h"
#include "lib/platform/exit_code.h"
#include "openthread/platform/time.h"

View File

@ -11,7 +11,7 @@
#include "esp_openthread_common_macro.h"
#include "openthread/platform/time.h"
#include "hdlc.hpp"
#include "core/common/code_utils.hpp"
#include "common/code_utils.hpp"
namespace esp {
namespace radio_spinel {

View File

@ -448,7 +448,7 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
cli.expect('Done', timeout=10)
command = 'dns browse _testxxx._udp.default.service.arpa'
tmp = ocf.get_ouput_string(cli, command, 5)
tmp = ocf.get_ouput_string(cli, command, 10)
assert 'Port:12347' not in str(tmp)
ocf.restart_avahi()
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
@ -457,12 +457,12 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
ocf.wait(cli, 5)
command = 'dns browse _testxxx._udp.default.service.arpa'
tmp = ocf.get_ouput_string(cli, command, 5)
tmp = ocf.get_ouput_string(cli, command, 10)
assert 'response for _testxxx' in str(tmp)
assert 'Port:12347' in str(tmp)
command = 'dns service testxxx _testxxx._udp.default.service.arpa.'
tmp = ocf.get_ouput_string(cli, command, 5)
tmp = ocf.get_ouput_string(cli, command, 10)
assert 'response for testxxx' in str(tmp)
assert 'Port:12347' in str(tmp)
finally:

View File

@ -3,6 +3,7 @@
.zigbee_dependencies: &zigbee_dependencies
depends_components:
- ieee802154
- openthread
depends_filepatterns:
- examples/zigbee/light_sample/**/*