`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).
diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp
index 511b16c..52dffae 100644
--- a/src/core/thread/mle_router.cpp
+++ b/src/core/thread/mle_router.cpp
@@ -2252,7 +2252,7 @@
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 @@
child->mLastHeard = Timer::GetNow();
child->mAddSrcMatchEntryShort = true;
- child->mState = Neighbor::kStateValid;
SendChildUpdateResponse(child, aMessageInfo, tlvs, tlvslength, &challenge);