[mesh-forwarder] avoid unnecessary comparisons on ALOC (#4723)

This commit is contained in:
Jonathan Hui
2020-03-23 21:00:40 -07:00
committed by GitHub
parent 72a2725ecd
commit c87665f0d5
+5 -6
View File
@@ -391,10 +391,6 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
{
mMeshDest = Mle::Mle::Rloc16FromRouterId(mle.GetLeaderId());
}
else if ((aloc16 >= Mle::kAloc16CommissionerStart) && (aloc16 <= Mle::kAloc16CommissionerEnd))
{
SuccessOrExit(error = MeshCoP::GetBorderAgentRloc(Get<ThreadNetif>(), mMeshDest));
}
else if (aloc16 <= Mle::kAloc16DhcpAgentEnd)
{
uint16_t agentRloc16;
@@ -416,11 +412,14 @@ otError MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header)
mMeshDest = Mle::Mle::Rloc16FromRouterId(routerId);
}
}
else if ((aloc16 >= Mle::kAloc16ServiceStart) && (aloc16 <= Mle::kAloc16ServiceEnd))
else if (aloc16 <= Mle::kAloc16ServiceEnd)
{
SuccessOrExit(error = GetDestinationRlocByServiceAloc(aloc16, mMeshDest));
}
else if (aloc16 <= Mle::kAloc16CommissionerEnd)
{
SuccessOrExit(error = MeshCoP::GetBorderAgentRloc(Get<ThreadNetif>(), mMeshDest));
}
else
{
// TODO: support for Neighbor Discovery Agent ALOC