diff --git a/.travis.yml b/.travis.yml index a60c30b5f725..d8450093eb79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ install: - sudo apt-get install subversion libglib2.0 libxml2-dev libpcap-dev libtool rrdtool librrd-dev autoconf automake autogen redis-server wget libsqlite3-dev libhiredis-dev libgeoip-dev libcurl4-openssl-dev libpango1.0-dev libcairo2-dev libpng12-dev git before_script: + - git clone https://github.com/ntop/nDPI.git; cd nDPI; ./autogen.sh; make; cd .. - ./autogen.sh script: diff --git a/Makefile.in b/Makefile.in index aea72abaa93b..3ef085d6be8f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,8 +13,8 @@ ifeq ($(HAS_NDPI), 0) NDPI_LIB = $(shell pkg-config --libs libndpi) NDPI_LIB_DEP = else - NDPI_INC=-I./nDPI/src/include - NDPI_LIB=./nDPI/src/lib/.libs/libndpi.a + NDPI_INC=-I@NDPI_HOME@/src/include + NDPI_LIB=@NDPI_HOME@/src/lib/.libs/libndpi.a NDPI_LIB_DEP=$(NDPI_LIB) endif ###### @@ -82,8 +82,8 @@ PLATFORM = `uname -p` REVISION = @GIT_RELEASE@ PACKAGE_VERSION = @PACKAGE_VERSION@ NTOPNG_VERSION = @NTOPNG_VERSION@ -RPM_PKG = $(TARGET)-$(NTOPNG_VERSION)-@TODAY@.$(PLATFORM).rpm -RPM_DATA_PKG = $(TARGET)-data-$(NTOPNG_VERSION)-@TODAY@.noarch.rpm +RPM_PKG = $(TARGET)-$(NTOPNG_VERSION)-@REVISION@.$(PLATFORM).rpm +RPM_DATA_PKG = $(TARGET)-data-$(NTOPNG_VERSION)-@REVISION@.noarch.rpm ###### ifeq ($(OS),Darwin) @@ -130,12 +130,6 @@ HEADERS = $(wildcard include/*.h) @PRO_HEADERS@ $(TARGET): $(OBJECTS) $(LIBRRDTOOL) Makefile $(GPP) $(OBJECTS) -Wall $(LIBS) -o $@ -$(NDPI_LIB): nDPI - cd nDPI; if test ! -f Makefile; then ./autogen.sh ; ./configure; fi; make - -nDPI: - git clone https://github.com/ntop/nDPI.git - $(LUAJIT_LIB): cd $(LUAJIT_HOME); @GMAKE@ diff --git a/README.ntopng b/README.ntopng index cbacab3c2e63..96bf4ae4cb49 100644 --- a/README.ntopng +++ b/README.ntopng @@ -16,11 +16,11 @@ Prerequisites On Ubuntu/Debian - apt-get install build-essential -- apt-get install subversion libglib2.0 libxml2-dev libpcap-dev libtool rrdtool librrd-dev autoconf automake autogen redis-server wget libsqlite3-dev libhiredis-dev libgeoip-dev libcurl4-openssl-dev libpango1.0-dev libcairo2-dev libpng12-dev git +- apt-get install libglib2.0 libxml2-dev libpcap-dev libtool rrdtool librrd-dev autoconf automake autogen redis-server wget libsqlite3-dev libhiredis-dev libgeoip-dev libcurl4-openssl-dev libpango1.0-dev libcairo2-dev libpng12-dev git On Fedora/CentOS - yum groupinstall "Development tools" -- yum install subversion autoconf automake autogen libpcap-devel GeoIP-devel hiredis-devel redis glib2-devel libxml2-devel sqlite-devel gcc-c++ libtool wget libcurl-devel pango-devel cairo-devel libpng-devel git +- yum install git autoconf automake autogen libpcap-devel GeoIP-devel hiredis-devel redis glib2-devel libxml2-devel sqlite-devel gcc-c++ libtool wget libcurl-devel pango-devel cairo-devel libpng-devel On MacOSX (using http://brew.sh) brew install redis hiredis autoconf automake libtool rrdtool wget pkg-config git diff --git a/configure.seed b/configure.seed index 360bcba5d81e..e6c72c07acae 100644 --- a/configure.seed +++ b/configure.seed @@ -8,7 +8,7 @@ dnl> Add /usr/local/ /opt/local CFLAGS="" NTOPNG_VERSION="@VERSION@" NTOPNG_SHORT_VERSION="@SHORT_VERSION@" -TODAY=`date +%y%m%d` +REVISION=`git rev-list --all |wc -l` if test -d "/usr/local/include"; then CFLAGS="${CFLAGS} -I/usr/local/include" @@ -32,6 +32,36 @@ GIT_RELEASE="${PACKAGE_VERSION}" GIT_DATE=`date` fi +AC_MSG_CHECKING(for nDPI) +NDPI_HOME=./nDPI +if test -d "$NDPI_HOME" ; then : + AC_MSG_RESULT(found in $NDPI_HOME) +else + NDPI_HOME=../nDPI + if test -d "$NDPI_HOME"; then : + AC_MSG_RESULT(found in $NDPI_HOME) + else + NDPI_HOME=$HOME/nDPI + if test -d "$NDPI_HOME"; then : + AC_MSG_RESULT(found in $NDPI_HOME) + else + AC_MSG_RESULT(not found) + echo "Please do cd ..; git clone https://github.com/ntop/nDPI.git; cd nDPI; ./autogen.sh; make; cd ../ntopng" + echo " and try again" + exit + fi + fi +fi + +NDPI_LIB=$NDPI_HOME/src/lib/.libs/libndpi.a +AC_MSG_CHECKING(for $NDPI_LIB) +if test -f "$NDPI_LIB" ; then : + AC_MSG_RESULT(found $NDPI_LIB) +else + AC_MSG_RESULT(not found $NDPI_LIB: compiling) + cd $NDPI_HOME; ./autogen.sh; make; cd - +fi + if test -d "pro"; then : PRO_OBJECTS='$(patsubst pro/%.cpp, pro/%.o, $(wildcard pro/*.cpp))' PRO_HEADERS='$(wildcard pro/*.h)' @@ -142,7 +172,7 @@ if test -f "/usr/local/lib/libpfring.a" || test -f "/opt/pfring/lib/libpfring.a" exit fi fi - fi + fi else LDFLAGS="${LDFLAGS} -lpfring" echo "Compiling ntopng with PF_RING support" @@ -286,6 +316,7 @@ AC_SUBST(GIT_DATE) AC_SUBST(GIT_INDEX) AC_SUBST(INSTALL_DIR) AC_SUBST(MAN_DIR) +AC_SUBST(NDPI_HOME) AC_SUBST(HIREDIS_INC) AC_SUBST(HIREDIS_LIB) AC_SUBST(PRO_OBJECTS) @@ -293,7 +324,7 @@ AC_SUBST(PRO_HEADERS) AC_SUBST(PRO_MAKEFILE_INC) AC_SUBST(PRO_LIBS) AC_SUBST(PRO_INC) -AC_SUBST(TODAY) +AC_SUBST(REVISION) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES(packages/ntopng.spec) AC_CONFIG_FILES(packages/ntopng-data.spec) diff --git a/include/ntop_defines.h b/include/ntop_defines.h index ad72a0e8ed3b..bd28c424683a 100644 --- a/include/ntop_defines.h +++ b/include/ntop_defines.h @@ -136,6 +136,7 @@ #define CONST_ALLOWED_NETS "allowed_nets" #define CONST_USER "user" #define CONST_ES_QUEUE_NAME "ntopng.es" +#define CONST_NTOP_INTERFACE "ntop_interface" #define CONST_INTERFACE_TYPE_PCAP "pcap" #define CONST_INTERFACE_TYPE_PCAP_DUMP "pcap dump" diff --git a/src/Flow.cpp b/src/Flow.cpp index b04ccab3646f..3c10bf6f8666 100644 --- a/src/Flow.cpp +++ b/src/Flow.cpp @@ -1263,6 +1263,8 @@ json_object* Flow::flow2json(bool partial_dump) { || (ndpi_detected_protocol != NDPI_PROTOCOL_UNKNOWN)) json_object_object_add(my_object, Utils::jsonLabel(L7_PROTO, "L7_PROTO", jsonbuf, sizeof(jsonbuf)), json_object_new_int(get_detected_protocol())); + json_object_object_add(my_object, Utils::jsonLabel(L7_PROTO_NAME, "L7_PROTO_NAME", jsonbuf, sizeof(jsonbuf)), + json_object_new_string(get_detected_protocol_name())); if(protocol == IPPROTO_TCP) json_object_object_add(my_object, Utils::jsonLabel(TCP_FLAGS, "TCP_FLAGS", jsonbuf, sizeof(jsonbuf)), @@ -1318,6 +1320,7 @@ json_object* Flow::flow2json(bool partial_dump) { json_object_object_add(my_object, "HTTP_URL", json_object_new_string(http.last_url)); json_object_object_add(my_object, "HTTP_METHOD", json_object_new_string(http.last_method)); json_object_object_add(my_object, "HTTP_RET_CODE", json_object_new_int((u_int32_t)http.last_return_code)); + json_object_object_add(my_object, "HTTP_HOST", json_object_new_string(host_server_name)); } if(ssl.certificate) diff --git a/src/Lua.cpp b/src/Lua.cpp index 3e659431945b..d05fd07df162 100644 --- a/src/Lua.cpp +++ b/src/Lua.cpp @@ -244,7 +244,7 @@ static NetworkInterfaceView* get_ntop_interface(lua_State* vm) { ntop->getTrace()->traceEvent(TRACE_INFO, "%s() called", __FUNCTION__); - lua_getglobal(vm, "ntop_interface"); + lua_getglobal(vm, CONST_NTOP_INTERFACE); if((ntop_interface = (NetworkInterfaceView*)lua_touserdata(vm, lua_gettop(vm))) == NULL) { ntop_interface = handle_null_interface_view(vm); } @@ -292,7 +292,7 @@ static int ntop_select_interface(lua_State* vm) { ifname = (char*)lua_tostring(vm, 1); lua_pushlightuserdata(vm, (char*)ntop->getNetworkInterfaceView(ifname)); - lua_setglobal(vm, "ntop_interface"); + lua_setglobal(vm, CONST_NTOP_INTERFACE); return(CONST_LUA_OK); }