[mac] append header termination IE2 when data payload is present (#6941)

MIC is a part of data payload, so if it's present, data payload is not
empty even if the data message is empty (ieee802154-2020 7.2.1 -
General MAC frame format).  If so according to Termination IE
inclusion rules (ieee802154-2020 7.4.2.1 Table 7-6) Header Termination
IE2 need to be applied.
This commit is contained in:
Łukasz Maciejończyk
2021-08-19 12:17:09 -07:00
committed by GitHub
parent 9272666541
commit d7749402f0
+4 -2
View File
@@ -1569,8 +1569,10 @@ void MeshForwarder::AppendHeaderIe(const Message *aMessage, Mac::TxFrame &aFrame
{
uint8_t index = 0;
bool iePresent = false;
bool payloadPresent =
(aFrame.GetType() == Mac::Frame::kFcfFrameMacCmd) || (aMessage != nullptr && aMessage->GetLength() != 0);
// MIC is a part of Data Payload, so if it's present, Data Payload is not empty even if the message is
// MIC is always present when the frame is secured
bool payloadPresent = (aFrame.GetType() == Mac::Frame::kFcfFrameMacCmd) ||
(aMessage != nullptr && aMessage->GetLength() != 0) || aFrame.GetSecurityEnabled();
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
if (aMessage != nullptr && aMessage->IsTimeSync())