mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-19 03:06:26 +00:00
Manually generate IPv6 link-local address only on Mac.
This commit is contained in:
parent
64231aa3f0
commit
2a3e646b94
@ -148,15 +148,23 @@ public:
|
|||||||
for(std::set<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i)
|
for(std::set<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i)
|
||||||
addIP(*i);
|
addIP(*i);
|
||||||
std::set<InetAddress> myIps(ips());
|
std::set<InetAddress> myIps(ips());
|
||||||
|
#ifdef __APPLE__
|
||||||
bool haveV6LinkLocal = false;
|
bool haveV6LinkLocal = false;
|
||||||
for(std::set<InetAddress>::iterator i(myIps.begin());i!=myIps.end();++i) {
|
for(std::set<InetAddress>::iterator i(myIps.begin());i!=myIps.end();++i) {
|
||||||
if ((i->isV6())&&(i->isLinkLocal()))
|
if (i->isLinkLocal()) {
|
||||||
|
if (i->isV6())
|
||||||
haveV6LinkLocal = true;
|
haveV6LinkLocal = true;
|
||||||
else if (!allIps.count(*i))
|
} else if (!allIps.count(*i))
|
||||||
removeIP(*i);
|
removeIP(*i);
|
||||||
}
|
}
|
||||||
if (!haveV6LinkLocal)
|
if (!haveV6LinkLocal)
|
||||||
addIP(InetAddress::makeIpv6LinkLocal(_mac));
|
addIP(InetAddress::makeIpv6LinkLocal(_mac));
|
||||||
|
#else
|
||||||
|
for(std::set<InetAddress>::iterator i(myIps.begin());i!=myIps.end();++i) {
|
||||||
|
if ((!i->isLinkLocal())&&(!allIps.count(*i)))
|
||||||
|
removeIP(*i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user