diff --git a/service/OneService.cpp b/service/OneService.cpp index 60c55a548..b9a52e8cc 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2047,7 +2047,7 @@ public: unsigned int mostMatchingPrefixBits = 0; for(std::set::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); }