[mle] verify hop limit is 255 (#2167)

This commit is contained in:
Buke Po
2017-09-05 15:37:09 -07:00
committed by Jonathan Hui
parent 2c8f50bb5b
commit ba7c2f657a
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -1942,7 +1942,7 @@ otError Mle::SendMessage(Message &aMessage, const Ip6::Address &aDestination)
messageInfo.SetSockAddr(mLinkLocal64.GetAddress());
messageInfo.SetPeerPort(kUdpPort);
messageInfo.SetInterfaceId(netif.GetInterfaceId());
messageInfo.SetHopLimit(255);
messageInfo.SetHopLimit(kMleHopLimit);
SuccessOrExit(error = mSocket.SendTo(aMessage, messageInfo));
@@ -2008,6 +2008,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
Neighbor *neighbor;
VerifyOrExit(aMessageInfo.GetLinkInfo() != NULL);
VerifyOrExit(aMessageInfo.GetHopLimit() == kMleHopLimit);
length = aMessage.Read(aMessage.GetOffset(), sizeof(header), &header);
VerifyOrExit(header.IsValid() && header.GetLength() <= length);
+1
View File
@@ -1336,6 +1336,7 @@ private:
enum
{
kMleMessagePriority = Message::kPriorityHigh,
kMleHopLimit = 255,
};
void GenerateNonce(const Mac::ExtAddress &aMacAddr, uint32_t aFrameCounter, uint8_t aSecurityLevel,