update libs and fix cmakelist. Uncomment log msg (cause segment errors)
This commit is contained in:
@@ -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)
|
||||
|
||||
Submodule lib/src/jsoncpp updated: 9234cbbc90...1b5e61d008
Submodule lib/src/libtins updated: 534bdaf30b...b7e20f550e
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <fstream>
|
||||
#include "easylogging++.h"
|
||||
|
||||
//#define ELPP_THREAD_SAFE
|
||||
INITIALIZE_EASYLOGGINGPP
|
||||
|
||||
template<typename Container>
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Tins::ARP>();
|
||||
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<Tins::IP>();
|
||||
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() << ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user