In BSD network code, don't add a route that's a subset of an Address

This commit is contained in:
Ludvig Strigeus 2018-11-16 14:36:38 +01:00
parent 57642ca653
commit 4b9fa05b5c

View file

@ -503,6 +503,13 @@ bool TunsafeBackendBsd::Configure(const TunConfig &&config, TunConfigOut *out) o
} }
continue; continue;
} }
// On linux, don't add a route that equals one of the addresses
#if defined(OS_LINUX)
if (IsWgCidrAddrSubsetOfAny(*it, config.addresses))
continue;
#endif
if (it->size == 32) { if (it->size == 32) {
AddRoute(ReadBE32(it->addr), it->cidr, ipv4_ip, devname_); AddRoute(ReadBE32(it->addr), it->cidr, ipv4_ip, devname_);
} else if (it->size == 128 && ipv6_addr) { } else if (it->size == 128 && ipv6_addr) {