[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:
Abtin Keshavarzian
2024-06-14 10:05:40 -07:00
committed by GitHub
parent 503bca022e
commit cba0f5ca2b
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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();
+8 -8
View File
@@ -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)