diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 30d7d66a9..1ed8e04bc 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -3386,11 +3386,26 @@ void Mle::DelayedSender::Execute(const Schedule &aSchedule) bool Mle::DelayedSender::Match(const Schedule &aSchedule, MessageType aMessageType, const Ip6::Address &aDestination) { + // If `aDestination` is `::` (the unspecified address), the + // address check is skipped, effectively accepting any + // destination address. + + bool matches = false; Header header; header.ReadFrom(aSchedule); - return (header.mMessageType == aMessageType) && (header.mDestination == aDestination); + VerifyOrExit(header.mMessageType == aMessageType); + + if (!aDestination.IsUnspecified()) + { + VerifyOrExit(header.mDestination == aDestination); + } + + matches = true; + +exit: + return matches; } bool Mle::DelayedSender::HasMatchingSchedule(MessageType aMessageType, const Ip6::Address &aDestination) const @@ -3415,12 +3430,24 @@ void Mle::DelayedSender::RemoveMatchingSchedules(MessageType aMessageType, const { if (Match(schedule, aMessageType, aDestination)) { + LogRemove(schedule); mSchedules.DequeueAndFree(schedule); - Log(kMessageRemoveDelayed, aMessageType, aDestination); } } } +#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO) +void Mle::DelayedSender::LogRemove(const Schedule &aSchedule) +{ + Header header; + + header.ReadFrom(aSchedule); + Log(kMessageRemoveDelayed, header.mMessageType, header.mDestination); +} +#else +void Mle::DelayedSender::LogRemove(const Schedule &) {} +#endif + //--------------------------------------------------------------------------------------------------------------------- // TxMessage diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 1e62c5fbe..75af8864f 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1733,6 +1733,7 @@ private: void Execute(const Schedule &aSchedule); bool HasMatchingSchedule(MessageType aMessageType, const Ip6::Address &aDestination) const; void RemoveMatchingSchedules(MessageType aMessageType, const Ip6::Address &aDestination); + void LogRemove(const Schedule &aSchedule); static bool Match(const Schedule &aSchedule, MessageType aMessageType, const Ip6::Address &aDestination);