Skip to content

Commit bdea2ae

Browse files
authored
[trel] defer channel check in Link::ProcessReceivedPacket() (openthread#13011)
This commit updates `Trel::Link::ProcessReceivedPacket()` to move channel mismatch validation until after the acknowledgment logic. TREL ACKs serve as a mechanism to monitor link status between peers. By deferring the channel check, we ensure that TREL packets requiring an acknowledgment are correctly acknowledged at the TREL layer even if they are not further processed. A primary use case is the MLE Announce message, which is sent on a different channel as a broadcast. At the TREL layer, this broadcast is converted to unicast TREL packet transmissions to each peer on the same PAN, with packets marked to request a TREL ACK. This change ensures the receiving TREL peer sends an ACK for such packets, maintaining link monitoring, while still dropping the packet at the TREL link layer due to the channel mismatch.
1 parent 73cc8a5 commit bdea2ae

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/core/radio/trel_link.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,10 @@ void Link::ProcessReceivedPacket(Packet &aPacket, const Ip6::SockAddr &aSockAddr
326326

327327
if (type != Header::kTypeAck)
328328
{
329-
// No need to check state or channel for a TREL ack packet.
330-
// Note that TREL ack may be received much later than the tx
331-
// and device can be on a different rx channel.
329+
// We do not check the radio state for a TREL ACK packet, as it
330+
// can be received much later than the transmission.
332331

333332
VerifyOrExit((mState == kStateReceive) || (mState == kStateTransmit));
334-
VerifyOrExit(aPacket.GetHeader().GetChannel() == mRxChannel);
335333
}
336334

337335
if (mPanId != Mac::kPanIdBroadcast)
@@ -370,6 +368,14 @@ void Link::ProcessReceivedPacket(Packet &aPacket, const Ip6::SockAddr &aSockAddr
370368
SendAck(aPacket);
371369
}
372370

371+
// Drop the packet if there is a channel mismatch. We perform this
372+
// check after all other validations to ensure we still `SendAck()`.
373+
// TREL ACKs are used to monitor the TREL link status between peers
374+
// and should be sent even if the packet is sent on a different
375+
// channel (e.g., an MLE Announce message).
376+
377+
VerifyOrExit(aPacket.GetHeader().GetChannel() == mRxChannel);
378+
373379
mRxFrame.mPsdu = aPacket.GetPayload();
374380
mRxFrame.mLength = aPacket.GetPayloadLength();
375381
mRxFrame.mChannel = aPacket.GetHeader().GetChannel();

0 commit comments

Comments
 (0)