[cert-mgmt] workaround: reuse existing active/pending dataset for partial dataset from thread device (#2002)
diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index c885c08..34459ff 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp
@@ -511,15 +511,34 @@ state = StateTlv::kReject); // update dataset + // Thread specification allows partial dataset changes for MGMT_ACTIVE_SET.req/MGMT_PENDING_SET.req + // from Commissioner. + // Updates based on existing active/pending dataset if it is from Commissioner. if (isUpdateFromCommissioner) { - mNetwork.Set(netif.GetActiveDataset().GetNetwork()); + // take active dataset as the update base for MGMT_PENDING_SET.req if no existing pending dataset. + if (type == Tlv::kPendingTimestamp && mNetwork.GetSize() == 0) + { + mNetwork.Set(netif.GetActiveDataset().GetNetwork()); + } } + +#if 0 + // Interim workaround for certification: + // Thread specification requires entire dataset for MGMT_ACTIVE_SET.req/MGMT_PENDING_SET.req from thread device. + // Not all stack vendors would send entire dataset in MGMT_ACTIVE_SET.req triggered by command as known when + // testing 9.2.5. + // So here would accept even if it is not entire, update the Tlvs in the message on existing mNetwork in + // order to avoid interop issue for now. + // TODO: remove '#if 0' condition after all stack vendors reach consensus-MGMT_ACTIVE_SET.req/MGMT_PENDING_SET.req + // from thread device triggered by command would include entire dataset as expected. else { mNetwork.Clear(); } +#endif + if (type == Tlv::kPendingTimestamp || !doesAffectConnectivity) { offset = aMessage.GetOffset();