mirror of
https://github.com/espressif/openthread.git
synced 2026-09-17 22:50:07 +00:00
[meshcop] ensure msg has timestamp TLV in DatasetManager::HandleSet() (#7023)
This commit fixes `DatasetManager::HandleSet()` to add a check to ensure that the message contains `PendingTimestampTlv` when the Pending Dataset is being updated.
This commit is contained in:
@@ -121,10 +121,17 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo
|
|||||||
VerifyOrExit(pendingTimestamp.IsValid());
|
VerifyOrExit(pendingTimestamp.IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify the request includes a timestamp that is ahead of the locally stored value
|
if (type == Tlv::kActiveTimestamp)
|
||||||
timestamp = (type == Tlv::kActiveTimestamp) ? static_cast<Timestamp *>(&activeTimestamp)
|
{
|
||||||
: static_cast<Timestamp *>(&pendingTimestamp);
|
timestamp = static_cast<Timestamp *>(&activeTimestamp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VerifyOrExit(pendingTimestamp.GetLength() > 0);
|
||||||
|
timestamp = static_cast<Timestamp *>(&pendingTimestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify the request includes a timestamp that is ahead of the locally stored value
|
||||||
VerifyOrExit(mLocal.Compare(timestamp) > 0);
|
VerifyOrExit(mLocal.Compare(timestamp) > 0);
|
||||||
|
|
||||||
// check channel
|
// check channel
|
||||||
|
|||||||
Reference in New Issue
Block a user