From 9f76d45de69f584709d240452b7a7f9c4e018454 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 28 Sep 2023 10:53:03 -0700 Subject: [PATCH] [mle] simplify `ProcessRouteTlv()` call in `HandleAdvertisement()` (#9465) This commit simplifies the checks to decide whether or not to call `ProcessRouteTlv()` in `MleRouter::HandleAdvertisement()`. The whole check is guarded by `aRxInfo.IsNeighborStateValid()`, which ensures that we only process Route TLVs for Advertisements received from valid neighbors. In particular, we can remove the additional checks in the case where the device is itself `IsChild()` (i.e., acting as an FED). In this case, `aRxInfo.mNeighbor` will be determined using `NeighborTable::FindNeighbor()`, which checks and accepts the parent as the only valid neighbor of the FED child. --- src/core/thread/mle_router.cpp | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index a293dd94b..cb96350a2 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -1277,33 +1277,7 @@ Error MleRouter::HandleAdvertisement(RxInfo &aRxInfo, uint16_t aSourceAddress, c if (aRxInfo.IsNeighborStateValid() && mRouterTable.IsRouteTlvIdSequenceMoreRecent(routeTlv)) { - bool processRouteTlv = false; - - if (IsChild()) - { - if (aSourceAddress == mParent.GetRloc16()) - { - processRouteTlv = true; - } - else - { - router = mRouterTable.FindRouterById(routerId); - - if (router != nullptr && router->IsStateValid()) - { - processRouteTlv = true; - } - } - } - else // Device is router or leader - { - processRouteTlv = true; - } - - if (processRouteTlv) - { - SuccessOrExit(error = ProcessRouteTlv(routeTlv, aRxInfo)); - } + SuccessOrExit(error = ProcessRouteTlv(routeTlv, aRxInfo)); } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -