mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 06:17:47 +00:00
[ip6] prefer ML-EID as realm-local scope source address (#3284)
This commit is contained in:
+7
-20
@@ -1123,28 +1123,15 @@ const NetifUnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo)
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
}
|
||||
else if (rvalAddr->GetScope() == Address::kRealmLocalScope)
|
||||
else if ((rvalAddr->GetScope() == Address::kRealmLocalScope) &&
|
||||
(addr->GetScope() == Address::kRealmLocalScope))
|
||||
{
|
||||
// Additional rule: Prefer appropriate realm local address
|
||||
if (overrideScope > Address::kRealmLocalScope)
|
||||
// Additional rule: Prefer EID
|
||||
if (rvalAddr->GetAddress().IsRoutingLocator())
|
||||
{
|
||||
if (rvalAddr->GetAddress().IsRoutingLocator())
|
||||
{
|
||||
// Prefer EID if destination is not realm local.
|
||||
rvalAddr = addr;
|
||||
rvalIface = candidateId;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (candidateAddr->IsRoutingLocator())
|
||||
{
|
||||
// Prefer RLOC if destination is realm local.
|
||||
rvalAddr = addr;
|
||||
rvalIface = candidateId;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
rvalAddr = addr;
|
||||
rvalIface = candidateId;
|
||||
rvalPrefixMatched = candidatePrefixMatched;
|
||||
}
|
||||
}
|
||||
else if (addr->mPreferred && !rvalAddr->mPreferred)
|
||||
|
||||
@@ -124,6 +124,7 @@ otError NetworkDiagnostic::SendDiagnosticGet(const Ip6::Address &aDestination,
|
||||
SuccessOrExit(error = message->Append(aTlvTypes, aCount));
|
||||
}
|
||||
|
||||
messageInfo.SetSockAddr(GetNetif().GetMle().GetMeshLocal16());
|
||||
messageInfo.SetPeerAddr(aDestination);
|
||||
messageInfo.SetPeerPort(kCoapUdpPort);
|
||||
messageInfo.SetInterfaceId(netif.GetInterfaceId());
|
||||
@@ -517,6 +518,7 @@ void NetworkDiagnostic::HandleDiagnosticGetQuery(Coap::Header & aHeader
|
||||
|
||||
VerifyOrExit((message = netif.GetCoap().NewMessage(header)) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
|
||||
messageInfo.SetSockAddr(GetNetif().GetMle().GetMeshLocal16());
|
||||
messageInfo.SetPeerAddr(aMessageInfo.GetPeerAddr());
|
||||
messageInfo.SetPeerPort(kCoapUdpPort);
|
||||
messageInfo.SetInterfaceId(netif.GetInterfaceId());
|
||||
@@ -631,6 +633,7 @@ otError NetworkDiagnostic::SendDiagnosticReset(const Ip6::Address &aDestination,
|
||||
SuccessOrExit(error = message->Append(aTlvTypes, aCount));
|
||||
}
|
||||
|
||||
messageInfo.SetSockAddr(GetNetif().GetMle().GetMeshLocal16());
|
||||
messageInfo.SetPeerAddr(aDestination);
|
||||
messageInfo.SetPeerPort(kCoapUdpPort);
|
||||
messageInfo.SetInterfaceId(netif.GetInterfaceId());
|
||||
|
||||
Reference in New Issue
Block a user