mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-23 14:52:24 +00:00
Restore managed ZT routes that are deleted or otherwise mangled locally (Attempted fix for ticket #600)
This commit is contained in:
parent
d3e8e9629b
commit
bbc39d7648
@ -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)) {
|
if (!_applied.count(leftt)) {
|
||||||
_applied[leftt] = false; // not ifscoped
|
_applied[leftt] = false; // not ifscoped
|
||||||
_routeCmd("add",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
|
_routeCmd("add",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
|
||||||
|
Loading…
Reference in New Issue
Block a user