From 434bdc966862ff69395da9d5afab6156bd12e351 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Wed, 18 Feb 2009 09:28:34 +0000 Subject: turn off routing, when no multi connection support (no sync hosts or tap device) no autorouting on --ifconfig --- src/anytun.cpp | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'src/anytun.cpp') diff --git a/src/anytun.cpp b/src/anytun.cpp index fb9c429..84e5582 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -77,6 +77,8 @@ #include "daemon.hpp" #include "sysexec.hpp" +bool disableRouting = false; + void createConnection(const PacketSourceEndpoint & remote_end, window_size_t seqSize, mux_t mux) { SeqWindow* seq = new SeqWindow(seqSize); @@ -92,19 +94,6 @@ void createConnection(const PacketSourceEndpoint & remote_end, window_size_t seq SyncCommand sc (gConnectionList,mux); gSyncQueue.push(sc); #endif -#ifndef NO_ROUTING - OptionNetwork net = gOpt.getIfconfigParam(); - if (net.net_addr != "") - { - NetworkAddress addr(net.net_addr); - NetworkPrefix prefix(addr,net.prefix_length); - gRoutingTable.addRoute(prefix,mux); -#ifndef ANYTUN_NOSYNC - SyncCommand sc2 (prefix); - gSyncQueue.push(sc2); -#endif - } -#endif } #ifndef ANYTUN_NOSYNC @@ -188,13 +177,15 @@ void sender(void* p) //std::cout << "got Packet for plain "< "< "<(rit->prefix_length)); gRoutingTable.addRoute( prefix, gOpt.getMux() ); } - if (connect_to.begin() == connect_to.end() && routes.begin() == routes.end() && gOpt.getDevType()=="tun") + if (connect_to.begin() == connect_to.end() || gOpt.getDevType()!="tun") { - std::cout << "No Routes and no syncronisation hosts have be specified"<< std::endl; - std::cout << "anytun won't be able to send any data"<< std::endl; - std::cout << "most likely you want to add --route 0.0.0.0/0 --route ::/0"<< std::endl; - std::cout << "to your command line to allow both ipv4 and ipv6 traffic"<< std::endl; - std::cout << "(this does not set operating system routes, use the post-up script"<< std::endl; - std::cout << " to set them)"<< std::endl; - return -1; + cLog.msg(Log::PRIO_NOTICE) << "No sync/controll host defined or not a tun device. Disabling multy connection support (routing)"; + disableRouting=true; } #endif #ifndef NO_DAEMON -- cgit v1.2.3