summaryrefslogtreecommitdiff
path: root/src/anytun.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-11-28 18:45:57 +0000
committerOthmar Gsenger <otti@anytun.org>2008-11-28 18:45:57 +0000
commitac2147483cfcbb6f01123d65e67b7bb363bddc8f (patch)
treed7812a08b15dbc54df6f97b7b64ae913972f309b /src/anytun.cpp
parentsome more type cleanups and missig NOCRYPT defines (diff)
added some windows support (not working now)
try to build with following Options: NOCRYPT;NODAEMON;NOEXEC;NOPACKED;NOSYSLOG;NOROUTING;NOSIGNALCONTROLLER
Diffstat (limited to 'src/anytun.cpp')
-rw-r--r--src/anytun.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 553c451..05d2164 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -31,13 +31,7 @@
#include <iostream>
#include <fstream>
-#include <poll.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <unistd.h>
+
#include <boost/bind.hpp>
#ifndef NOCRYPT
@@ -57,14 +51,18 @@
#include "cipherFactory.h"
#include "authAlgoFactory.h"
#include "keyDerivationFactory.h"
+#ifndef NOSIGNALCONTROLLER
#include "signalController.h"
+#endif
#include "packetSource.h"
#include "tunDevice.h"
#include "options.h"
#include "seqWindow.h"
#include "connectionList.h"
+#ifndef NOROUTING
#include "routingTable.h"
#include "networkAddress.h"
+#endif
#include "syncQueue.h"
#include "syncCommand.h"
@@ -96,9 +94,11 @@ void createConnection(const PacketSourceEndpoint & remote_end, ConnectionList &
ConnectionParam connparam ( (*kd), (*seq), seq_nr_, remote_end);
cl.addConnection(connparam,mux);
+#ifndef NOROUTING
NetworkAddress addr(ipv4,gOpt.getIfconfigParamRemoteNetmask().c_str());
NetworkPrefix prefix(addr,32);
gRoutingTable.addRoute(prefix,mux);
+#endif
SyncCommand sc (cl,mux);
queue.push(sc);
SyncCommand sc2 (prefix);
@@ -158,9 +158,14 @@ void sender(void* p)
if(param->cl.empty())
continue;
//std::cout << "got Packet for plain "<<plain_packet.getDstAddr().toString();
+#ifndef NOROUTING
mux = gRoutingTable.getRoute(plain_packet.getDstAddr());
//std::cout << " -> "<<mux << std::endl;
ConnectionMap::iterator cit = param->cl.getConnection(mux);
+#else
+ ConnectionMap::iterator cit = param->cl.getBegin();
+#endif
+
if(cit==param->cl.getEnd())
continue;
ConnectionParam & conn = cit->second;
@@ -416,9 +421,11 @@ int main(int argc, char* argv[])
pidFile << pid;
pidFile.close();
}
-
+
+#ifndef NOSIGNALCONTROLLER
SignalController sig;
sig.init();
+#endif
ThreadParam p(dev, *src, cl, queue,*(new OptionConnectTo()));