mirror of
https://github.com/espressif/openthread.git
synced 2026-08-30 05:49:54 +00:00
update keySequence when incoming MAC frame has key index matches next key index (#287)
This commit is contained in:
@@ -766,6 +766,11 @@ ThreadError Mac::ProcessReceiveSecurity(Frame &aFrame, const Address &aSrcAddr,
|
||||
|
||||
aFrame.SetSecurityValid(true);
|
||||
|
||||
if (keySequence > mKeyManager.GetCurrentKeySequence())
|
||||
{
|
||||
mKeyManager.SetCurrentKeySequence(keySequence);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
if (error != kThreadError_None)
|
||||
|
||||
@@ -104,13 +104,16 @@ uint32_t KeyManager::GetCurrentKeySequence() const
|
||||
|
||||
void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
|
||||
{
|
||||
mKeySequence = aKeySequence;
|
||||
ComputeKey(mKeySequence, mKey);
|
||||
if (aKeySequence != mKeySequence)
|
||||
{
|
||||
mKeySequence = aKeySequence;
|
||||
ComputeKey(mKeySequence, mKey);
|
||||
|
||||
mMacFrameCounter = 0;
|
||||
mMleFrameCounter = 0;
|
||||
mMacFrameCounter = 0;
|
||||
mMleFrameCounter = 0;
|
||||
|
||||
mNetif.SetStateChangedFlags(OT_NET_KEY_SEQUENCE);
|
||||
mNetif.SetStateChangedFlags(OT_NET_KEY_SEQUENCE);
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t *KeyManager::GetCurrentMacKey() const
|
||||
|
||||
Reference in New Issue
Block a user