diff --git a/src/core/radio/trel_link.cpp b/src/core/radio/trel_link.cpp index 46de5306b..aa3980f6e 100644 --- a/src/core/radio/trel_link.cpp +++ b/src/core/radio/trel_link.cpp @@ -326,12 +326,10 @@ void Link::ProcessReceivedPacket(Packet &aPacket, const Ip6::SockAddr &aSockAddr if (type != Header::kTypeAck) { - // No need to check state or channel for a TREL ack packet. - // Note that TREL ack may be received much later than the tx - // and device can be on a different rx channel. + // We do not check the radio state for a TREL ACK packet, as it + // can be received much later than the transmission. VerifyOrExit((mState == kStateReceive) || (mState == kStateTransmit)); - VerifyOrExit(aPacket.GetHeader().GetChannel() == mRxChannel); } if (mPanId != Mac::kPanIdBroadcast) @@ -370,6 +368,14 @@ void Link::ProcessReceivedPacket(Packet &aPacket, const Ip6::SockAddr &aSockAddr SendAck(aPacket); } + // Drop the packet if there is a channel mismatch. We perform this + // check after all other validations to ensure we still `SendAck()`. + // TREL ACKs are used to monitor the TREL link status between peers + // and should be sent even if the packet is sent on a different + // channel (e.g., an MLE Announce message). + + VerifyOrExit(aPacket.GetHeader().GetChannel() == mRxChannel); + mRxFrame.mPsdu = aPacket.GetPayload(); mRxFrame.mLength = aPacket.GetPayloadLength(); mRxFrame.mChannel = aPacket.GetHeader().GetChannel();