mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-21 05:53:09 +00:00
Merge branch 'dev' of github.com:zerotier/ZeroTierOne into dev
This commit is contained in:
commit
75637f68b3
@ -210,8 +210,8 @@ static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
OSUtils::redirectUnixOutputs("/dev/null",(const char *)0);
|
||||
::execl("/sbin/ip","/sbin/ip","addr","del",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::execl("/usr/sbin/ip","/usr/sbin/ip","addr","del",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1);
|
||||
::execlp("ip","ip","addr","del",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::_exit(-1);
|
||||
} else {
|
||||
int exitcode = -1;
|
||||
@ -238,12 +238,11 @@ bool LinuxEthernetTap::addIp(const InetAddress &ip)
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
OSUtils::redirectUnixOutputs("/dev/null",(const char *)0);
|
||||
setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1);
|
||||
if (ip.isV4()) {
|
||||
::execl("/sbin/ip","/sbin/ip","addr","add",ip.toString().c_str(),"broadcast",ip.broadcast().toIpString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::execl("/usr/sbin/ip","/usr/sbin/ip","addr","add",ip.toString().c_str(),"broadcast",ip.broadcast().toIpString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::execlp("ip","ip","addr","add",ip.toString().c_str(),"broadcast",ip.broadcast().toIpString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
} else {
|
||||
::execl("/sbin/ip","/sbin/ip","addr","add",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::execl("/usr/sbin/ip","/usr/sbin/ip","addr","add",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
::execlp("ip","ip","addr","add",ip.toString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
}
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
|
@ -1147,11 +1147,13 @@ public:
|
||||
newAssignedIps.erase(std::unique(newAssignedIps.begin(),newAssignedIps.end()),newAssignedIps.end());
|
||||
for(std::vector<InetAddress>::iterator ip(newAssignedIps.begin());ip!=newAssignedIps.end();++ip) {
|
||||
if (!std::binary_search(assignedIps.begin(),assignedIps.end(),*ip))
|
||||
t->second->addIp(*ip);
|
||||
if (!t->second->addIp(*ip))
|
||||
fprintf(stderr,"ERROR: unable to add ip address %s"ZT_EOL_S, ip->toString().c_str());
|
||||
}
|
||||
for(std::vector<InetAddress>::iterator ip(assignedIps.begin());ip!=assignedIps.end();++ip) {
|
||||
if (!std::binary_search(newAssignedIps.begin(),newAssignedIps.end(),*ip))
|
||||
t->second->removeIp(*ip);
|
||||
if (!t->second->removeIp(*ip))
|
||||
fprintf(stderr,"ERROR: unable to remove ip address %s"ZT_EOL_S, ip->toString().c_str());
|
||||
}
|
||||
assignedIps.swap(newAssignedIps);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user