[mle-router] ensure route table is logged only when changed (#6722)

This commit is contained in:
Abtin Keshavarzian
2021-06-14 10:23:33 -07:00
committed by GitHub
parent 1394a2aec6
commit f7cfddf57d
+12 -4
View File
@@ -1441,7 +1441,7 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
if (nextHop == nullptr || nextHop == neighbor)
{
// route has no next hop or next hop is neighbor (sender)
// router has no next hop or next hop is neighbor (sender)
if (cost + mRouterTable.GetLinkCost(*neighbor) < kMaxRouteCost)
{
@@ -1450,9 +1450,17 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
resetAdvInterval = true;
}
router->SetNextHop(aRouterId);
router->SetCost(cost);
changed = true;
if (router->GetNextHop() != aRouterId)
{
router->SetNextHop(aRouterId);
changed = true;
}
if (router->GetCost() != cost)
{
router->SetCost(cost);
changed = true;
}
}
else if (nextHop == neighbor)
{