mirror of
https://github.com/espressif/openthread.git
synced 2026-10-26 17:24:00 +00:00
MeshForwader: Add comments and modify handling of (insecure) MLE message requiring fragmentation (#1285)
- This commit add comments to clarify how the `SendFragment()` handles (insecure) MLE messages requiring fragmentation and modifies the logic to have the caller enable security when trying again.
This commit is contained in:
committed by
Jonathan Hui
parent
f22d9dbcec
commit
1d9b7fd23f
@@ -1056,11 +1056,18 @@ ThreadError MeshForwarder::HandleFrameRequest(Mac::Frame &aFrame)
|
||||
}
|
||||
}
|
||||
|
||||
if (SendFragment(*mSendMessage, aFrame) == kThreadError_NotCapable)
|
||||
error = SendFragment(*mSendMessage, aFrame);
|
||||
|
||||
// `SendFragment()` fails with `NotCapable` error if the message is MLE (with
|
||||
// no link layer security) and also requires fragmentation.
|
||||
if (error == kThreadError_NotCapable)
|
||||
{
|
||||
SendFragment(*mSendMessage, aFrame);
|
||||
// Enable security and try again.
|
||||
mSendMessage->SetLinkSecurityEnabled(true);
|
||||
error = SendFragment(*mSendMessage, aFrame);
|
||||
}
|
||||
|
||||
assert(error == kThreadError_None);
|
||||
assert(aFrame.GetLength() != 7);
|
||||
break;
|
||||
|
||||
@@ -1340,7 +1347,6 @@ ThreadError MeshForwarder::SendFragment(Message &aMessage, Mac::Frame &aFrame)
|
||||
{
|
||||
if ((!aMessage.IsLinkSecurityEnabled()) && aMessage.IsSubTypeMle())
|
||||
{
|
||||
aMessage.SetLinkSecurityEnabled(true);
|
||||
aMessage.SetOffset(0);
|
||||
ExitNow(error = kThreadError_NotCapable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user