Skip to content

Commit

Permalink
[fuzz] expect no ACK if TX frame is invalid (openthread#10951)
Browse files Browse the repository at this point in the history
The Sequence Number Suppression field and AR can be both 1 in fuzz test,
in which case, the frame is not valid. And no ack should be expected.
This commit changes the expectation in this case.
  • Loading branch information
bukepo authored Nov 22, 2024
1 parent b617ba3 commit 025d84b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/fuzz/fuzzer_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <openthread/platform/settings.h>

#include "mac/mac_frame.hpp"
#include "openthread/error.h"

using namespace ot;

Expand Down Expand Up @@ -118,11 +119,17 @@ void FuzzerPlatformProcess(otInstance *aInstance)
sRadioAckFrame.mLength = IEEE802154_ACK_LENGTH;
sRadioAckFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK;
sRadioAckFrame.mPsdu[1] = 0;
error = otMacFrameGetSequence(&sRadioTransmitFrame, &sRadioAckFrame.mPsdu[2]);
OT_ASSERT(error == OT_ERROR_NONE);
sRadioAckFrame.mChannel = sRadioTransmitFrame.mChannel;
error = otMacFrameGetSequence(&sRadioTransmitFrame, &sRadioAckFrame.mPsdu[2]);

otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, &sRadioAckFrame, OT_ERROR_NONE);
if (error == OT_ERROR_NONE)
{
otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, &sRadioAckFrame, OT_ERROR_NONE);
}
else
{
otPlatRadioTxDone(aInstance, &sRadioTransmitFrame, nullptr, OT_ERROR_NO_ACK);
}
}
else
{
Expand Down

0 comments on commit 025d84b

Please sign in to comment.