Merge branch 'dev' into edge

This commit is contained in:
Adam Ierymenko 2019-08-28 07:31:33 -07:00
commit 9d1207b339
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
10 changed files with 17 additions and 119 deletions

View file

@ -45,6 +45,7 @@ public:
virtual void setEnabled(bool en) = 0;
virtual bool enabled() const = 0;
virtual bool addIp(const InetAddress &ip) = 0;
virtual bool addIps(std::vector<InetAddress> ips) = 0;
virtual bool removeIp(const InetAddress &ip) = 0;
virtual std::vector<InetAddress> ips() const = 0;
virtual void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len) = 0;

View file

@ -261,10 +261,9 @@ static bool ___removeIp(const std::string &_dev,const InetAddress &ip)
return true;
}
#ifdef __SYNOLOGY__
bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
bool LinuxEthernetTap::addIps(std::vector<InetAddress> ips)
{
// Here we fill out interface config (ifcfg-dev) to prevent it from being killed
#ifdef __SYNOLOGY__
std::string filepath = "/etc/sysconfig/network-scripts/ifcfg-"+_dev;
std::string cfg_contents = "DEVICE="+_dev+"\nBOOTPROTO=static";
int ip4=0,ip6=0,ip4_tot=0,ip6_tot=0;
@ -292,13 +291,14 @@ bool LinuxEthernetTap::addIpSyn(std::vector<InetAddress> ips)
}
}
OSUtils::writeFile(filepath.c_str(), cfg_contents.c_str(), cfg_contents.length());
// Finaly, add IPs
// Finally, add IPs
for(int i=0; i<(int)ips.size(); i++){
LinuxNetLink::getInstance().addAddress(ips[i], _dev.c_str());
}
return true;
}
#endif // __SYNOLOGY__
return false;
}
bool LinuxEthernetTap::addIp(const InetAddress &ip)
{

View file

@ -46,9 +46,7 @@ public:
virtual void setEnabled(bool en);
virtual bool enabled() const;
virtual bool addIp(const InetAddress &ip);
#ifdef __SYNOLOGY__
bool addIpSyn(std::vector<InetAddress> ips);
#endif
virtual bool addIps(std::vector<InetAddress> ips);
virtual bool removeIp(const InetAddress &ip);
virtual std::vector<InetAddress> ips() const;
virtual void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);