mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 23:57:46 +00:00
[mac] support frames without sequence number (#10544)
This commit adds the capability to support frames without sequence number.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user