mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 10:40:09 +00:00
[mac] only append header termination IE2 when data payload is present (#6223)
According to IEEE802.15.4, header termination IE2 is present only when header IE and payload data is present.
This commit is contained in:
@@ -1553,8 +1553,8 @@ void MeshForwarder::AppendHeaderIe(const Message *aMessage, Mac::Frame &aFrame)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
bool iePresent = false;
|
||||
|
||||
OT_UNUSED_VARIABLE(aMessage);
|
||||
bool payloadPresent =
|
||||
(aFrame.GetType() == Mac::Frame::kFcfFrameMacCmd) || (aMessage != nullptr && aMessage->GetLength() != 0);
|
||||
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
if (aMessage != nullptr && aMessage->IsTimeSync())
|
||||
@@ -1571,8 +1571,9 @@ void MeshForwarder::AppendHeaderIe(const Message *aMessage, Mac::Frame &aFrame)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (iePresent)
|
||||
if (iePresent && payloadPresent)
|
||||
{
|
||||
// Assume no Payload IE in current implementation
|
||||
IgnoreError(aFrame.AppendHeaderIeAt<Mac::Termination2Ie>(index));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user