summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/OneService.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 29916896..45f4234e 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -1327,6 +1327,18 @@ public:
const InetAddress *const via = reinterpret_cast<const InetAddress *>(&(nwc->routes[i].via));
bool haveRoute = false;
+
+ // We don't need to bother applying local routes to local managed IPs since these are implied by setting the IP
+ for(std::vector<InetAddress>::iterator ip(n.managedIps.begin());ip!=n.managedIps.end();++ip) {
+ if ((target->netmaskBits() == ip->netmaskBits())&&(target->containsAddress(*ip))) {
+ haveRoute = true;
+ break;
+ }
+ }
+
+ if (haveRoute)
+ continue;
+
for(std::list<ManagedRoute>::iterator mr(n.managedRoutes.begin());mr!=n.managedRoutes.end();++mr) {
if (mr->target() == *target) {
if ((via->ss_family == target->ss_family)&&(mr->via() == *via)) {
@@ -1338,11 +1350,11 @@ public:
}
}
}
+
if (haveRoute)
continue;
n.managedRoutes.push_back(ManagedRoute());
-
if ((target->isDefaultRoute())&&(n.allowDefault)) {
if (!n.managedRoutes.back().set(*target,*via,tapdev.c_str()))
n.managedRoutes.pop_back();