From 7ef2bcac03b702419bfcc698d7e5050f4c3cf497 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Sun, 23 Jul 2017 22:02:30 -0700 Subject: [PATCH] [mle] remove assert in MleRouter::ResolveRoutingLoops() (#2022) --- src/core/thread/mle_router.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 2e376d1f7..55cffc5f3 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -3717,16 +3717,23 @@ exit: void MleRouter::ResolveRoutingLoops(uint16_t aSourceMac, uint16_t aDestRloc16) { - if (aSourceMac == GetNextHop(aDestRloc16)) - { - // loop detected - Router *router = GetRouter(GetRouterId(aDestRloc16)); - assert(router != NULL); + Router *router; - // invalidate next hop - router->SetNextHop(kInvalidRouterId); - ResetAdvertiseInterval(); + if (aSourceMac != GetNextHop(aDestRloc16)) + { + ExitNow(); } + + // loop exists + router = GetRouter(GetRouterId(aDestRloc16)); + VerifyOrExit(router != NULL); + + // invalidate next hop + router->SetNextHop(kInvalidRouterId); + ResetAdvertiseInterval(); + +exit: + return; } otError MleRouter::CheckReachability(uint16_t aMeshSource, uint16_t aMeshDest, Ip6::Header &aIp6Header)