[network-data] fix IsOnMesh() to check on-mesh flags (#5116)

This commit is contained in:
Jonathan Hui
2020-06-23 18:01:20 -07:00
parent 474cd5fd86
commit 6897dffb57
+17 -4
View File
@@ -260,12 +260,25 @@ bool LeaderBase::IsOnMesh(const Ip6::Address &aAddress) const
while ((prefix = FindNextMatchingPrefix(aAddress, prefix)) != nullptr)
{
if (FindBorderRouter(*prefix) == nullptr)
// check both stable and temporary Border Router TLVs
for (int i = 0; i < 2; i++)
{
continue;
}
const BorderRouterTlv *borderRouter = FindBorderRouter(*prefix, /* aStable */ (i == 0));
ExitNow(rval = true);
if (borderRouter == nullptr)
{
continue;
}
for (const BorderRouterEntry *entry = borderRouter->GetFirstEntry(); entry <= borderRouter->GetLastEntry();
entry = entry->GetNext())
{
if (entry->IsOnMesh())
{
ExitNow(rval = true);
}
}
}
}
exit: