diff options
Diffstat (limited to 'src/linux/tunDevice.cpp')
-rw-r--r-- | src/linux/tunDevice.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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()); +} |