Skip to content

Commit

Permalink
[mesh-forwarder] only mark Key ID Mode 0 and 1 as secure
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhui committed Jul 1, 2023
1 parent 561966a commit f847bfb
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/core/thread/mesh_forwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,24 @@ void ThreadLinkInfo::SetFrom(const Mac::RxFrame &aFrame)
mIsDstPanIdBroadcast = (dstPanId == Mac::kPanIdBroadcast);
}

mChannel = aFrame.GetChannel();
mRss = aFrame.GetRssi();
mLqi = aFrame.GetLqi();
mLinkSecurity = aFrame.GetSecurityEnabled();
if (aFrame.GetSecurityEnabled())
{
uint8_t keyIdMode;

// MAC Frame Security was already validated at the MAC
// layer. As a result, `GetKeyIdMode()` will never return
// failure here.
IgnoreError(aFrame.GetKeyIdMode(keyIdMode));

mLinkSecurity = (keyIdMode == Mac::Frame::kKeyIdMode0) || (keyIdMode == Mac::Frame::kKeyIdMode1);
}
else
{
mLinkSecurity = false;
}
+mChannel = aFrame.GetChannel();
mRss = aFrame.GetRssi();
mLqi = aFrame.GetLqi();
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
if (aFrame.GetTimeIe() != nullptr)
{
Expand Down

0 comments on commit f847bfb

Please sign in to comment.