mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 14:10:09 +00:00
[mesh-forwarder] drop direct supervision message (#4029)
This commit changes `MeshForwarder` to drop a direct supervision message. A direct supervision message is possible in the case where a sleepy child switches its mode (becomes non-sleepy) while there is a pending indirect supervision message in the send queue for it. The message would be then converted to a direct tx. This commit also removes the definitions/methods (e.g. `SendEmptyFrame()`) that were being used for prepartion of supervision message which are no longer needed.
This commit is contained in:
committed by
Jonathan Hui
parent
ce18a1edaa
commit
66cd36b638
@@ -528,9 +528,14 @@ otError MeshForwarder::HandleFrameRequest(Mac::Frame &aFrame)
|
||||
break;
|
||||
|
||||
case Message::kTypeSupervision:
|
||||
SendEmptyFrame(aFrame, kSupervisionMsgAckRequest);
|
||||
// A direct supervision message is possible in the case where
|
||||
// a sleepy child switches its mode (becomes non-sleepy) while
|
||||
// there is a pending indirect supervision message in the send
|
||||
// queue for it. The message would be then converted to a
|
||||
// direct tx.
|
||||
mMessageNextOffset = mSendMessage->GetLength();
|
||||
break;
|
||||
error = OT_ERROR_ABORT;
|
||||
ExitNow();
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -850,44 +855,6 @@ start:
|
||||
return nextOffset;
|
||||
}
|
||||
|
||||
void MeshForwarder::SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest)
|
||||
{
|
||||
uint16_t fcf;
|
||||
uint8_t secCtl;
|
||||
Mac::Address macSource;
|
||||
|
||||
macSource.SetShort(Get<Mac::Mac>().GetShortAddress());
|
||||
|
||||
if (macSource.IsShortAddrInvalid())
|
||||
{
|
||||
macSource.SetExtended(Get<Mac::Mac>().GetExtAddress());
|
||||
}
|
||||
|
||||
fcf = Mac::Frame::kFcfFrameData | Mac::Frame::kFcfFrameVersion2006;
|
||||
fcf |= (mMacDest.IsShort()) ? Mac::Frame::kFcfDstAddrShort : Mac::Frame::kFcfDstAddrExt;
|
||||
fcf |= (macSource.IsShort()) ? Mac::Frame::kFcfSrcAddrShort : Mac::Frame::kFcfSrcAddrExt;
|
||||
|
||||
if (aAckRequest)
|
||||
{
|
||||
fcf |= Mac::Frame::kFcfAckRequest;
|
||||
}
|
||||
|
||||
fcf |= Mac::Frame::kFcfSecurityEnabled;
|
||||
secCtl = Mac::Frame::kKeyIdMode1;
|
||||
secCtl |= Mac::Frame::kSecEncMic32;
|
||||
|
||||
fcf |= Mac::Frame::kFcfPanidCompression;
|
||||
|
||||
aFrame.InitMacHeader(fcf, secCtl);
|
||||
|
||||
aFrame.SetDstPanId(Get<Mac::Mac>().GetPanId());
|
||||
aFrame.SetSrcPanId(Get<Mac::Mac>().GetPanId());
|
||||
aFrame.SetDstAddr(mMacDest);
|
||||
aFrame.SetSrcAddr(macSource);
|
||||
aFrame.SetPayloadLength(0);
|
||||
aFrame.SetFramePending(false);
|
||||
}
|
||||
|
||||
Neighbor *MeshForwarder::UpdateNeighborOnSentFrame(Mac::Frame &aFrame, otError aError, const Mac::Address &aMacDest)
|
||||
{
|
||||
Neighbor *neighbor = NULL;
|
||||
|
||||
@@ -312,21 +312,12 @@ private:
|
||||
{
|
||||
kStateUpdatePeriod = 1000, ///< State update period in milliseconds.
|
||||
kDefaultMsgPriority = Message::kPriorityNormal, ///< Default message priority.
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
/**
|
||||
* The number of fragment priority entries.
|
||||
*
|
||||
*/
|
||||
kNumFragmentPriorityEntries = OPENTHREAD_CONFIG_NUM_FRAGMENT_PRIORITY_ENTRIES,
|
||||
|
||||
/**
|
||||
* Indicates whether to set/enable 15.4 ack request in the MAC header of a supervision message.
|
||||
*
|
||||
*/
|
||||
kSupervisionMsgAckRequest = (OPENTHREAD_CONFIG_SUPERVISION_MSG_NO_ACK_REQUEST == 0) ? true : false,
|
||||
};
|
||||
|
||||
enum MessageAction ///< Defines the action parameter in `LogMessageInfo()` method.
|
||||
@@ -394,7 +385,6 @@ private:
|
||||
uint16_t aMeshDest = 0xffff);
|
||||
|
||||
void SendMesh(Message &aMessage, Mac::Frame &aFrame);
|
||||
void SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest);
|
||||
otError UpdateIp6Route(Message &aMessage);
|
||||
otError UpdateIp6RouteFtd(Ip6::Header &ip6Header);
|
||||
otError UpdateMeshRoute(Message &aMessage);
|
||||
|
||||
Reference in New Issue
Block a user