From 18626031a3cbaeb470dba1d81adee2f6cd5cfd7d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 10 May 2008 00:34:07 +0000 Subject: do_ifconfig works now for new tun/tap device --- src/linux/tunDevice.cpp | 22 ++++++++++++++++++++++ src/linux/tunDevice.h | 2 ++ 2 files changed, 24 insertions(+) (limited to 'src/linux') diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp index 446df4f..8548331 100644 --- a/src/linux/tunDevice.cpp +++ b/src/linux/tunDevice.cpp @@ -77,6 +77,9 @@ TunDevice::TunDevice(const char* dev_name, const char* dev_type, const char* ifc msg.append(strerror(errno)); throw std::runtime_error(msg); } + + if(ifcfg_lp && ifcfg_rnmp) + do_ifconfig(); } TunDevice::~TunDevice() @@ -155,3 +158,22 @@ const char* TunDevice::getTypeString() } return NULL; } + +void TunDevice::do_ifconfig() +{ + std::string command("/sbin/ifconfig "); + command.append(actual_name_); + command.append(" "); + command.append(conf_.local_.toString()); + command.append(" "); + + if(conf_.type_ == TYPE_TUN) + command.append("pointopoint "); + else + command.append("netmask "); + + command.append(conf_.remote_netmask_.toString()); + command.append(" mtu 1400"); + + system(command.c_str()); +} diff --git a/src/linux/tunDevice.h b/src/linux/tunDevice.h index 9f3557a..d838dfc 100644 --- a/src/linux/tunDevice.h +++ b/src/linux/tunDevice.h @@ -52,6 +52,8 @@ private: void operator=(const TunDevice &src); TunDevice(const TunDevice &src); + void do_ifconfig(); + int fd_; DeviceConfig conf_; bool with_pi_; -- cgit v1.2.3