summaryrefslogtreecommitdiff
path: root/osdep
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 14:09:09 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 14:09:09 -0700
commit2113c21fdcc57bc8c07a4e514937cd07f7bc8526 (patch)
tree54e0d2fa98261ea79398cc1190e065c6237d888c /osdep
parente09c1a1c11522c11c6ea81dcb1c52a4e8a2f5c6c (diff)
downloadinfinitytier-2113c21fdcc57bc8c07a4e514937cd07f7bc8526.tar.gz
infinitytier-2113c21fdcc57bc8c07a4e514937cd07f7bc8526.zip
devicemap now works again in OSXEthernetTap
Diffstat (limited to 'osdep')
-rw-r--r--osdep/OSXEthernetTap.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/osdep/OSXEthernetTap.cpp b/osdep/OSXEthernetTap.cpp
index 8ffd2bff..9921049f 100644
--- a/osdep/OSXEthernetTap.cpp
+++ b/osdep/OSXEthernetTap.cpp
@@ -356,10 +356,10 @@ OSXEthernetTap::OSXEthernetTap(
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::snprintf(devpath,sizeof(devpath),"/dev/%s",desiredDevice.c_str());
+ devmap.load(devmapbuf.c_str());
+ char desiredDevice[128];
+ if (devmap.get(nwids,desiredDevice,sizeof(desiredDevice)) > 0) {
+ Utils::snprintf(devpath,sizeof(devpath),"/dev/%s",desiredDevice);
if (stat(devpath,&stattmp) == 0) {
_fd = ::open(devpath,O_RDWR);
if (_fd > 0) {
@@ -420,8 +420,9 @@ OSXEthernetTap::OSXEthernetTap(
++globalTapsRunning;
- 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);
}