[mac] support frames without sequence number (#10544)

This commit adds the capability to support frames without sequence
number.
This commit is contained in:
Yakun Xu
2024-08-02 09:50:45 -07:00
committed by GitHub
parent 03113e8502
commit e219fe92f1
7 changed files with 155 additions and 41 deletions
+18 -3
View File
@@ -77,9 +77,21 @@ bool otMacFrameIsAckRequested(const otRadioFrame *aFrame)
return static_cast<const Mac::Frame *>(aFrame)->GetAckRequest();
}
uint8_t otMacFrameGetSequence(const otRadioFrame *aFrame)
otError otMacFrameGetSequence(const otRadioFrame *aFrame, uint8_t *aSequence)
{
return static_cast<const Mac::Frame *>(aFrame)->GetSequence();
otError error;
if (static_cast<const Mac::Frame *>(aFrame)->IsSequencePresent())
{
*aSequence = static_cast<const Mac::Frame *>(aFrame)->GetSequence();
error = kErrorNone;
}
else
{
error = kErrorParse;
}
return error;
}
void FuzzerPlatformInit(void)
@@ -101,10 +113,13 @@ void FuzzerPlatformProcess(otInstance *aInstance)
if (otMacFrameIsAckRequested(&sRadioTransmitFrame))
{
otError error;
sRadioAckFrame.mLength = IEEE802154_ACK_LENGTH;
sRadioAckFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK;
sRadioAckFrame.mPsdu[1] = 0;
sRadioAckFrame.mPsdu[2] = otMacFrameGetSequence(&sRadioTransmitFrame);
error = otMacFrameGetSequence(&sRadioTransmitFrame, &sRadioAckFrame.mPsdu[2]);
OT_ASSERT(error == OT_ERROR_NONE);
sRadioAckFrame.mChannel = sRadioTransmitFrame.mChannel;
otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, &sRadioAckFrame, OT_ERROR_NONE);