Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenericThreadStackManagerImpl_OpenThread has non-spec-compliant encoding of some fields #26908

Closed
tcarmelveilleux opened this issue May 27, 2023 · 1 comment · Fixed by #26960
Assignees
Labels
bug Something isn't working openthread spec Mismatch between spec and implementation v1.2

Comments

@tcarmelveilleux
Copy link
Contributor

When doing a wildcard read of a Thread device implementing default ThreadDiagnostics cluster (GenericThreadStackManagerImpl_OpenThread), we get failures on reading/subscribing to several attributes in the cluster when not yet associated to a Thread mesh:

chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.ActiveTimestamp: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),
   chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.PendingTimestamp: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),
   chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.Delay: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),
   chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.SecurityPolicy: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),
   chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.ChannelPage0Mask: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),
   chip.clusters.Objects.ThreadNetworkDiagnostics.Attributes.OperationalDatasetComponents: ValueDecodeFailure(TLVValue=None, Reason=InteractionModelError(<Status.Failure: 1>)),

All the above are only valid when Thread is properly configured.
The code (simplified slightly for brevety) in src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp in GenericThreadStackManagerImpl_OpenThread<ImplClass>::_WriteThreadNetworkDiagnosticAttributeToTlv has, for example:

    case ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id: {
        err = CHIP_ERROR_INCORRECT_STATE;
        if (otDatasetIsCommissioned(mOTInst))
        {
            otOperationalDataset activeDataset;
            otError otErr = otDatasetGetActive(mOTInst, &activeDataset);
            VerifyOrExit(otErr == OT_ERROR_NONE, err = MapOpenThreadError(otErr));
            uint64_t activeTimestamp  = activeDataset.mActiveTimestamp;
            err = encoder.Encode(activeTimestamp);
        }
    }
    break;

This will simply return a CHIP_ERROR (which will lead to generic IM error ("FAILURE") instead of writing a null like the spec requires:

11.13.6.57. ActiveTimestamp Attribute

This attribute SHALL be null when there is no dataset configured.

It appears all the problematic FAILURE are of that nature.

@tcarmelveilleux tcarmelveilleux added bug Something isn't working openthread spec Mismatch between spec and implementation v1.2 labels May 27, 2023
@bzbarsky-apple
Copy link
Contributor

@jmartinez-silabs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openthread spec Mismatch between spec and implementation v1.2
Projects
3 participants