[mesh-forwarder] ensure message allocation with correct priority (#7203)

This commit fixes the incorrect call to `MessagePool::New()` to
allocate a message in `MeshForwarder::HandleMesh()` method. The
existing code calls `New(Message::kType6lowpan, priority)` with two
parameters which maps to the flavor `New()` method with three
parameters with last one (`Message::Settings`) being optional
(having a default value). Basically, the existing code treats the
`priority` (second argument) as `aReserveHeader` parameter in the
`New()` instead of the message priority.
This commit is contained in:
Abtin Keshavarzian
2021-11-26 22:30:50 -08:00
committed by GitHub
parent 0e2392bdc2
commit 428944b1f6
+1 -1
View File
@@ -805,7 +805,7 @@ void MeshForwarder::HandleMesh(uint8_t * aFrame,
meshHeader.DecrementHopsLeft();
GetForwardFramePriority(aFrame, aFrameLength, meshSource, meshDest, priority);
message = Get<MessagePool>().New(Message::kType6lowpan, priority);
message = Get<MessagePool>().New(Message::kType6lowpan, /* aReserveHeader */ 0, priority);
VerifyOrExit(message != nullptr, error = kErrorNoBufs);
SuccessOrExit(error = message->SetLength(meshHeader.GetHeaderLength() + aFrameLength));