From 8fd23d4249be748356e591e0dd70ea82f70dcec5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 31 Jan 2009 01:47:38 +0000 Subject: moved to new handling if ifconfig parameters (more windows friendly) --- src/linux/tunDevice.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/linux/tunDevice.cpp') diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp index 403cd99..8fde8ae 100644 --- a/src/linux/tunDevice.cpp +++ b/src/linux/tunDevice.cpp @@ -46,7 +46,7 @@ #include "threadUtils.hpp" #include "log.h" -TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_lp, std::string ifcfg_rnmp) : conf_(dev_name, dev_type, ifcfg_lp, ifcfg_rnmp, 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) { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); @@ -84,7 +84,7 @@ TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifc } actual_node_ = DEFAULT_DEVICE; - if(ifcfg_lp != "" && ifcfg_rnmp != "") + if(ifcfg_addr != "") do_ifconfig(); } @@ -157,14 +157,8 @@ void TunDevice::init_post() void TunDevice::do_ifconfig() { std::ostringstream command; - command << "/sbin/ifconfig " << actual_name_ << " " << conf_.local_.toString(); - - if(conf_.type_ == TYPE_TUN) - command << " pointopoint "; - else - command << " netmask "; - - command << conf_.remote_netmask_.toString() << " mtu " << conf_.mtu_; + command << "/sbin/ifconfig " << actual_name_ << " " << conf_.addr_.toString() + << " netmask " << conf_.netmask_.toString() << " mtu " << conf_.mtu_; int result = system(command.str().c_str()); if(result == -1) @@ -177,5 +171,4 @@ void TunDevice::do_ifconfig() else cLog.msg(Log::PRIO_ERR) << "Execution of ifconfig: unkown error"; } - } -- cgit v1.2.3