summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-08 16:12:54 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-08 16:12:54 -0800
commit9b001823f636d9853832d3b0f1c4a24d075bd4f3 (patch)
tree5cce5353bec110e1de7dfc6004005b36408e7b85
parented4f84cc578e443a341486b995a5aebf77762d1c (diff)
downloadinfinitytier-9b001823f636d9853832d3b0f1c4a24d075bd4f3.tar.gz
infinitytier-9b001823f636d9853832d3b0f1c4a24d075bd4f3.zip
Add ifdef for synology around synology-only code in Linux Ethernet tap.
-rw-r--r--osdep/LinuxEthernetTap.cpp8
-rw-r--r--osdep/LinuxEthernetTap.hpp2
2 files changed, 7 insertions, 3 deletions
diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp
index 9d3773f0..e7fe657f 100644
--- a/osdep/LinuxEthernetTap.cpp
+++ b/osdep/LinuxEthernetTap.cpp
@@ -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)
{
diff --git a/osdep/LinuxEthernetTap.hpp b/osdep/LinuxEthernetTap.hpp
index acdff9dd..7dd7e01d 100644
--- a/osdep/LinuxEthernetTap.hpp
+++ b/osdep/LinuxEthernetTap.hpp
@@ -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);