mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Add ifdef for synology around synology-only code in Linux Ethernet tap.
This commit is contained in:
parent
ed4f84cc57
commit
9b001823f6
@ -220,6 +220,7 @@ static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __SYNOLOGY__
|
||||
bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
|
||||
{
|
||||
// Here we fill out interface config (ifcfg-dev) to prevent it from being killed
|
||||
@ -233,14 +234,14 @@ bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
|
||||
setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1);
|
||||
// We must know if there is at least (one) of each protocol version so we
|
||||
// can properly enumerate address/netmask combinations in the ifcfg-dev file
|
||||
for(int i=0; i<ips.size(); i++) {
|
||||
for(int i=0; i<(int)ips.size(); i++) {
|
||||
if (ips[i].isV4())
|
||||
ip4_tot++;
|
||||
else
|
||||
ip6_tot++;
|
||||
}
|
||||
// Assemble and write contents of ifcfg-dev file
|
||||
for(int i=0; i<ips.size(); i++) {
|
||||
for(int i=0; i<(int)ips.size(); i++) {
|
||||
if (ips[i].isV4()) {
|
||||
std::string numstr4 = ip4_tot > 1 ? std::to_string(ip4) : "";
|
||||
cfg_contents += "\nIPADDR"+numstr4+"="+ips[i].toIpString()
|
||||
@ -256,7 +257,7 @@ bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
|
||||
}
|
||||
OSUtils::writeFile(filepath.c_str(), cfg_contents.c_str(), cfg_contents.length());
|
||||
// Finaly, add IPs
|
||||
for(int i=0; i<ips.size(); i++){
|
||||
for(int i=0; i<(int)ips.size(); i++){
|
||||
if (ips[i].isV4())
|
||||
::execlp("ip","ip","addr","add",ips[i].toString().c_str(),"broadcast",ips[i].broadcast().toIpString().c_str(),"dev",_dev.c_str(),(const char *)0);
|
||||
else
|
||||
@ -270,6 +271,7 @@ bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif // __SYNOLOGY__
|
||||
|
||||
bool LinuxEthernetTap::addIp(const InetAddress &ip)
|
||||
{
|
||||
|
@ -52,7 +52,9 @@ public:
|
||||
void setEnabled(bool en);
|
||||
bool enabled() const;
|
||||
bool addIp(const InetAddress &ip);
|
||||
#ifdef __SYNOLOGY__
|
||||
bool addIpSyn(std::vector<InetAddress> ips);
|
||||
#endif
|
||||
bool removeIp(const InetAddress &ip);
|
||||
std::vector<InetAddress> ips() const;
|
||||
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||
|
Loading…
Reference in New Issue
Block a user