[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.
This commit is contained in:
Abtin Keshavarzian
2023-09-28 10:53:03 -07:00
committed by GitHub
parent f19548b4b1
commit 9f76d45de6
+1 -27
View File
@@ -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));
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -