diff options
author | Joseph Henry <josephjah@gmail.com> | 2017-02-16 16:06:04 -0800 |
---|---|---|
committer | Joseph Henry <josephjah@gmail.com> | 2017-02-16 16:06:04 -0800 |
commit | 57ef31d51cd86b8e1b9509f2dc1de5f96431c943 (patch) | |
tree | 4fb7c3e31b49a50e5b3808631884550362d7c47e | |
parent | 45c4ccb15362e17ec7030287a314df19a830f0f3 (diff) | |
download | infinitytier-57ef31d51cd86b8e1b9509f2dc1de5f96431c943.tar.gz infinitytier-57ef31d51cd86b8e1b9509f2dc1de5f96431c943.zip |
Route re-add patch for linux build on Synology devices
-rw-r--r-- | make-linux.mk | 4 | ||||
-rw-r--r-- | osdep/LinuxEthernetTap.cpp | 2 | ||||
-rw-r--r-- | service/OneService.cpp | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/make-linux.mk b/make-linux.mk index 016f7b7c..dff30de6 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -80,6 +80,10 @@ ifeq ($(ZT_ENABLE_CLUSTER),1) DEFS+=-DZT_ENABLE_CLUSTER endif +ifeq ($(ZT_SYNOLOGY), 1) + DEFS+=-D__SYNOLOGY__ +endif + ifeq ($(ZT_TRACE),1) DEFS+=-DZT_TRACE endif diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index e336bb67..55a6d9f6 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -221,8 +221,10 @@ bool LinuxEthernetTap::addIp(const InetAddress &ip) return false; std::vector<InetAddress> allIps(ips()); +#ifndef __SYNOLOGY__ if (std::binary_search(allIps.begin(),allIps.end(),ip)) return true; +#endif // Remove and reconfigure if address is the same but netmask is different for(std::vector<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i) { diff --git a/service/OneService.cpp b/service/OneService.cpp index 30e6c938..381709f8 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1108,12 +1108,17 @@ public: } } for(std::vector<InetAddress>::iterator ip(newManagedIps.begin());ip!=newManagedIps.end();++ip) { +#ifdef __SYNOLOGY__ + if (!n.tap->addIp(*ip)) + fprintf(stderr,"ERROR: unable to add ip address %s" ZT_EOL_S, ip->toString().c_str()); +#else if (std::find(n.managedIps.begin(),n.managedIps.end(),*ip) == n.managedIps.end()) { + if (!n.tap->addIp(*ip)) fprintf(stderr,"ERROR: unable to add ip address %s" ZT_EOL_S, ip->toString().c_str()); } +#endif } - n.managedIps.swap(newManagedIps); } |