mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 10:29:52 +00:00
[mle] reset MLE adv timer when cost changes to/from infinite (#4129)
This commit is contained in:
@@ -1427,7 +1427,8 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
|
||||
uint8_t cost;
|
||||
uint8_t linkQuality;
|
||||
bool update;
|
||||
bool changed = false;
|
||||
bool resetAdvInterval = false;
|
||||
bool changed = false;
|
||||
|
||||
neighbor = mRouterTable.GetRouter(aRouterId);
|
||||
VerifyOrExit(neighbor != NULL);
|
||||
@@ -1461,7 +1462,16 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
|
||||
|
||||
if (neighbor->GetLinkQualityOut() != linkQuality)
|
||||
{
|
||||
uint8_t oldLinkCost = mRouterTable.GetLinkCost(*neighbor);
|
||||
neighbor->SetLinkQualityOut(linkQuality);
|
||||
nextHop = mRouterTable.GetRouter(neighbor->GetNextHop());
|
||||
|
||||
// reset MLE advertisement timer if neighbor route cost changed to or from infinite
|
||||
if (nextHop == NULL &&
|
||||
(oldLinkCost >= kMaxRouteCost) != (mRouterTable.GetLinkCost(*neighbor) >= kMaxRouteCost))
|
||||
{
|
||||
resetAdvInterval = true;
|
||||
}
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
@@ -1494,7 +1504,7 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
|
||||
{
|
||||
if (nextHop == NULL && mRouterTable.GetLinkCost(*router) >= kMaxRouteCost)
|
||||
{
|
||||
ResetAdvertiseInterval();
|
||||
resetAdvInterval = true;
|
||||
}
|
||||
|
||||
router->SetNextHop(aRouterId);
|
||||
@@ -1505,7 +1515,7 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
|
||||
{
|
||||
if (mRouterTable.GetLinkCost(*router) >= kMaxRouteCost)
|
||||
{
|
||||
ResetAdvertiseInterval();
|
||||
resetAdvInterval = true;
|
||||
}
|
||||
|
||||
router->SetNextHop(kInvalidRouterId);
|
||||
@@ -1538,6 +1548,11 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
|
||||
|
||||
} while (update);
|
||||
|
||||
if (resetAdvInterval)
|
||||
{
|
||||
ResetAdvertiseInterval();
|
||||
}
|
||||
|
||||
#if (OPENTHREAD_CONFIG_LOG_MLE && (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_INFO))
|
||||
|
||||
VerifyOrExit(changed);
|
||||
|
||||
Reference in New Issue
Block a user