[mesh-forwarder] only mark Key ID Mode 0 and 1 as secure

This commit is contained in:
Jonathan Hui
2023-07-01 07:40:25 -07:00
parent 561966a01f
commit 3d5cb364f2
+18 -4
View File
@@ -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)
{