diff --git a/CMakeLists.txt b/CMakeLists.txt index 05df866..bad386d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,22 @@ INCLUDE_DIRECTORIES(lib/src/jsoncpp/include) INCLUDE_DIRECTORIES(lib/src/libtins/include) INCLUDE_DIRECTORIES(lib/src/easyloggingpp/src/) ADD_SUBDIRECTORY(src) +SET(JSONCPP_WITH_TESTS OFF) +SET(JSONCPP_WITH_POST_BUILD_UNITTEST OFF) +SET(JSONCPP_WITH_PKGCONFIG_SUPPORT OFF) +SET(JSONCPP_WITH_CMAKE_PACKAGE OFF) +SET(BUILD_SHARED_LIBS OFF) +SET(BUILD_STATIC_LIBS ON) ADD_SUBDIRECTORY(lib/src/jsoncpp) +SET(BUILD_SHARED_LIBS ON) +SET(LIBTINS_BUILD_SHARED OFF) +SET(LIBTINS_ENABLE_CXX11 ON) +SET(LIBTINS_ENABLE_WPA2 OFF) +SET(LIBTINS_ENABLE_DOT11 OFF) +SET(HAVE_PCAP_IMMEDIATE_MODE ON) +SET(LIBTINS_ENABLE_ACK_TRACKER OFF) +SET(LIBTINS_ENABLE_WPA2_CALLBACKS OFF) +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/lib/src/libtins/cmake/Modules) ADD_SUBDIRECTORY(lib/src/libtins) set_property(TARGET 121Nat PROPERTY CXX_STANDARD 11) set_property(TARGET 121Nat PROPERTY CXX_STANDARD_REQUIRED ON) diff --git a/lib/src/jsoncpp b/lib/src/jsoncpp index 9234cbb..1b5e61d 160000 --- a/lib/src/jsoncpp +++ b/lib/src/jsoncpp @@ -1 +1 @@ -Subproject commit 9234cbbc90d1f6c70dd5a90b4d533779e45c820c +Subproject commit 1b5e61d008024f94395b58daaaed2d1e2075a210 diff --git a/lib/src/libtins b/lib/src/libtins index 534bdaf..b7e20f5 160000 --- a/lib/src/libtins +++ b/lib/src/libtins @@ -1 +1 @@ -Subproject commit 534bdaf30bf70df0fa41d36d22f573f0d9f521a5 +Subproject commit b7e20f550ec16536ac9557e561ce17a050e83bd1 diff --git a/src/PduSender.cpp b/src/PduSender.cpp index 64ee8d4..4542e3d 100644 --- a/src/PduSender.cpp +++ b/src/PduSender.cpp @@ -57,7 +57,7 @@ namespace otonat { for (NatRange & range : this->map->ranges) { if (range.calcIpRange(true).contains(dstIp)) { - LOG(INFO) << msgStream.str() << " (size = " << pdu->size() << ")"; + //LOG(INFO) << msgStream.str() << " (size = " << pdu->size() << ")"; sender.send(*pdu, range.interface); delete pdu; break; diff --git a/src/PduSniffer.cpp b/src/PduSniffer.cpp index 5bdd86f..d2fc357 100644 --- a/src/PduSniffer.cpp +++ b/src/PduSniffer.cpp @@ -51,11 +51,11 @@ bool PduSniffer::sniffPdu(const Tins::PDU& pdu) { if (map->isOutgoingPdu(pdu, interfaceId)) { - LOG(INFO) << "skip-outgoing: interface = " << interfaceName << "( id = " << interfaceId << ") (size = " << pdu.size() << ")"; + //LOG(INFO) << "skip-outgoing: interface = " << interfaceName << "( id = " << interfaceId << ") (size = " << pdu.size() << ")"; return this->isRunnig; } - LOG(INFO) << "sniff-incomming: interface = " << interfaceName << " (id = " << interfaceId << ") (size = " << pdu.size() << ")"; + //LOG(INFO) << "sniff-incomming: interface = " << interfaceName << " (id = " << interfaceId << ") (size = " << pdu.size() << ")"; this->map->pushPduToIncommingPduQueue(pdu.clone()); return this->isRunnig; } @@ -74,7 +74,7 @@ void PduSniffer::SniffInterface(const Tins::NetworkInterface & interface) { interfaceId = interface.id(); interfaceName = interface.name(); - LOG(INFO) << "create-sniffer: interface = " << interfaceName << " (id = " << interfaceId << ")"; + //LOG(INFO) << "create-sniffer: interface = " << interfaceName << " (id = " << interfaceId << ")"; Start(); Tins::Sniffer * sniffer = new Tins::Sniffer(interfaceName, config); sniffer->sniff_loop(std::bind(&PduSniffer::sniffPdu, this, std::placeholders::_1)); diff --git a/src/main.cpp b/src/main.cpp index a00a277..d23cb01 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include #include "easylogging++.h" +//#define ELPP_THREAD_SAFE INITIALIZE_EASYLOGGINGPP template @@ -28,7 +29,7 @@ int main(int argc, char** argv) } el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "[%datetime] [%loc]: %msg"); - LOG(INFO) << "Hello, world, start 121nat"; + //LOG(INFO) << "Hello, world, start 121nat"; otonat::NatMap::NatRangeList interfaceList; std::ifstream config_doc(argv[1], std::ifstream::binary); Json::Value root; diff --git a/src/natmap.cpp b/src/natmap.cpp index ae8ea50..47b29fe 100644 --- a/src/natmap.cpp +++ b/src/natmap.cpp @@ -60,7 +60,7 @@ void NatMap::handlePdu(const Tins::PDU * pdu) { if (pdu == nullptr) { - LOG(INFO) << "pdu is null"; + //LOG(INFO) << "pdu is null"; return; } @@ -69,7 +69,7 @@ void NatMap::handlePdu(const Tins::PDU * pdu) Tins::ARP * arp = pduCopy->find_pdu(); if (arp != nullptr) { - LOG(INFO) << "handle-arp: dst = " << arp->target_ip_addr() << ", src= " << arp->sender_ip_addr() << ", opcode = " << arp->opcode() << " (size = " << pduCopy->size() <<" )"; + //LOG(INFO) << "handle-arp: dst = " << arp->target_ip_addr() << ", src= " << arp->sender_ip_addr() << ", opcode = " << arp->opcode() << " (size = " << pduCopy->size() <<" )"; if (handleArp(arp)) { this->pushPduToOutgoingPduQueue(pduCopy); @@ -80,7 +80,7 @@ void NatMap::handlePdu(const Tins::PDU * pdu) Tins::IP * ip = pduCopy->find_pdu(); if (ip != nullptr) { - LOG(INFO) << "handle-ip: dst = " << ip->dst_addr() << ", src= " << ip->src_addr() << ", checksum = " << ip->checksum() << " (size = " << pduCopy->size() << ")"; + //LOG(INFO) << "handle-ip: dst = " << ip->dst_addr() << ", src= " << ip->src_addr() << ", checksum = " << ip->checksum() << " (size = " << pduCopy->size() << ")"; if(handleIp(ip, pduCopy)) { this->pushPduToOutgoingPduQueue(pduCopy); @@ -88,7 +88,7 @@ void NatMap::handlePdu(const Tins::PDU * pdu) } else { - LOG(INFO) << "handle-unkown: (size = " << pduCopy->size() << ")"; + //LOG(INFO) << "handle-unkown: (size = " << pduCopy->size() << ")"; } }