summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bsd/tunDevice.cpp28
-rwxr-xr-xsrc/configure4
2 files changed, 26 insertions, 6 deletions
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp
index 3494458..4e344a8 100644
--- a/src/bsd/tunDevice.cpp
+++ b/src/bsd/tunDevice.cpp
@@ -133,7 +133,7 @@ void TunDevice::init_post()
if (ioctl(fd_, TUNGIFINFO, &ti) < 0) {
::close(fd_);
- AnytunError::throwErr() << "can't enable multicast for interface";
+ AnytunError::throwErr() << "can't enable multicast for interface: " << AnytunErrno(errno);
}
ti.flags |= IFF_MULTICAST;
@@ -142,7 +142,7 @@ void TunDevice::init_post()
if (ioctl(fd_, TUNSIFINFO, &ti) < 0) {
::close(fd_);
- AnytunError::throwErr() << "can't enable multicast for interface";
+ AnytunError::throwErr() << "can't enable multicast for interface: " << AnytunErrno(errno);
}
}
@@ -154,10 +154,26 @@ void TunDevice::init_post()
if(conf_.type_ == TYPE_TAP)
with_pi_ = false;
- int arg = 0;
- ioctl(fd_, TUNSLMODE, &arg);
- arg = 1;
- ioctl(fd_, TUNSIFHEAD, &arg);
+ if(dev->type_ == TYPE_TUN) {
+ int arg = 0;
+ if(ioctl(dev->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) {
+ ::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) {
+ ::close(fd_);
+ AnytunError::throwErr() << "can't enable multicast for interface: " << AnytunErrno(errno);
+ }
+ }
}
#elif defined(__GNUC__) && defined(__NetBSD__)
diff --git a/src/configure b/src/configure
index b664850..770318b 100755
--- a/src/configure
+++ b/src/configure
@@ -122,6 +122,10 @@ if [ $ROUTING -eq 0 ]; then
fi
cat >> include.mk <<EOF
+# this file was created automatically
+# do not edit this file directly
+# use ./configure instead
+
TARGET = $TARGET
CXX = gcc
CXXFLAGS = $CXXFLAGS