[mle] enhance RLOC and ALOC address generation (#10391)

This commit enhances the generation of RLOC and ALOC addresses in the
`Mle` class.

Methods retrieving RLOC/ALOC addresses no longer return an `Error` and
are now `void`. The previous check for a valid `GetRloc16()` value,
which returned `kErrorDetach` if unset, is removed because this
scenario only occurred before the device's initial attachment.
Post-attachment, the RLOC16 remains valid even if the device is
detached. This change simplifies the code since RLOC/ALOC address
retrieval happens after the initial attachment.

Additional enhancements include:

-   Changing the input parameter order in `GetCommissionerAloc()` to
    match `GetServiceAloc()`.
-   Using `Ip6::Address::SetToRoutingLocator()` to construct RLOC
    addresses, harmonizing address generation and improving code
    readability.
This commit is contained in:
Abtin Keshavarzian
2024-06-17 09:23:43 -07:00
committed by GitHub
parent 8a8a4d8e31
commit 5127e7e5c0
18 changed files with 63 additions and 107 deletions
+1 -1
View File
@@ -512,7 +512,7 @@ void DuaManager::PerformNextRegistration(void)
uint8_t pbbrServiceId;
SuccessOrExit(error = Get<BackboneRouter::Leader>().GetServiceId(pbbrServiceId));
SuccessOrExit(error = mle.GetServiceAloc(pbbrServiceId, messageInfo.GetPeerAddr()));
mle.GetServiceAloc(pbbrServiceId, messageInfo.GetPeerAddr());
}
else
{