summaryrefslogtreecommitdiff
path: root/src/deviceConfig.hpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-05-09 18:52:28 +0000
committerChristian Pointner <equinox@anytun.org>2008-05-09 18:52:28 +0000
commit31c330838aaa247fd7b156b020df2ce95858f8e1 (patch)
tree59fb30ae7a5e090ddba3f1b8f77213df97ad8b6b /src/deviceConfig.hpp
parentlinux tun/tap device works now with tun *and* tap (diff)
small cleanup
Diffstat (limited to 'src/deviceConfig.hpp')
-rw-r--r--src/deviceConfig.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/deviceConfig.hpp b/src/deviceConfig.hpp
index 22fb5d8..efec0bb 100644
--- a/src/deviceConfig.hpp
+++ b/src/deviceConfig.hpp
@@ -40,6 +40,12 @@ class DeviceConfig
public:
DeviceConfig(const char* dev_name ,const char* dev_type, const char* ifcfg_lp, const char* ifcfg_rnmp)
{
+ guess_type(dev_name, dev_type);
+ }
+
+private:
+ void guess_type(const char* dev_name, const char* dev_type)
+ {
type_ = TYPE_UNDEF;
if(dev_type) {
if(!strncmp(dev_type, "tun", 3))
@@ -47,17 +53,14 @@ public:
else if(!strncmp(dev_type, "tap", 3))
type_ = TYPE_TAP;
}
- else if(dev_name)
- {
+ else if(dev_name) {
if(!strncmp(dev_name, "tun", 3))
type_ = TYPE_TUN;
else if(!strncmp(dev_name, "tap", 3))
type_ = TYPE_TAP;
}
-
}
-private:
device_type_t type_;
friend class TunDevice;