summaryrefslogtreecommitdiff
path: root/src/bsd
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2010-01-10 22:10:05 +0000
committerOthmar Gsenger <otti@anytun.org>2010-01-10 22:10:05 +0000
commit2f418d7ab9f44ee8d573a81a08c167dbf46f1658 (patch)
treed4d6d38b11fda9ee17b1e4448f8dc1b7ffcc7c32 /src/bsd
parentdispatching right socket for send to function (diff)
fixed priviledge dropping on freebsd
maybee todo: remove old non working preprocessor staments like NO_EXEC to make code simpler
Diffstat (limited to 'src/bsd')
-rw-r--r--src/bsd/tunDevice.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp
index 6dd3419..40c3001 100644
--- a/src/bsd/tunDevice.cpp
+++ b/src/bsd/tunDevice.cpp
@@ -54,7 +54,7 @@
#define DEVICE_FILE_MAX 255
-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)
+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),sys_exec_(NULL)
{
std::string device_file = "/dev/";
bool dynamic = true;
@@ -253,6 +253,7 @@ int TunDevice::write(u_int8_t* buf, u_int32_t len)
void TunDevice::do_ifconfig()
{
+#ifndef NO_EXEC
std::ostringstream mtu_ss;
mtu_ss << conf_.mtu_;
StringVector args = boost::assign::list_of(actual_name_)(conf_.addr_.toString())("netmask")(conf_.netmask_.toString())("mtu")(mtu_ss.str());
@@ -270,6 +271,13 @@ void TunDevice::do_ifconfig()
#error This Device works just for OpenBSD, FreeBSD or NetBSD
#endif
}
+ sys_exec_ = new SysExec("/sbin/ifconfig", args);
+#endif
+}
- anytun_exec("/sbin/ifconfig", args);
+void TunDevice::waitForPostUpScript()
+{
+ if (sys_exec_)
+ sys_exec_->waitForScript();
}
+