Merge pull request #1430 from zerotier/mac-managed-route-issue-1104

Don't use v6 source addresses for v4 routes
This commit is contained in:
Grant Limberg 2021-08-04 13:14:10 -07:00 committed by GitHub
commit 20050662b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2047,7 +2047,7 @@ public:
unsigned int mostMatchingPrefixBits = 0;
for(std::set<InetAddress>::const_iterator i(myIps.begin());i!=myIps.end();++i) {
const unsigned int matchingPrefixBits = i->matchingPrefixBits(*target);
if (matchingPrefixBits >= mostMatchingPrefixBits) {
if (matchingPrefixBits >= mostMatchingPrefixBits && ((target->isV4() && i->isV4()) || (target->isV6() && i->isV6()))) {
mostMatchingPrefixBits = matchingPrefixBits;
src = &(*i);
}