From 403723dc82f45048e765a5ced49144cf54b9d106 Mon Sep 17 00:00:00 2001 From: Kamil Burzynski Date: Tue, 19 Jun 2018 18:59:13 +0200 Subject: [PATCH] [mle] minor TLV and route table cleanup (#2807) --- src/core/thread/network_diagnostic_tlvs.hpp | 4 ++-- src/core/thread/router_table.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index 1d7baf4ad..8a9e48665 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -716,8 +716,8 @@ private: kRouteCostMask = 0xf << kRouteCostOffset, }; uint8_t mRouterIdSequence; - uint8_t mRouterIdMask[BitVectorBytes(Mle::kMaxRouterId)]; - uint8_t mRouteData[Mle::kMaxRouters]; + uint8_t mRouterIdMask[BitVectorBytes(Mle::kMaxRouterId + 1)]; + uint8_t mRouteData[Mle::kMaxRouterId + 1]; } OT_TOOL_PACKED_END; /** diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index fd5609dc5..1f9e24e6d 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -534,14 +534,11 @@ void RouterTable::ProcessTlv(const Mle::RouteTlv &aTlv) } else { - if (IsAllocated(i)) - { - Router *router = GetRouter(i); + Router *router = GetRouter(i); - assert(router != NULL); - router->SetNextHop(Mle::kInvalidRouterId); - RemoveNeighbor(*router); - } + assert(router != NULL); + router->SetNextHop(Mle::kInvalidRouterId); + RemoveNeighbor(*router); mAllocatedRouterIds[i / 8] &= ~(1 << (i % 8)); }