Skip to content

Commit

Permalink
[dataset] send 'reject' response to MGMT_SET on non-leader (openthr…
Browse files Browse the repository at this point in the history
…ead#10148)

This commit simplifies the code and adheres to the SHOULD
requirement in the Thread specification, which states: "A Thread
Device that is not a Leader MUST NOT process this message. Instead it
SHOULD respond with 'Reject' state value".
  • Loading branch information
abtink authored May 7, 2024
1 parent 6f0b763 commit 83af14a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/meshcop/dataset_manager_ftd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ Error DatasetManager::HandleSet(const Coap::Message &aMessage, const Ip6::Messag
StateTlv::State state = StateTlv::kReject;
SetRequestInfo info;

VerifyOrExit(Get<Mle::Mle>().IsLeader());

SuccessOrExit(ProcessSetRequest(aMessage, info));

if (IsActiveDataset() && info.mAffectsConnectivity)
Expand Down Expand Up @@ -374,7 +376,6 @@ void ActiveDatasetManager::StartLeader(void) {}
template <>
void ActiveDatasetManager::HandleTmf<kUriActiveSet>(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
VerifyOrExit(Get<Mle::Mle>().IsLeader());
SuccessOrExit(DatasetManager::HandleSet(aMessage, aMessageInfo));
IgnoreError(ApplyConfiguration());

Expand All @@ -387,7 +388,6 @@ void PendingDatasetManager::StartLeader(void) { StartDelayTimer(); }
template <>
void PendingDatasetManager::HandleTmf<kUriPendingSet>(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
VerifyOrExit(Get<Mle::Mle>().IsLeader());
SuccessOrExit(DatasetManager::HandleSet(aMessage, aMessageInfo));
StartDelayTimer();

Expand Down

0 comments on commit 83af14a

Please sign in to comment.