mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 05:13:58 -07:00
Fix for MacOS interface setup and config timing bugs.
This commit is contained in:
parent
a91c49fa52
commit
1b8917a57c
4 changed files with 26 additions and 9 deletions
|
@ -209,8 +209,30 @@ MacEthernetTap::MacEthernetTap(
|
|||
::_exit(-1);
|
||||
} else {
|
||||
_agentPid = apid;
|
||||
|
||||
// Wait up to 10 seconds for the subprocess to actually create the device. This prevents
|
||||
// things like routes from being created before the device exists.
|
||||
for(int waitLoops=0;;++waitLoops) {
|
||||
struct ifaddrs *ifa = (struct ifaddrs *)0;
|
||||
if (!getifaddrs(&ifa)) {
|
||||
struct ifaddrs *p = ifa;
|
||||
while (p) {
|
||||
if ((p->ifa_name)&&(!strcmp(devstr, p->ifa_name))) {
|
||||
waitLoops = -1;
|
||||
break;
|
||||
}
|
||||
p = p->ifa_next;
|
||||
}
|
||||
freeifaddrs(ifa);
|
||||
}
|
||||
if (waitLoops == -1) {
|
||||
break;
|
||||
} else if (waitLoops >= 100) { // 10 seconds
|
||||
throw std::runtime_error("feth device creation timed out");
|
||||
}
|
||||
Thread::sleep(100);
|
||||
}
|
||||
}
|
||||
Thread::sleep(100); // this causes them to come up in a more user-friendly order on launch
|
||||
|
||||
_thread = Thread::start(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue