From e52d7733c60ba7e2f293bd6243689c2d901c57bf Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 15 Aug 2017 14:37:06 -0700 Subject: [PATCH] [mle] maintain existing child id whenever possible (#2101) Child IDs are assigned when receiving a Child ID Request. Prior to this commit, a new Child ID is assigned whenever the child state is not valid. A router stores state about its attached children in non-volatile memory. On a reboot, the router attempts to restore its child links. As a result, it is possible for the child to be assigned a new Child ID while it is being restored. With this commit, a router only assigns a new Child ID if there is no existing Child ID state for the given child. --- src/core/thread/mle_router.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 12188b156..bdd3da41f 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -2724,7 +2724,7 @@ otError MleRouter::SendChildIdResponse(Child *aChild) SuccessOrExit(error = AppendActiveTimestamp(*message)); SuccessOrExit(error = AppendPendingTimestamp(*message)); - if (aChild->GetState() != Neighbor::kStateValid) + if (aChild->GetRloc16() == 0) { // pick next Child ID that is not being used do