From 184c4ca9ed7ac8547a47dcdaa8d34e014f82e808 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 12 Aug 2025 12:13:19 -0700 Subject: [PATCH] [mle] ignore parent and child-update requests on parent when detaching (#11806) This change ensures that a parent device in the process of detaching from the network ignores incoming "Parent Request" and "Child Update Request" messages. A new `Detacher::IsDetaching()` method is added to check for this state. This prevents potential inefficiencies that could arise if these requests were responded during the detachment procedure. --- src/core/thread/mle.hpp | 1 + src/core/thread/mle_ftd.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 1ea22a13a..d248a29c6 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1801,6 +1801,7 @@ private: void HandleTimer(void); Error HandleChildUpdateResponse(uint32_t aTimeout); void HandleStop(void); + bool IsDetaching(void) const { return mState == kDetaching; } private: static constexpr uint32_t kTimeout = 1000; diff --git a/src/core/thread/mle_ftd.cpp b/src/core/thread/mle_ftd.cpp index 8aa72a42f..86698a9b6 100644 --- a/src/core/thread/mle_ftd.cpp +++ b/src/core/thread/mle_ftd.cpp @@ -1404,6 +1404,8 @@ void Mle::HandleParentRequest(RxInfo &aRxInfo) VerifyOrExit(IsRouterEligible()); VerifyOrExit(!IsDetached() && !IsAttaching()); + VerifyOrExit(!mDetacher.IsDetaching()); + VerifyOrExit(mRouterTable.GetLeaderAge() < mNetworkIdTimeout, error = kErrorDrop); VerifyOrExit(mRouterTable.GetPathCostToLeader() < kMaxRouteCost, error = kErrorDrop); @@ -2205,6 +2207,8 @@ void Mle::HandleChildUpdateRequestOnParent(RxInfo &aRxInfo) Log(kMessageReceive, kTypeChildUpdateRequestOfChild, aRxInfo.mMessageInfo.GetPeerAddr()); + VerifyOrExit(!mDetacher.IsDetaching()); + SuccessOrExit(error = aRxInfo.mMessage.ReadModeTlv(mode)); switch (aRxInfo.mMessage.ReadChallengeTlv(challenge))