diff --git a/configure.seed b/configure.seed index d2fa3faaba..7880029ac8 100644 --- a/configure.seed +++ b/configure.seed @@ -15,6 +15,14 @@ NTOPNG_SHORT_VERSION="@SHORT_VERSION@" MACHINE=`uname -m` SYSTEM=`uname -s` +PRO_MAKEFILE_INC= +PRO_INCS= +PRO_LIBS= +ADDITIONAL_PRO_OBJECTS= +PRO_OBJECTS= +PRO_HEADERS= +PRO_LIBS= + AC_ARG_WITH(nedge, [ --with-nedge Enable nEdge device build]) NEDGE=0 @@ -109,6 +117,15 @@ AC_ARG_WITH(ndpi-includes, NDPI_CUST_INC="-I$withval -I$withval/../lib/third_party/include" ]) +EBPF_HOME="../ebpf/ebpfflowlib/" +AC_MSG_CHECKING(for ebpfflowlib) +if test ! -z "$EBPF_HOME" ; then : + AC_MSG_RESULT(found $EBPF_HOME) + PRO_INCS="${PRO_INCS} -I ${EBPF_HOME}" + PRO_LIBS="${PRO_LIBS} -L${EBPF_HOME} -lebpfflow" + AC_DEFINE_UNQUOTED(HAVE_EBPF, 1, [Building with eBPF support]) +fi + PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [ NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`/libndpi # Use static libndpi library as building against the dynamic library fails @@ -165,13 +182,6 @@ if test -d "/usr/include/openssl"; then : fi AC_MSG_CHECKING(for ntopng professional edition) -PRO_MAKEFILE_INC= -PRO_INCS= -PRO_LIBS= -ADDITIONAL_PRO_OBJECTS= -PRO_OBJECTS= -PRO_HEADERS= -PRO_LIBS= SERVICE_ALIAS= SERVICE_REQUIRES= diff --git a/include/NetworkInterface.h b/include/NetworkInterface.h index 933579a653..b4659edcf8 100644 --- a/include/NetworkInterface.h +++ b/include/NetworkInterface.h @@ -85,6 +85,11 @@ class NetworkInterface : public Checkpointable { NetworkDiscovery *discovery; MDNS *mdns; +#ifdef HAVE_EBPF + /* eBPF */ + SPSCQueue *ebpfEvents; +#endif + /* Live Capture */ Mutex active_captures_lock; u_int8_t num_live_captures; @@ -694,6 +699,10 @@ class NetworkInterface : public Checkpointable { virtual bool read_from_pcap_dump() { return(false); }; void makeTsPoint(NetworkInterfaceTsPoint *pt); void tsLua(lua_State* vm); +#ifdef HAVE_EBFF + inline void enqueueeBPFEvent(void *event) { if(ebpfEvents) ebpfEvents->enqueue(event, false); } + inline bool dequeueeBPFEvent(void **event) { return(ebpfEvents ? ebpfEvents->dequeue(event) : false); } +#endif }; class NetworkInterfaceTsPoint: public TimeseriesPoint { diff --git a/include/ntop_includes.h b/include/ntop_includes.h index dd2b887539..21bcfdc6e2 100644 --- a/include/ntop_includes.h +++ b/include/ntop_includes.h @@ -151,6 +151,10 @@ extern "C" { #endif }; +#ifdef HAVE_EBPF +#include "ebpf_flow.h" +#endif + #include #include #include @@ -244,6 +248,7 @@ using namespace std; #include "TimeseriesExporter.h" #include "TimeseriesRing.h" #include "HostTimeseriesPoint.h" +#include "SPSCQueue.h" #include "NetworkInterface.h" #ifndef HAVE_NEDGE #include "PcapInterface.h" @@ -275,7 +280,6 @@ using namespace std; #include "BatchedMySQLDB.h" #include "BatchedMySQLDBEntry.h" #endif -#include "SPSCQueue.h" #include "LuaHandler.h" #ifndef WIN32 #include "NagiosManager.h" diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index f9295710b2..19fa0c511c 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -342,6 +342,10 @@ void NetworkInterface::init() { if(TimeseriesRing::isRingEnabled(ntop->getPrefs())) ts_ring = new TimeseriesRing(this); } + +#ifdef HAVE_EBPF + ebpfEvents = new SPSCQueue(); +#endif } /* **************************************************** */ @@ -736,6 +740,11 @@ void NetworkInterface::deleteDataStructures() { free(ifname); ifname = NULL; } + +#ifdef HAVE_EBPF + if(ebpfEvents) + delete ebpfEvents; +#endif } /* **************************************************** */