mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 22:24:33 +02:00
fix(openthread): fix the preference of the ip6 address set to lwip
This commit is contained in:
@@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -106,9 +106,13 @@ static void process_thread_address(const otIp6AddressInfo *address_info, bool is
|
|||||||
} else {
|
} else {
|
||||||
ip_event_add_ip6_t add_addr;
|
ip_event_add_ip6_t add_addr;
|
||||||
add_addr.addr = addr;
|
add_addr.addr = addr;
|
||||||
// if an address is not mesh local or link local, we set preferred for this address.
|
// Only mark the address as preferred if
|
||||||
add_addr.preferred =
|
// it is marked preferred by OpenThread and it is neither a mesh-local nor a link-local address.
|
||||||
is_mesh_local_addr(address_info->mAddress) || is_link_local_addr(address_info->mAddress) ? 0 : 1;
|
if (address_info->mPreferred == 0 || is_mesh_local_addr(address_info->mAddress) || is_link_local_addr(address_info->mAddress)) {
|
||||||
|
add_addr.preferred = 0;
|
||||||
|
} else {
|
||||||
|
add_addr.preferred = 1;
|
||||||
|
}
|
||||||
if (esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_GOT_IP6, &add_addr, sizeof(add_addr), 0) != ESP_OK) {
|
if (esp_event_post(OPENTHREAD_EVENT, OPENTHREAD_EVENT_GOT_IP6, &add_addr, sizeof(add_addr), 0) != ESP_OK) {
|
||||||
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to post OpenThread got ip6 address event");
|
ESP_LOGE(OT_PLAT_LOG_TAG, "Failed to post OpenThread got ip6 address event");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user