Ncp: Fix join existing network feature (#865)

This commit changes the NcpBase and join-existing-network feature
by ensuring that the flag `mRequireJoinExistingNetwork` is not
cleared when role changes to detached or disabled. This fixes the
issue where a "join" command could seemingly succeed with device
forming its own partition (e.g, if a wrong network key is used).
This commit is contained in:
Abtin Keshavarzian
2016-10-21 21:55:45 -07:00
committed by Jonathan Hui
parent 919e902e18
commit 275d22d8d7
+10 -1
View File
@@ -740,7 +740,16 @@ void NcpBase::UpdateChangedProps(void)
{
if (mRequireJoinExistingNetwork)
{
mRequireJoinExistingNetwork = false;
switch (otGetDeviceRole(mInstance))
{
case kDeviceRoleDetached:
case kDeviceRoleDisabled:
break;
default:
mRequireJoinExistingNetwork = false;
break;
}
if ( (otGetDeviceRole(mInstance) == kDeviceRoleLeader)
&& otIsSingleton(mInstance)