diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index b3ba28076..2fea5db79 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -3582,7 +3582,7 @@ void Mle::HandleChildUpdateResponse(RxInfo &aRxInfo) case kRoleChild: SuccessOrExit(error = Tlv::Find(aRxInfo.mMessage, sourceAddress)); - if (RouterIdFromRloc16(sourceAddress) != RouterIdFromRloc16(GetRloc16())) + if (!RouterIdMatch(sourceAddress, GetRloc16())) { IgnoreError(BecomeDetached()); ExitNow(); diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index df6c28903..bfef47222 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -3109,18 +3109,18 @@ exit: bool MleRouter::IsMinimalChild(uint16_t aRloc16) { - bool rval = false; + bool isMinimalChild = false; + Neighbor *neighbor; - if (RouterIdFromRloc16(aRloc16) == RouterIdFromRloc16(Get().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)