summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2017-12-18 15:05:19 -0800
committerJoseph Henry <josephjah@gmail.com>2017-12-18 15:05:19 -0800
commitbbc39d76487f197cbdba84d8ca53a991f917e0fe (patch)
tree06e2ebaf28e2dbba80d035b8fe1d5538022b9457
parentd3e8e9629baa45d4e6145a4c613db88ca4a5e7c7 (diff)
downloadinfinitytier-bbc39d76487f197cbdba84d8ca53a991f917e0fe.tar.gz
infinitytier-bbc39d76487f197cbdba84d8ca53a991f917e0fe.zip
Restore managed ZT routes that are deleted or otherwise mangled locally (Attempted fix for ticket #600)
-rw-r--r--osdep/ManagedRoute.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/osdep/ManagedRoute.cpp b/osdep/ManagedRoute.cpp
index 5b5bf541..2da4cd2b 100644
--- a/osdep/ManagedRoute.cpp
+++ b/osdep/ManagedRoute.cpp
@@ -477,6 +477,27 @@ bool ManagedRoute::sync()
}
}
+ // Detect routes previously applied by ZT that don't exist in the system's route list. Re-apply these.
+ // NOTE: The following block was added in reaction to the macOS High Sierra 10.13.2 disappearing
+ // route issue. This comment should be removed once we're sure this block doesn't have any side-effects.
+ bool found;
+ std::vector<_RTE> currRoutes(_getRTEs(_target,false));
+ found = false;
+ for(std::vector<_RTE>::iterator r(currRoutes.begin());r!=currRoutes.end();++r) {
+ if(_target == r->target) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // erase _applied enteries
+ std::map<InetAddress, bool>::iterator rt;
+ rt = _applied.find(leftt);
+ _applied.erase(rt, _applied.end());
+ rt = _applied.find(rightt);
+ _applied.erase(rt, _applied.end());
+ }
+
if (!_applied.count(leftt)) {
_applied[leftt] = false; // not ifscoped
_routeCmd("add",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);