diff options
author | Christian Pointner <equinox@anytun.org> | 2008-05-10 00:34:07 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-05-10 00:34:07 +0000 |
commit | 18626031a3cbaeb470dba1d81adee2f6cd5cfd7d (patch) | |
tree | 2cea0f5af3cd692cc634cf2d5f147d99608d4525 /src/linux | |
parent | small cleanup (diff) |
do_ifconfig works now for new tun/tap device
Diffstat (limited to 'src/linux')
-rw-r--r-- | src/linux/tunDevice.cpp | 22 | ||||
-rw-r--r-- | src/linux/tunDevice.h | 2 |
2 files changed, 24 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()); +} 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_; |