diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 7c2d5cc73..37c4cbc54 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1182,7 +1182,7 @@ private: // All time intervals are in milliseconds static constexpr uint32_t kParentRequestRouterTimeout = 750; // Wait time after tx of Parent Req to routers static constexpr uint32_t kParentRequestReedTimeout = 1250; // Wait timer after tx of Parent Req to REEDs - static constexpr uint32_t kParentRequestDuplicateMargin = 50; // Margin to detect duplicate received Parent Req + static constexpr uint32_t kParentRequestDuplicateTimeout = 700; // Min time to detect duplicate Parent Req rx static constexpr uint32_t kChildIdResponseTimeout = 1250; // Wait time to receive Child ID Response static constexpr uint32_t kAttachStartJitter = 50; // Max jitter time added to start of attach static constexpr uint32_t kAnnounceProcessTimeout = 250; // Delay after Announce rx before processing diff --git a/src/core/thread/mle_ftd.cpp b/src/core/thread/mle_ftd.cpp index 061096dc2..3fdbc5e2b 100644 --- a/src/core/thread/mle_ftd.cpp +++ b/src/core/thread/mle_ftd.cpp @@ -1401,29 +1401,12 @@ void Mle::HandleParentRequest(RxInfo &aRxInfo) Log(kMessageReceive, kTypeParentRequest, aRxInfo.mMessageInfo.GetPeerAddr()); - VerifyOrExit(IsRouterEligible(), error = kErrorInvalidState); + VerifyOrExit(IsRouterEligible()); + VerifyOrExit(!IsDetached() && !IsAttaching()); - // A Router/REED MUST NOT send an MLE Parent Response if: - - // 0. It is detached or attempting to another partition - VerifyOrExit(!IsDetached() && !IsAttaching(), error = kErrorDrop); - - // 1. It has no available Child capacity (if Max Child Count minus - // Child Count would be equal to zero) - // ==> verified below when allocating a child entry - - // 2. It is disconnected from its Partition (that is, it has not - // received an updated ID sequence number within LEADER_TIMEOUT - // seconds) VerifyOrExit(mRouterTable.GetLeaderAge() < mNetworkIdTimeout, error = kErrorDrop); - - // 3. Its current routing path cost to the Leader is infinite. VerifyOrExit(mRouterTable.GetPathCostToLeader() < kMaxRouteCost, error = kErrorDrop); - // 4. It is a REED and there are already `kMaxRouters` active routers in - // the network (because Leader would reject any further address solicit). - // ==> Verified below when checking the scan mask. - info.mChildExtAddress.SetFromIid(aRxInfo.mMessageInfo.GetPeerAddr().GetIid()); SuccessOrExit(error = aRxInfo.mMessage.ReadVersionTlv(version)); @@ -1466,9 +1449,11 @@ void Mle::HandleParentRequest(RxInfo &aRxInfo) child->SetVersion(version); } } - else if (TimerMilli::GetNow() - child->GetLastHeard() < kParentRequestRouterTimeout - kParentRequestDuplicateMargin) + else { - ExitNow(error = kErrorDuplicated); + uint32_t durSinceLastHeard = TimerMilli::GetNow() - child->GetLastHeard(); + + VerifyOrExit(durSinceLastHeard >= kParentRequestDuplicateTimeout, error = kErrorDuplicated); } if (!child->IsStateValidOrRestoring())