From d37e9df6989f313f92cb90600fd97c3e5cc9c7e9 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 29 Apr 2026 08:49:41 -0700 Subject: [PATCH] [mle] remove `OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER` (#12997) This commit removes the `OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER` configuration option and the logic in `Mle` that limited the number of IPv6 addresses registered by an MTD with its parent. By removing this limit, MTDs will now attempt to register all their valid unicast and multicast addresses. The parent router still enforces its own limit on the number of addresses it accepts and stores per child via `OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD`. An error check is added to `openthread-core-config-check.h` to inform users of the removal of this configuration macro. --- src/core/config/mle.h | 9 --------- src/core/config/openthread-core-config-check.h | 4 ++++ src/core/thread/mle.cpp | 9 --------- src/core/thread/mle.hpp | 1 - 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/core/config/mle.h b/src/core/config/mle.h index 7792c7716..df2e43e41 100644 --- a/src/core/config/mle.h +++ b/src/core/config/mle.h @@ -82,15 +82,6 @@ #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 4 #endif -/** - * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER - * - * The maximum number of IPv6 address registrations for MTD. - */ -#ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER -#define OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER (OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD) -#endif - /** * @def OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE * diff --git a/src/core/config/openthread-core-config-check.h b/src/core/config/openthread-core-config-check.h index b6fa3f84c..4cacac022 100644 --- a/src/core/config/openthread-core-config-check.h +++ b/src/core/config/openthread-core-config-check.h @@ -698,4 +698,8 @@ #error "OPENTHREAD_CONFIG_DTLS_ENABLE was replaced by OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE" #endif +#ifdef OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER +#error "OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER is removed. All addresses are now registered." +#endif + #endif // OT_CORE_CONFIG_OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 4ad8838a6..bb1d94fd0 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -3645,7 +3645,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode { Error error = kErrorNone; Tlv::Bookmark tlvBookmark; - uint8_t counter = 0; SuccessOrExit(error = Tlv::StartTlv(*this, Tlv::kAddressRegistration, tlvBookmark)); @@ -3654,14 +3653,12 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode // Continue to append the other addresses if not `kAppendMeshLocalOnly` mode VerifyOrExit(aMode != kAppendMeshLocalOnly); - counter++; #if OPENTHREAD_CONFIG_DUA_ENABLE if (Get().HasUnicastAddress(Get().GetDomainUnicastAddress())) { // Prioritize DUA, compressed entry SuccessOrExit(error = AppendAddressRegistrationEntry(Get().GetDomainUnicastAddress())); - counter++; } #endif @@ -3685,9 +3682,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode #endif SuccessOrExit(error = AppendAddressRegistrationEntry(addr.GetAddress())); - counter++; - // only continue to append if there is available entry. - VerifyOrExit(counter < kMaxIpAddressesToRegister); } // Append external multicast addresses. For sleepy end device, @@ -3715,9 +3709,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode #endif SuccessOrExit(error = AppendAddressRegistrationEntry(addr.GetAddress())); - counter++; - // only continue to append if there is available entry. - VerifyOrExit(counter < kMaxIpAddressesToRegister); } } diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 76cbda6e7..0bf724eeb 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1322,7 +1322,6 @@ private: static constexpr uint8_t kMleHopLimit = 255; static constexpr uint8_t kMleSecurityTagSize = 4; static constexpr uint32_t kDefaultStoreFrameCounterAhead = OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD; - static constexpr uint8_t kMaxIpAddressesToRegister = OPENTHREAD_CONFIG_MLE_IP_ADDRS_TO_REGISTER; static constexpr uint32_t kDefaultChildTimeout = OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT; static constexpr uint32_t kDefaultCslTimeout = OPENTHREAD_CONFIG_CSL_TIMEOUT;