From 4c0af025132fa7553cb7ad97fde2808b4e7e469f Mon Sep 17 00:00:00 2001 From: Zhangwx Date: Thu, 13 Mar 2025 13:52:57 +0800 Subject: [PATCH] [mesh-forwarder] fix ip6 route selection for the deprecated OMR addresses (#11332) --- src/core/net/ip6.hpp | 8 +++++++- src/core/thread/mesh_forwarder_ftd.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/net/ip6.hpp b/src/core/net/ip6.hpp index d06270965..3982b6189 100644 --- a/src/core/net/ip6.hpp +++ b/src/core/net/ip6.hpp @@ -293,6 +293,13 @@ public: */ static const char *EcnToString(Ecn aEcn); + /** + * Indicates whether the address is on the thread link or not. + * + * @returns TRUE if the address is on the thread link, FALSE otherwise. + */ + bool IsOnLink(const Address &aAddress) const; + #if OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE typedef otBorderRoutingCounters BrCounters; ///< Border Routing counters. @@ -376,7 +383,6 @@ private: OwnedPtr &aMessagePtr, uint8_t aIpProto, Message::Ownership aMessageOwnership); - bool IsOnLink(const Address &aAddress) const; Error RouteLookup(const Address &aSource, const Address &aDestination) const; #if OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE void UpdateBorderRoutingCounters(const Header &aHeader, uint16_t aMessageLength, bool aIsInbound); diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 04f1feda0..841614a27 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -433,7 +433,7 @@ Error MeshForwarder::UpdateIp6RouteFtd(const Ip6::Header &aIp6Header, Message &a { mMeshDest = neighbor->GetRloc16(); } - else if (Get().IsOnMesh(aIp6Header.GetDestination())) + else if (Get().IsOnLink(aIp6Header.GetDestination())) { SuccessOrExit(error = Get().Resolve(aIp6Header.GetDestination(), mMeshDest)); }