diff options
author | Christian Pointner <equinox@anytun.org> | 2009-05-01 17:12:25 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-05-01 17:12:25 +0000 |
commit | 05cbbf5dc3fdea2fd6a975bb7ba8fb776fa031a4 (patch) | |
tree | feae0928d7a2d83d41ce18a03f643f76bd1dcfc4 /src | |
parent | updated ChangeLog for Release anytun-0.3 (diff) |
starting post up script in seperate thread
Diffstat (limited to 'src')
-rw-r--r-- | src/anytun.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp index 34fd5f5..6789b85 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -313,6 +313,14 @@ void receiver(TunDevice* dev, PacketSource* src) } } +#ifndef NO_EXEC +void startPostUpScript(TunDevice* dev) +{ + cLog.msg(Log::PRIO_NOTICE) << "executing post-up script '" << gOpt.getPostUpScript() << "'"; + execScript(gOpt.getPostUpScript(), dev->getActualName(), dev->getActualNode()); +} +#endif + #ifndef NO_DAEMON void startSendRecvThreads(PrivInfo& privs, TunDevice* dev, PacketSource* src) #else @@ -443,10 +451,8 @@ int main(int argc, char* argv[]) cLog.msg(Log::PRIO_NOTICE) << "dev opened - name '" << dev.getActualName() << "', node '" << dev.getActualNode() << "'"; cLog.msg(Log::PRIO_NOTICE) << "dev type is '" << dev.getTypeString() << "'"; #ifndef NO_EXEC - if(gOpt.getPostUpScript() != "") { - cLog.msg(Log::PRIO_NOTICE) << "executing post-up script '" << gOpt.getPostUpScript() << "'"; - execScript(gOpt.getPostUpScript(), dev.getActualName(), dev.getActualNode()); - } + if(gOpt.getPostUpScript() != "") + boost::thread(boost::bind(startPostUpScript, &dev)); #endif PacketSource* src = new UDPPacketSource(gOpt.getLocalAddr(), gOpt.getLocalPort()); |