mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[mle] suppress Announce response to orphan child on same channel and PAN ID (#9388)
This commit updates MLE to skip sending an Announce response when receiving an Announce message from a detached/orphan device and the included channel and PAN ID in the received Announce message are the same as the current network's channel and PAN ID.
This commit is contained in:
+18
-4
@@ -3712,6 +3712,9 @@ void Mle::HandleAnnounce(RxInfo &aRxInfo)
|
||||
const MeshCoP::Timestamp *localTimestamp;
|
||||
uint8_t channel;
|
||||
uint16_t panId;
|
||||
bool isFromOrphan;
|
||||
bool channelAndPanIdMatch;
|
||||
int timestampCompare;
|
||||
|
||||
Log(kMessageReceive, kTypeAnnounce, aRxInfo.mMessageInfo.GetPeerAddr());
|
||||
|
||||
@@ -3727,22 +3730,33 @@ void Mle::HandleAnnounce(RxInfo &aRxInfo)
|
||||
|
||||
localTimestamp = Get<MeshCoP::ActiveDatasetManager>().GetTimestamp();
|
||||
|
||||
if (timestamp.IsOrphanTimestamp() || MeshCoP::Timestamp::Compare(×tamp, localTimestamp) < 0)
|
||||
isFromOrphan = timestamp.IsOrphanTimestamp();
|
||||
timestampCompare = MeshCoP::Timestamp::Compare(×tamp, localTimestamp);
|
||||
channelAndPanIdMatch = (channel == Get<Mac::Mac>().GetPanChannel()) && (panId == Get<Mac::Mac>().GetPanId());
|
||||
|
||||
if (isFromOrphan || (timestampCompare < 0))
|
||||
{
|
||||
if (isFromOrphan)
|
||||
{
|
||||
VerifyOrExit(!channelAndPanIdMatch);
|
||||
}
|
||||
|
||||
SendAnnounce(channel);
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_SEND_UNICAST_ANNOUNCE_RESPONSE
|
||||
SendAnnounce(channel, aRxInfo.mMessageInfo.GetPeerAddr());
|
||||
#endif
|
||||
}
|
||||
else if (MeshCoP::Timestamp::Compare(×tamp, localTimestamp) > 0)
|
||||
else if (timestampCompare > 0)
|
||||
{
|
||||
// No action is required if device is detached, and current
|
||||
// channel and pan-id match the values from the received MLE
|
||||
// Announce message.
|
||||
|
||||
VerifyOrExit(!IsDetached() || (Get<Mac::Mac>().GetPanChannel() != channel) ||
|
||||
(Get<Mac::Mac>().GetPanId() != panId));
|
||||
if (IsDetached())
|
||||
{
|
||||
VerifyOrExit(!channelAndPanIdMatch);
|
||||
}
|
||||
|
||||
if (mAttachState == kAttachStateProcessAnnounce)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user