mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-30 16:13:55 +00:00
Take netmask bits from most specific route.
This commit is contained in:
parent
34c1023ba7
commit
5b1ef2fb03
@ -1523,8 +1523,11 @@ void EmbeddedNetworkController::_request(
|
|||||||
|
|
||||||
int routedNetmaskBits = -1;
|
int routedNetmaskBits = -1;
|
||||||
for(unsigned int rk=0;rk<nc->routeCount;++rk) {
|
for(unsigned int rk=0;rk<nc->routeCount;++rk) {
|
||||||
if (reinterpret_cast<const InetAddress *>(&(nc->routes[rk].target))->containsAddress(ip))
|
if (reinterpret_cast<const InetAddress *>(&(nc->routes[rk].target))->containsAddress(ip)) {
|
||||||
routedNetmaskBits = reinterpret_cast<const InetAddress *>(&(nc->routes[rk].target))->netmaskBits();
|
const int nb = (int)(reinterpret_cast<const InetAddress *>(&(nc->routes[rk].target))->netmaskBits());
|
||||||
|
if (nb > routedNetmaskBits)
|
||||||
|
routedNetmaskBits = nb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (routedNetmaskBits >= 0) {
|
if (routedNetmaskBits >= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user