mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 01:47:47 +00:00
[mle] use RouterIdMatch() to compare Router IDs of two RLOC16 values (#10384)
This commit updates the code to use `RouterIdMatch()` for comparing the Router IDs of two given RLOC16 values. Additionally, it simplifies the `IsMinimalChild()` method.
This commit is contained in:
@@ -3582,7 +3582,7 @@ void Mle::HandleChildUpdateResponse(RxInfo &aRxInfo)
|
||||
case kRoleChild:
|
||||
SuccessOrExit(error = Tlv::Find<SourceAddressTlv>(aRxInfo.mMessage, sourceAddress));
|
||||
|
||||
if (RouterIdFromRloc16(sourceAddress) != RouterIdFromRloc16(GetRloc16()))
|
||||
if (!RouterIdMatch(sourceAddress, GetRloc16()))
|
||||
{
|
||||
IgnoreError(BecomeDetached());
|
||||
ExitNow();
|
||||
|
||||
@@ -3109,18 +3109,18 @@ exit:
|
||||
|
||||
bool MleRouter::IsMinimalChild(uint16_t aRloc16)
|
||||
{
|
||||
bool rval = false;
|
||||
bool isMinimalChild = false;
|
||||
Neighbor *neighbor;
|
||||
|
||||
if (RouterIdFromRloc16(aRloc16) == RouterIdFromRloc16(Get<Mac::Mac>().GetShortAddress()))
|
||||
{
|
||||
Neighbor *neighbor;
|
||||
VerifyOrExit(RouterIdMatch(aRloc16, GetRloc16()));
|
||||
|
||||
neighbor = mNeighborTable.FindNeighbor(aRloc16);
|
||||
neighbor = mNeighborTable.FindNeighbor(aRloc16);
|
||||
VerifyOrExit(neighbor != nullptr);
|
||||
|
||||
rval = (neighbor != nullptr) && (!neighbor->IsFullThreadDevice());
|
||||
}
|
||||
isMinimalChild = !neighbor->IsFullThreadDevice();
|
||||
|
||||
return rval;
|
||||
exit:
|
||||
return isMinimalChild;
|
||||
}
|
||||
|
||||
void MleRouter::RemoveRouterLink(Router &aRouter)
|
||||
|
||||
Reference in New Issue
Block a user