summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bsd/tunDevice.cpp13
-rw-r--r--src/keyDerivation.h1
-rw-r--r--src/threadUtils.hpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp
index 5521f9c..65497f2 100644
--- a/src/bsd/tunDevice.cpp
+++ b/src/bsd/tunDevice.cpp
@@ -49,10 +49,11 @@
#include "threadUtils.hpp"
#include "log.h"
#include "anytunError.h"
+#include "sysExec.h"
#define DEVICE_FILE_MAX 255
-TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_addr, std::string ifcfg_prefix) : conf_(dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400)
+TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_addr, u_int16_t ifcfg_prefix) : conf_(dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400)
{
std::string device_file = "/dev/";
bool dynamic = true;
@@ -155,22 +156,22 @@ void TunDevice::init_post()
if(conf_.type_ == TYPE_TAP)
with_pi_ = false;
- if(dev->type_ == TYPE_TUN) {
+ if(conf_.type_ == TYPE_TUN) {
int arg = 0;
- if(ioctl(dev->fd_, TUNSLMODE, &arg) < 0) {
+ if(ioctl(fd_, TUNSLMODE, &arg) < 0) {
::close(fd_);
AnytunError::throwErr() << "can't disable link-layer mode for interface: " << AnytunErrno(errno);
}
arg = 1;
- if(ioctl(dev->fd_, TUNSIFHEAD, &arg) < 0) {
+ if(ioctl(fd_, TUNSIFHEAD, &arg) < 0) {
::close(fd_);
AnytunError::throwErr() << "can't enable multi-af modefor interface: " << AnytunErrno(errno);
}
arg = IFF_BROADCAST;
arg |= IFF_MULTICAST;
- if(ioctl(dev->fd_, TUNSIFMODE, &arg) < 0) {
+ if(ioctl(fd_, TUNSIFMODE, &arg) < 0) {
::close(fd_);
AnytunError::throwErr() << "can't enable multicast for interface: " << AnytunErrno(errno);
}
@@ -198,7 +199,7 @@ int TunDevice::fix_return(int ret, size_t pi_length) const
if(ret < 0)
return ret;
- return (static_cast<size_t>(ret) > type_length ? (ret - type_length) : 0);
+ return (static_cast<size_t>(ret) > pi_length ? (ret - pi_length) : 0);
}
int TunDevice::read(u_int8_t* buf, u_int32_t len)
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index 12d370c..070c485 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -47,6 +47,7 @@
#endif
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
+#include <boost/version.hpp>
#define LABEL_ENC 0
#define LABEL_AUTH 1
diff --git a/src/threadUtils.hpp b/src/threadUtils.hpp
index 85500c1..984dab9 100644
--- a/src/threadUtils.hpp
+++ b/src/threadUtils.hpp
@@ -31,6 +31,8 @@
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/condition.hpp>
+
#include "datatypes.h"
#ifndef __THREADUTILS__
#define __THREADUTILS__