[mac] avoid logging frame that has not been validated (#11532)

This commit is contained in:
Jonathan Hui
2025-05-27 21:30:41 -07:00
committed by GitHub
parent 8c70c780c8
commit a2f783e6d5
+5 -2
View File
@@ -1852,7 +1852,8 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, Error aError)
Address dstaddr;
PanId panid;
Neighbor *neighbor;
Error error = aError;
Error error = aError;
bool isFrameValidated = false;
mCounters.mRxTotal++;
@@ -1864,6 +1865,8 @@ void Mac::HandleReceivedFrame(RxFrame *aFrame, Error aError)
// the buffer received from the radio.
SuccessOrExit(error = aFrame->ValidatePsdu());
isFrameValidated = true;
IgnoreError(aFrame->GetSrcAddr(srcaddr));
IgnoreError(aFrame->GetDstAddr(dstaddr));
neighbor = !srcaddr.IsNone() ? Get<NeighborTable>().FindNeighbor(srcaddr) : nullptr;
@@ -2099,7 +2102,7 @@ exit:
if (error != kErrorNone)
{
LogFrameRxFailure(aFrame, error);
LogFrameRxFailure(isFrameValidated ? aFrame : nullptr, error);
switch (error)
{