summaryrefslogtreecommitdiff
path: root/osdep
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-17 00:21:58 +0000
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-17 00:21:58 +0000
commit37afa876a72344fdfc8091db8d292af2f796c77c (patch)
treeedc082a11a0a74222be693a9747066e63562ad17 /osdep
parent601c51b351fc097c27aef9be8f5471099fffeb3a (diff)
downloadinfinitytier-37afa876a72344fdfc8091db8d292af2f796c77c.tar.gz
infinitytier-37afa876a72344fdfc8091db8d292af2f796c77c.zip
Linux bug fixes, small controller fix.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/LinuxEthernetTap.cpp13
-rw-r--r--osdep/ManagedRoute.hpp4
-rw-r--r--osdep/Phy.hpp2
3 files changed, 11 insertions, 8 deletions
diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp
index 6a34f48d..c43c7bb7 100644
--- a/osdep/LinuxEthernetTap.cpp
+++ b/osdep/LinuxEthernetTap.cpp
@@ -97,10 +97,10 @@ LinuxEthernetTap::LinuxEthernetTap(
std::string devmapbuf;
Dictionary devmap;
if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmapbuf)) {
- devmap.fromString(devmapbuf);
- std::string desiredDevice(devmap.get(nwids,""));
- if (desiredDevice.length() > 2) {
- Utils::scopy(ifr.ifr_name,sizeof(ifr.ifr_name),desiredDevice.c_str());
+ devmap.load(devmapbuf.c_str());
+ char desiredDevice[128];
+ if (devmap.get(nwids,desiredDevice,sizeof(desiredDevice)) > 0) {
+ Utils::scopy(ifr.ifr_name,sizeof(ifr.ifr_name),desiredDevice);
Utils::snprintf(procpath,sizeof(procpath),"/proc/sys/net/ipv4/conf/%s",ifr.ifr_name);
recalledDevice = (stat(procpath,&sbuf) != 0);
}
@@ -174,8 +174,9 @@ LinuxEthernetTap::LinuxEthernetTap(
(void)::pipe(_shutdownSignalPipe);
- devmap[nwids] = _dev;
- OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),devmap.toString());
+ devmap.erase(nwids);
+ devmap.add(nwids,_dev.c_str());
+ OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "devicemap").c_str(),(const void *)devmap.data(),devmap.sizeBytes());
_thread = Thread::start(this);
}
diff --git a/osdep/ManagedRoute.hpp b/osdep/ManagedRoute.hpp
index 86468a45..ca71b18b 100644
--- a/osdep/ManagedRoute.hpp
+++ b/osdep/ManagedRoute.hpp
@@ -32,6 +32,7 @@ public:
ManagedRoute(const ManagedRoute &r)
{
+ _applied = false;
*this = r;
}
@@ -40,7 +41,8 @@ public:
if ((!_applied)&&(!r._applied)) {
memcpy(this,&r,sizeof(ManagedRoute)); // InetAddress is memcpy'able
} else {
- throw std::runtime_error("Applied ManagedRoute is non-copyable!");
+ fprintf(stderr,"Applied ManagedRoute isn't copyable!\n");
+ abort();
}
return *this;
}
diff --git a/osdep/Phy.hpp b/osdep/Phy.hpp
index 1b08f30a..eab8a317 100644
--- a/osdep/Phy.hpp
+++ b/osdep/Phy.hpp
@@ -871,7 +871,7 @@ public:
#if defined(_WIN32) || defined(_WIN64)
::recv(_whackReceiveSocket,tmp,16,0);
#else
- (void)(::read(_whackReceiveSocket,tmp,16));
+ ::read(_whackReceiveSocket,tmp,16);
#endif
}