diff --git a/src/core/thread/mesh_forwarder.hpp b/src/core/thread/mesh_forwarder.hpp index 30db918b0..5730d87a3 100644 --- a/src/core/thread/mesh_forwarder.hpp +++ b/src/core/thread/mesh_forwarder.hpp @@ -544,7 +544,7 @@ private: void SendMesh(Message &aMessage, Mac::TxFrame &aFrame); void SendDestinationUnreachable(uint16_t aMeshSource, const Ip6::Headers &aIp6Headers); Error UpdateIp6Route(Message &aMessage); - Error UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage); + Error UpdateIp6RouteFtd(const Ip6::Header &aIp6Header, Message &aMessage); void EvaluateRoutingCost(uint16_t aDest, uint8_t &aBestCost, uint16_t &aBestDest) const; Error AnycastRouteLookup(uint8_t aServiceId, AnycastType aType, uint16_t &aMeshDest) const; Error UpdateMeshRoute(Message &aMessage); diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index d77da246b..e46ff7e0d 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -497,7 +497,7 @@ exit: return (bestDest != Mac::kShortAddrInvalid) ? kErrorNone : kErrorNoRoute; } -Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage) +Error MeshForwarder::UpdateIp6RouteFtd(const Ip6::Header &aIp6Header, Message &aMessage) { Mle::MleRouter &mle = Get(); Error error = kErrorNone; @@ -507,15 +507,15 @@ Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage { mMeshDest = aMessage.GetMeshDest(); } - else if (mle.IsRoutingLocator(ip6Header.GetDestination())) + else if (mle.IsRoutingLocator(aIp6Header.GetDestination())) { - uint16_t rloc16 = ip6Header.GetDestination().GetIid().GetLocator(); + uint16_t rloc16 = aIp6Header.GetDestination().GetIid().GetLocator(); VerifyOrExit(mle.IsRouterIdValid(Mle::RouterIdFromRloc16(rloc16)), error = kErrorDrop); mMeshDest = rloc16; } - else if (mle.IsAnycastLocator(ip6Header.GetDestination())) + else if (mle.IsAnycastLocator(aIp6Header.GetDestination())) { - uint16_t aloc16 = ip6Header.GetDestination().GetIid().GetLocator(); + uint16_t aloc16 = aIp6Header.GetDestination().GetIid().GetLocator(); if (aloc16 == Mle::kAloc16Leader) { @@ -554,25 +554,25 @@ Error MeshForwarder::UpdateIp6RouteFtd(Ip6::Header &ip6Header, Message &aMessage ExitNow(error = kErrorDrop); } } - else if ((neighbor = Get().FindNeighbor(ip6Header.GetDestination())) != nullptr) + else if ((neighbor = Get().FindNeighbor(aIp6Header.GetDestination())) != nullptr) { mMeshDest = neighbor->GetRloc16(); } - else if (Get().IsOnMesh(ip6Header.GetDestination())) + else if (Get().IsOnMesh(aIp6Header.GetDestination())) { - SuccessOrExit(error = Get().Resolve(ip6Header.GetDestination(), mMeshDest)); + SuccessOrExit(error = Get().Resolve(aIp6Header.GetDestination(), mMeshDest)); } else { IgnoreError( - Get().RouteLookup(ip6Header.GetSource(), ip6Header.GetDestination(), mMeshDest)); + Get().RouteLookup(aIp6Header.GetSource(), aIp6Header.GetDestination(), mMeshDest)); } VerifyOrExit(mMeshDest != Mac::kShortAddrInvalid, error = kErrorDrop); mMeshSource = Get().GetShortAddress(); - SuccessOrExit(error = mle.CheckReachability(mMeshDest, ip6Header)); + SuccessOrExit(error = mle.CheckReachability(mMeshDest, aIp6Header)); aMessage.SetMeshDest(mMeshDest); mMacAddrs.mDestination.SetShort(mle.GetNextHop(mMeshDest)); diff --git a/src/core/thread/mle_router.hpp b/src/core/thread/mle_router.hpp index 21fe0f95b..1ac8d195e 100644 --- a/src/core/thread/mle_router.hpp +++ b/src/core/thread/mle_router.hpp @@ -785,7 +785,7 @@ public: Error SendChildUpdateRequest(void) { return Mle::SendChildUpdateRequest(); } - Error CheckReachability(uint16_t aMeshDest, Ip6::Header &aIp6Header) + Error CheckReachability(uint16_t aMeshDest, const Ip6::Header &aIp6Header) { return Mle::CheckReachability(aMeshDest, aIp6Header); }