From 7b3ea11ebb9b4782e2d49467d898fd5b2e28c744 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 7 Feb 2017 17:04:23 -0800 Subject: [PATCH] `Mle_Router`: Check the child's state to be valid when receiving a "Child Update Request" (#1270) - In `HandleChildUpdateRequest()` check that the child is already in state `kStateValid` before sending the full reply. This addresses an issue during re-attach process (where the child could switch to valid state before counters were synced on the parent). --- src/core/thread/mle_router.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 511b16ca0..52dffaef1 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -2252,7 +2252,7 @@ ThreadError MleRouter::HandleChildUpdateRequest(const Message &aMessage, const I child = FindChild(macAddr); - if (child == NULL) + if ((child == NULL) || (child->mState != Neighbor::kStateValid)) { tlvs[tlvslength++] = Tlv::kStatus; SendChildUpdateResponse(NULL, aMessageInfo, tlvs, tlvslength, NULL); @@ -2326,7 +2326,6 @@ ThreadError MleRouter::HandleChildUpdateRequest(const Message &aMessage, const I child->mLastHeard = Timer::GetNow(); child->mAddSrcMatchEntryShort = true; - child->mState = Neighbor::kStateValid; SendChildUpdateResponse(child, aMessageInfo, tlvs, tlvslength, &challenge);