mirror of
https://github.com/espressif/openthread.git
synced 2026-08-24 03:09:52 +00:00
[ip6] prefer RLOC source with RLOC dest in SelectSourceAddress() (#4377)
Prefer ML-EID for any mesh-local traffic that does not have RLOC destination. Credit to Rongli Sun <[email protected]> for identifying this issue.
This commit is contained in:
+7
-13
@@ -1364,19 +1364,6 @@ const NetifUnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if ((rvalAddr->GetScope() == Address::kRealmLocalScope) && (addr->GetScope() == Address::kRealmLocalScope))
|
||||
{
|
||||
// Additional rule: Prefer EID
|
||||
if (rvalAddr->GetAddress().IsRoutingLocator())
|
||||
{
|
||||
rvalAddr = addr;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (addr->mPreferred && !rvalAddr->mPreferred)
|
||||
{
|
||||
// Rule 3: Avoid deprecated addresses
|
||||
@@ -1391,6 +1378,13 @@ const NetifUnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo)
|
||||
rvalAddr = addr;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
else if ((candidatePrefixMatched == rvalPrefixMatched) &&
|
||||
(destination->IsRoutingLocator() == candidateAddr->IsRoutingLocator()))
|
||||
{
|
||||
// Additional rule: Prefer RLOC source for RLOC destination, EID source for anything else
|
||||
rvalAddr = addr;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user