[dataset] update active/pending dataset based on existing active dataset (#2991)

This commit is contained in:
rongli
2018-08-24 19:14:06 -07:00
committed by Jonathan Hui
parent dd3916c404
commit 5b7e49f21d
+3 -27
View File
@@ -111,8 +111,6 @@ otError DatasetManager::Set(Coap::Header &aHeader, Message &aMessage, const Ip6:
NetworkMasterKeyTlv masterKey;
PanIdTlv panId;
mLocal.Get(dataset);
activeTimestamp.SetLength(0);
pendingTimestamp.SetLength(0);
channel.SetLength(0);
@@ -224,35 +222,13 @@ otError DatasetManager::Set(Coap::Header &aHeader, Message &aMessage, const Ip6:
VerifyOrExit(!isUpdateFromCommissioner || type == Tlv::kPendingTimestamp || !doesAffectConnectivity,
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)
{
// take active dataset as the update base for MGMT_PENDING_SET.req if no existing pending dataset.
if (type == Tlv::kPendingTimestamp && dataset.GetSize() == 0)
{
netif.GetActiveDataset().Get(dataset);
}
// Thread specification allows partial dataset changes for MGMT_ACTIVE_SET.req/MGMT_PENDING_SET.req
// from Commissioner based on existing active dataset.
netif.GetActiveDataset().Get(dataset);
}
#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 dataset 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
{
dataset.Clear();
}
#endif
if (type == Tlv::kPendingTimestamp || !doesAffectConnectivity)
{
offset = aMessage.GetOffset();