From cec3b44ad7c4f03d7ee8fcd9d35eca083f5d1fe4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 16 Apr 2008 00:01:29 +0000 Subject: anytun-nosync builds on OpenBSD now --- src/anytun.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/anytun.cpp') diff --git a/src/anytun.cpp b/src/anytun.cpp index 37e21e6..e8bfb13 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -35,7 +35,10 @@ #include #include #include +#include +#include +#include #include #include // for ENOMEM @@ -312,16 +315,20 @@ void* receiver(void* p) } #define MIN_GCRYPT_VERSION "1.2.0" +#if defined(__GNUC__) && !defined(__OpenBSD__) // TODO: thread-safety on OpenBSD // make libgcrypt thread safe extern "C" { GCRY_THREAD_OPTION_PTHREAD_IMPL; } +#endif bool initLibGCrypt() { // make libgcrypt thread safe // this must be called before any other libgcrypt call +#if defined(__GNUC__) && !defined(__OpenBSD__) // TODO: thread-safety on OpenBSD gcry_control( GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread ); +#endif // this must be called right after the GCRYCTL_SET_THREAD_CBS command // no other function must be called till now @@ -425,7 +432,7 @@ int main(int argc, char* argv[]) gOpt.printUsage(); exit(-1); } - + cLog.msg(Log::PRIO_NOTICE) << "anytun started..."; std::ofstream pidFile; @@ -467,7 +474,7 @@ int main(int argc, char* argv[]) src = new UDPPacketSource(gOpt.getLocalPort()); else src = new UDPPacketSource(gOpt.getLocalAddr(), gOpt.getLocalPort()); - + ConnectionList cl; ConnectToList connect_to = gOpt.getConnectTo(); SyncQueue queue; @@ -497,6 +504,7 @@ int main(int argc, char* argv[]) pthread_create(& connectThreads.back(), NULL, syncConnector, point); } #endif + int ret = sig.run(); pthread_cancel(senderThread); -- cgit v1.2.3