Skip to content

Commit

Permalink
[multi-radio] perform tag duplication check for first fragment (#9590)
Browse files Browse the repository at this point in the history
This commit updates the duplicate detection mechanism for the frag
header tags under `MULTI_RADIO` config. The tag check is now
performed upon receiving the first fragment. For subsequent
fragments, older tags are permitted to be processed, but they will be
discarded if there is no matching entry in the reassembly list.

This change addresses an issue where lowpan fragment frames using
older tags could be erroneously discarded if they are interrupted by
higher-priority messages (e.g., an MLE message).
  • Loading branch information
abtink authored Nov 10, 2023
1 parent 0f55e79 commit cd425eb
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/core/thread/mesh_forwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,31 +1419,26 @@ void MeshForwarder::HandleFragment(FrameData &aFrameData,
{
Neighbor *neighbor = Get<NeighborTable>().FindNeighbor(aMacAddrs.mSource, Neighbor::kInStateAnyExceptInvalid);

if (neighbor != nullptr)
if ((neighbor != nullptr) && (fragmentHeader.GetDatagramOffset() == 0))
{
uint16_t tag = fragmentHeader.GetDatagramTag();

if (neighbor->IsLastRxFragmentTagSet())
{
VerifyOrExit(!neighbor->IsLastRxFragmentTagAfter(tag), error = kErrorDuplicated);

if (neighbor->GetLastRxFragmentTag() == tag)
{
VerifyOrExit(fragmentHeader.GetDatagramOffset() != 0, error = kErrorDuplicated);

// Duplication suppression for a "next fragment" is handled
// by the code below where the the datagram offset is
// checked against the offset of the corresponding message
// (same datagram tag and size) in Reassembly List. Note
// that if there is no matching message in the Reassembly
// List (e.g., in case the message is already fully
// assembled) the received "next fragment" frame would be
// dropped.
}
}

neighbor->SetLastRxFragmentTag(tag);
}

// Duplication suppression for a "next fragment" is handled
// by the code below where the the datagram offset is
// checked against the offset of the corresponding message
// (same datagram tag and size) in Reassembly List. Note
// that if there is no matching message in the Reassembly
// List (e.g., in case the message is already fully
// assembled) the received "next fragment" frame would be
// dropped.
}

#endif // OPENTHREAD_CONFIG_MULTI_RADIO
Expand Down

0 comments on commit cd425eb

Please sign in to comment.