diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index 4f5d46fa3..23836592c 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -1316,7 +1316,16 @@ const NetifUnicastAddress *Ip6::SelectSourceAddress(MessageInfo &aMessageInfo) } candidatePrefixMatched = destination->PrefixMatch(*candidateAddr); - overrideScope = (candidatePrefixMatched >= addr->mPrefixLength) ? addr->GetScope() : destinationScope; + + if (candidatePrefixMatched >= addr->mPrefixLength) + { + candidatePrefixMatched = addr->mPrefixLength; + overrideScope = addr->GetScope(); + } + else + { + overrideScope = destinationScope; + } if (rvalAddr == NULL) {