mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 08:07:47 +00:00
[mlr] simplify MLR state tracking on Child (#13166)
This commit simplifies MLR state tracking for child devices. Previously, `Child::Ip6AddrEntry` inherited from `Ip6::Address` to encapsulate the MLR registration check using the `Child` reference. This introduced tight coupling between `Child` and `Ip6AddrEntry`. The logic is refactored by removing `Ip6AddrEntry`. Instead, `Child` now directly manages a `Child::Ip6AddressArray` and encapsulates the MLR state querying/updating through new methods: - `SetAddressMlrRegistrationState()` - `GetAllMlrRegisteredAddresses()` - `ClearAllAddressesMlrRegistrationState()` In `Mlr::Manager`, the redundant `ChildAddressArray` typedef and `kMaxChildAddresses` constant are removed, reusing the `Child::Ip6AddressArray`. The method `UpdateProxiedSubscriptions()` is renamed to the more intuitive `UpdateChildRegistrations()`, and overloaded to allow calling it without an old address list during initial child registration.
This commit is contained in:
@@ -1830,7 +1830,7 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
Ip6::Address oldDua;
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||
Mlr::Manager::ChildAddressArray oldMlrRegisteredAddresses;
|
||||
Child::Ip6AddressArray oldMlrRegisteredAddresses;
|
||||
#endif
|
||||
|
||||
OT_UNUSED_VARIABLE(storedCount);
|
||||
@@ -1845,16 +1845,7 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||
if (aChild.HasAnyMlrRegisteredAddress())
|
||||
{
|
||||
for (const Child::Ip6AddrEntry &addrEntry : aChild.GetIp6Addresses())
|
||||
{
|
||||
if (addrEntry.IsMlrRegistered(aChild))
|
||||
{
|
||||
IgnoreError(oldMlrRegisteredAddresses.PushBack(addrEntry));
|
||||
}
|
||||
}
|
||||
}
|
||||
aChild.GetAllMlrRegisteredAddresses(oldMlrRegisteredAddresses);
|
||||
#endif
|
||||
|
||||
aChild.ClearIp6Addresses();
|
||||
@@ -1946,7 +1937,7 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||
Get<Mlr::Manager>().UpdateProxiedSubscriptions(aChild, oldMlrRegisteredAddresses);
|
||||
Get<Mlr::Manager>().UpdateChildRegistrations(aChild, oldMlrRegisteredAddresses);
|
||||
#endif
|
||||
|
||||
if (count == 0)
|
||||
@@ -3812,7 +3803,7 @@ void Mle::SetChildStateToValid(Child &aChild)
|
||||
IgnoreError(mChildTable.StoreChild(aChild));
|
||||
|
||||
#if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
|
||||
Get<Mlr::Manager>().UpdateProxiedSubscriptions(aChild, Mlr::Manager::ChildAddressArray());
|
||||
Get<Mlr::Manager>().UpdateChildRegistrations(aChild);
|
||||
#endif
|
||||
|
||||
mNeighborTable.Signal(NeighborTable::kChildAdded, aChild);
|
||||
|
||||
Reference in New Issue
Block a user