mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 18:37:45 +00:00
[mle] use DUA address directly in AppendAddressRegistrationTlv() (#8608)
This commit skips creating a local copy of DUA address and directly uses `Get<DuaManager>().GetDomainUnicastAddress()` which will be fully inlined.
This commit is contained in:
+5
-12
@@ -4586,9 +4586,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode
|
||||
uint8_t length = 0;
|
||||
uint8_t counter = 0;
|
||||
uint16_t startOffset = GetLength();
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
Ip6::Address domainUnicastAddress;
|
||||
#endif
|
||||
|
||||
tlv.SetType(Tlv::kAddressRegistration);
|
||||
SuccessOrExit(error = Append(tlv));
|
||||
@@ -4604,21 +4601,18 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode
|
||||
counter++;
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
// Cache Domain Unicast Address.
|
||||
domainUnicastAddress = Get<DuaManager>().GetDomainUnicastAddress();
|
||||
|
||||
if (Get<ThreadNetif>().HasUnicastAddress(domainUnicastAddress))
|
||||
if (Get<ThreadNetif>().HasUnicastAddress(Get<DuaManager>().GetDomainUnicastAddress()))
|
||||
{
|
||||
SuccessOrAssert(Get<NetworkData::Leader>().GetContext(domainUnicastAddress, context));
|
||||
SuccessOrAssert(Get<NetworkData::Leader>().GetContext(Get<DuaManager>().GetDomainUnicastAddress(), context));
|
||||
|
||||
// Prioritize DUA, compressed entry
|
||||
entry.SetContextId(context.mContextId);
|
||||
entry.SetIid(domainUnicastAddress.GetIid());
|
||||
entry.SetIid(Get<DuaManager>().GetDomainUnicastAddress().GetIid());
|
||||
SuccessOrExit(error = AppendBytes(&entry, entry.GetLength()));
|
||||
length += entry.GetLength();
|
||||
counter++;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
#endif
|
||||
|
||||
for (const Ip6::Netif::UnicastAddress &addr : Get<ThreadNetif>().GetUnicastAddresses())
|
||||
{
|
||||
@@ -4629,8 +4623,7 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
// Skip DUA that was already appended above.
|
||||
if (addr.GetAddress() == domainUnicastAddress)
|
||||
if (addr.GetAddress() == Get<DuaManager>().GetDomainUnicastAddress())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user