From 4b9fa05b5c3292d0ae4cca57d0dc9235053e7240 Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Fri, 16 Nov 2018 14:36:38 +0100 Subject: [PATCH] In BSD network code, don't add a route that's a subset of an Address --- network_bsd_common.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/network_bsd_common.cpp b/network_bsd_common.cpp index d6a4921..b2bf710 100644 --- a/network_bsd_common.cpp +++ b/network_bsd_common.cpp @@ -503,6 +503,13 @@ bool TunsafeBackendBsd::Configure(const TunConfig &&config, TunConfigOut *out) o } 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) { AddRoute(ReadBE32(it->addr), it->cidr, ipv4_ip, devname_); } else if (it->size == 128 && ipv6_addr) {