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 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/bsd') 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) -- cgit v1.2.3