From 7f1c5d099894e68b6e828afb89b6e0defcaffe74 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Tue, 15 Apr 2008 19:33:02 +0000 Subject: added make target anytun-nosync for basic bsd support --- src/Makefile | 33 ++++++++++++++++++++------------- src/anytun.cpp | 30 +++++++++++++++++++----------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/Makefile b/src/Makefile index 7d54ac1..c310bcb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -48,18 +48,11 @@ OBJS = tunDevice.o \ packetSource.o \ buffer.o \ syncBuffer.o \ - syncCommand.o \ - syncRouteCommand.o \ - syncRtpCommand.o \ - syncConnectionCommand.o \ plainPacket.o \ encryptedPacket.o \ cipher.o \ authAlgo.o \ keyDerivation.o \ - rtpSessionTable.o \ - rtpSession.o \ - anyrtpproxy/callIdQueue.o \ mpi.o \ cipherFactory.o \ authAlgoFactory.o \ @@ -72,14 +65,22 @@ OBJS = tunDevice.o \ router.o \ routingTable.o \ signalController.o \ - syncSocket.o \ - syncSocketHandler.o \ - syncClientSocket.o \ syncQueue.o \ log.o \ options.o \ seqWindow.o \ - $(OPENVPNDEPS) \ + syncCommand.o \ + syncRouteCommand.o \ + syncRtpCommand.o \ + syncConnectionCommand.o \ + rtpSessionTable.o \ + rtpSession.o \ + anyrtpproxy/callIdQueue.o \ + $(OPENVPNDEPS) + +SYNCOBJS= syncSocket.o \ + syncSocketHandler.o \ + syncClientSocket.o \ $(SOCKETDEPS) ANYCTROBJS = anyCtrSocket.o \ @@ -121,8 +122,11 @@ EXECUTABLE = anytun anytun-config anytun-controld anytun-showtables manpage all: $(EXECUTABLE) libAnysync.a anyrtpproxy -anytun: $(OBJS) anytun.o - $(LD) $(OBJS) anytun.o -o $@ $(LDFLAGS) +anytun: $(OBJS) $(SYNCOBJS) anytun.o + $(LD) $(OBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS) + +anytun-nosync: $(OBJS) anytun-nosync.o + $(LD) $(OBJS) anytun-nosync.o -o $@ $(LDFLAGS) anytun-showtables: $(OBJS) anytun-showtables.o $(LD) $(OBJS) anytun-showtables.o -o $@ $(LDFLAGS) @@ -250,6 +254,9 @@ router.o: router.cpp router.h anytun.o: anytun.cpp $(C++) $(CCFLAGS) $< -c +anytun-nosync.o: anytun.cpp + $(C++) -g -Wall -DANYTUN_NOSYNC $< -c -o anytun-nosync.o + anytun-showtables.o: anytun-showtables.cpp $(C++) $(CCFLAGS) $< -c diff --git a/src/anytun.cpp b/src/anytun.cpp index 5100ab8..37e21e6 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -61,12 +61,15 @@ #include "networkAddress.h" #include "syncQueue.h" +#include "syncCommand.h" + +#ifndef ANYTUN_NOSYNC #include "syncSocketHandler.h" #include "syncListenSocket.h" #include "syncSocket.h" #include "syncClientSocket.h" -#include "syncCommand.h" +#endif #include "threadParam.h" @@ -173,17 +176,18 @@ void* sender(void* p) a->setKey(session_auth_key); a->generate(encrypted_packet); } - try - { +// try +// { param->src.send(encrypted_packet.getBuf(), encrypted_packet.getLength(), conn.remote_host_, conn.remote_port_); - } - catch (Exception e) - { - } +// } +// catch (Exception e) +// { +// } } pthread_exit(NULL); } +#ifndef ANYTUN_NOSYNC void* syncConnector(void* p ) { ThreadParam* param = reinterpret_cast(p); @@ -217,6 +221,7 @@ void* syncListener(void* p ) h.Select(1,0); } } +#endif void* receiver(void* p) { @@ -480,7 +485,7 @@ int main(int argc, char* argv[]) pthread_create(&senderThread, NULL, sender, &p); pthread_t receiverThread; pthread_create(&receiverThread, NULL, receiver, &p); - +#ifndef ANYTUN_NOSYNC pthread_t syncListenerThread; if ( gOpt.getLocalSyncPort()) pthread_create(&syncListenerThread, NULL, syncListener, &p); @@ -491,24 +496,27 @@ int main(int argc, char* argv[]) ThreadParam * point = new ThreadParam(dev, *src, cl, queue,*it); pthread_create(& connectThreads.back(), NULL, syncConnector, point); } - +#endif int ret = sig.run(); pthread_cancel(senderThread); pthread_cancel(receiverThread); +#ifndef ANYTUN_NOSYNC if ( gOpt.getLocalSyncPort()) pthread_cancel(syncListenerThread); for( std::list::iterator it = connectThreads.begin() ;it != connectThreads.end(); ++it) pthread_cancel(*it); - +#endif + pthread_join(senderThread, NULL); pthread_join(receiverThread, NULL); +#ifndef ANYTUN_NOSYNC if ( gOpt.getLocalSyncPort()) pthread_join(syncListenerThread, NULL); for( std::list::iterator it = connectThreads.begin() ;it != connectThreads.end(); ++it) pthread_join(*it, NULL); - +#endif delete src; delete &p.connto; -- cgit v1.2.3