mirror of
https://github.com/espressif/openthread.git
synced 2026-07-07 04:44:47 +00:00
Don't return parent info if the device is not a child (#1868)
* Fix the issue that the previous parent information could be retrieved even after the device is not a child * Print more parent information in CLI
This commit is contained in:
@@ -304,6 +304,9 @@ otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
|
||||
otError error = OT_ERROR_NONE;
|
||||
Router *parent;
|
||||
|
||||
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetRole() == OT_DEVICE_ROLE_CHILD,
|
||||
error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
VerifyOrExit(aParentInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
parent = aInstance->mThreadNetif.GetMle().GetParent();
|
||||
|
||||
Reference in New Issue
Block a user