mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-14 22:36:33 +00:00
Prevent shadowing VM routes as default route (macOS)
If you have a VM host like parallels, sometimes you get these link-local default routes: ``` netstat -nrfinet | grep "default\|\/1" 0/1 10.2.0.12 UGScg feth4823 default 192.168.82.1 UGScg en1 0/1 192.168.82.1 UGScIg en1 default link#22 UCSIg bridge101 ! 128.0/1 10.2.0.12 UGSc feth4823 128.0/1 192.168.82.1 UGScI en1 ``` (the link#22 one) The _getRTEs function inclused these routes in the list it makes as like: device: bridge101, target: 0.0.0.0/0 If it happens to be first in the list, bridge101 gets selected as the default route. Then Full Tunnel Mode doesn't work. The other routes in the list are like: device: en1 target: 192.168.1.0/24 via: metric: 0 ifscope: 0 device: en1 target: 192.168.1.1/32 via: metric: 0 ifscope: 0 We only need the device name from this, so either one will work.
This commit is contained in:
parent
a558bd9312
commit
a6742b7f82
@ -477,7 +477,7 @@ bool ManagedRoute::sync()
|
||||
if ((newSystemVia)&&(!newSystemDevice[0])) {
|
||||
rtes = _getRTEs(newSystemVia,true);
|
||||
for(std::vector<_RTE>::iterator r(rtes.begin());r!=rtes.end();++r) {
|
||||
if ( (r->device[0]) && (strcmp(r->device,_device) != 0) ) {
|
||||
if ( (r->device[0]) && (strcmp(r->device,_device) != 0) && r->target.netmaskBits() != 0) {
|
||||
Utils::scopy(newSystemDevice,sizeof(newSystemDevice),r->device);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user