[mle] no failing logs for broadcast security check (#7362)

This commit eliminates logging of broadcast security check failures
because it can be common to receive such messages from ajacent Thread
networks.
This commit is contained in:
Yakun Xu
2022-01-27 13:15:16 -08:00
committed by GitHub
parent 019e5ab4fa
commit 5cd4392b6b
+14 -2
View File
@@ -2748,6 +2748,7 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
uint8_t tag[kMleSecurityTagSize];
uint8_t command;
Neighbor * neighbor;
bool skipLoggingError = false;
otLogDebgMle("Receive UDP message");
@@ -2828,7 +2829,15 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
aesCcm.Finalize(tag);
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VerifyOrExit(memcmp(messageTag, tag, sizeof(tag)) == 0, error = kErrorSecurity);
if (memcmp(messageTag, tag, sizeof(tag)) != 0)
{
// We skip logging security check failures for broadcast MLE
// messages since it can be common to receive such messages
// from adjacent Thread networks.
skipLoggingError = (aMessageInfo.GetSockAddr().IsMulticast() &&
aMessageInfo.GetThreadLinkInfo()->GetPanId() == Mac::kPanIdBroadcast);
ExitNow(error = kErrorSecurity);
}
#endif
if (keySequence > Get<KeyManager>().GetCurrentKeySequence())
@@ -3017,7 +3026,10 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
#endif
exit:
LogProcessError(kTypeGenericUdp, error);
if (!skipLoggingError)
{
LogProcessError(kTypeGenericUdp, error);
}
}
void Mle::HandleAdvertisement(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo, Neighbor *aNeighbor)