mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 06:07:48 +00:00
[mle-router] check for repeating child entries when restoring children (#2170)
This commit adds additional check in `MleRouter::RestoreChildren()` method for repeating/duplicate child entries (child entries with same extended address) when restoring child table from non-volatile memory. If there are more than one entry, the last one will be used.
This commit is contained in:
committed by
Jonathan Hui
parent
cbc883b932
commit
0e0ea33ef6
@@ -3519,7 +3519,13 @@ otError MleRouter::RestoreChildren(void)
|
||||
reinterpret_cast<uint8_t *>(&childInfo), &length));
|
||||
VerifyOrExit(length >= sizeof(childInfo), error = OT_ERROR_PARSE);
|
||||
|
||||
VerifyOrExit((child = NewChild()) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
child = FindChild(*static_cast<Mac::ExtAddress *>(&childInfo.mExtAddress));
|
||||
|
||||
if (child == NULL)
|
||||
{
|
||||
VerifyOrExit((child = NewChild()) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
}
|
||||
|
||||
memset(child, 0, sizeof(*child));
|
||||
|
||||
child->SetExtAddress(*static_cast<Mac::ExtAddress *>(&childInfo.mExtAddress));
|
||||
|
||||
Reference in New Issue
Block a user