Skip to content

Commit

Permalink
[mesh-forwarder] allow last 6LoWPAN fragment to use longer length (op…
Browse files Browse the repository at this point in the history
…enthread#4945)

This commit relaxes the length check for the last 6LoWPAN fragment of
a message. The length of a 6LoWPAN fragment is truncated to be a
multiple of eight bytes (since fragment offset can be only expressed
as multiples of eight). However this requirement does not apply to the
last fragment. This change helps avoid an unnecessary extra fragment
for messages of certain length.
  • Loading branch information
abtink authored and jwhui committed May 11, 2020
1 parent 2f683e6 commit 4808604
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/thread/mesh_forwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,11 @@ uint16_t MeshForwarder::PrepareDataFrame(Mac::TxFrame & aFrame,
payload += fragmentHeaderLength;
headerLength += fragmentHeaderLength;

fragmentLength = (aFrame.GetMaxPayloadLength() - headerLength) & ~0x7;
fragmentLength = aFrame.GetMaxPayloadLength() - headerLength;

if (payloadLength > fragmentLength)
{
payloadLength = fragmentLength;
payloadLength = (fragmentLength & ~0x7);
}

// Copy IPv6 Payload
Expand Down

0 comments on commit 4808604

Please sign in to comment.