From 3c402a7485436ba12e0f6f96164626ddb6be5e2f Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Sat, 31 Aug 2019 00:04:42 +0800 Subject: [PATCH] [commissioner] only allow attached device to become commissioner (#4120) The commit addresses the issue that running "commissioner start" command when device role is detached will cause commissioner not be able to start or stop. --- src/core/meshcop/commissioner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index a22294c22..8cad20ffa 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -144,6 +144,7 @@ otError Commissioner::Start(otCommissionerStateCallback aStateCallback, { otError error = OT_ERROR_NONE; + VerifyOrExit(Get().IsAttached(), error = OT_ERROR_INVALID_STATE); VerifyOrExit(mState == OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = Get().Start(SendRelayTransmit, this));