From 7bf11008f6821f4f5c19ebe7dbaa0faa8fef14bf Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 6 Oct 2009 01:44:23 +0000 Subject: fixed build on freebsd --- src/bsd/tunDevice.cpp | 13 +++++++------ src/keyDerivation.h | 1 + src/threadUtils.hpp | 2 ++ 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(ret) > type_length ? (ret - type_length) : 0); + return (static_cast(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 #include +#include #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 #include #include +#include + #include "datatypes.h" #ifndef __THREADUTILS__ #define __THREADUTILS__ -- cgit v1.2.3