[multi-radio] perform tag duplication check for first fragment (#9590)

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).
This commit is contained in:
Abtin Keshavarzian
2023-11-10 07:26:39 -08:00
committed by GitHub
parent 0f55e79263
commit cd425ebdc1
+10 -15
View File
@@ -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