From db43f5e23fcfe12a0e0a74ba48d414ee847ab9b3 Mon Sep 17 00:00:00 2001 From: Martin Girardot Date: Fri, 10 Jan 2025 11:06:38 +0100 Subject: [PATCH] Return empty thread route table when there is no route instead of an error Signed-off-by: Martin Girardot --- .../thread-network-diagnostics-provider.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp index bf056d2e37ced9..6f41bf798742e4 100644 --- a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp +++ b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp @@ -248,8 +248,6 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a #if CHIP_DEVICE_CONFIG_THREAD_FTD uint8_t maxRouterId = otThreadGetMaxRouterId(otInst); - CHIP_ERROR chipErr = CHIP_ERROR_INCORRECT_STATE; - for (uint8_t i = 0; i <= maxRouterId; i++) { if (otThreadGetRouterInfo(otInst, i, &routerInfo) == OT_ERROR_NONE) @@ -268,11 +266,10 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a routeTable.linkEstablished = routerInfo.mLinkEstablished; ReturnErrorOnFailure(aEncoder.Encode(routeTable)); - chipErr = CHIP_NO_ERROR; } } - - return chipErr; + // Returning empty list with no error in case thread network is not up + return CHIP_NO_ERROR; #else // OPENTHREAD_MTD otError otErr = otThreadGetParentInfo(otInst, &routerInfo);