mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 02:17:47 +00:00
[ip6] simplify Ip6::ShouldForwardToThread() (#7706)
This commit is contained in:
+9
-23
@@ -1309,43 +1309,29 @@ exit:
|
||||
|
||||
bool Ip6::ShouldForwardToThread(const MessageInfo &aMessageInfo, bool aFromHost) const
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aFromHost);
|
||||
bool shouldForward = false;
|
||||
|
||||
bool rval = false;
|
||||
|
||||
if (aMessageInfo.GetSockAddr().IsMulticast())
|
||||
if (aMessageInfo.GetSockAddr().IsMulticast() || aMessageInfo.GetSockAddr().IsLinkLocal())
|
||||
{
|
||||
// multicast
|
||||
ExitNow(rval = true);
|
||||
}
|
||||
else if (aMessageInfo.GetSockAddr().IsLinkLocal())
|
||||
{
|
||||
// on-link link-local address
|
||||
ExitNow(rval = true);
|
||||
shouldForward = true;
|
||||
}
|
||||
else if (IsOnLink(aMessageInfo.GetSockAddr()))
|
||||
{
|
||||
// on-link global address
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE
|
||||
ExitNow(rval = (aFromHost ||
|
||||
!Get<BackboneRouter::Manager>().ShouldForwardDuaToBackbone(aMessageInfo.GetSockAddr())));
|
||||
shouldForward =
|
||||
(aFromHost || !Get<BackboneRouter::Manager>().ShouldForwardDuaToBackbone(aMessageInfo.GetSockAddr()));
|
||||
#else
|
||||
ExitNow(rval = true);
|
||||
OT_UNUSED_VARIABLE(aFromHost);
|
||||
shouldForward = true;
|
||||
#endif
|
||||
}
|
||||
else if (Get<ThreadNetif>().RouteLookup(aMessageInfo.GetPeerAddr(), aMessageInfo.GetSockAddr(), nullptr) ==
|
||||
kErrorNone)
|
||||
{
|
||||
// route
|
||||
ExitNow(rval = true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitNow(rval = false);
|
||||
shouldForward = true;
|
||||
}
|
||||
|
||||
exit:
|
||||
return rval;
|
||||
return shouldForward;
|
||||
}
|
||||
|
||||
const Netif::UnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo)
|
||||
|
||||
Reference in New Issue
Block a user