Merge pull request #1533 from zerotier/tl-linux-route-if

Prevent adding routes to non-zerotier interfaces in rare cases.
This commit is contained in:
Sean OMeara 2022-01-12 18:41:45 +01:00 committed by GitHub
commit 4866490cdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -526,14 +526,13 @@ bool ManagedRoute::sync()
#ifdef __LINUX__ // ----------------------------------------------------------
const char *const devptr = (_via) ? (const char *)0 : _device;
if ((leftt)&&(!LinuxNetLink::getInstance().routeIsSet(leftt,_via,_src,devptr))) {
if ((leftt)&&(!LinuxNetLink::getInstance().routeIsSet(leftt,_via,_src,_device))) {
_applied[leftt] = false; // boolean unused
LinuxNetLink::getInstance().addRoute(leftt, _via, _src, devptr);
LinuxNetLink::getInstance().addRoute(leftt, _via, _src, _device);
}
if ((rightt)&&(!LinuxNetLink::getInstance().routeIsSet(rightt,_via,_src,devptr))) {
if ((rightt)&&(!LinuxNetLink::getInstance().routeIsSet(rightt,_via,_src,_device))) {
_applied[rightt] = false; // boolean unused
LinuxNetLink::getInstance().addRoute(rightt, _via, _src, devptr);
LinuxNetLink::getInstance().addRoute(rightt, _via, _src, _device);
}
#endif // __LINUX__ ----------------------------------------------------------