Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #12

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 4 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
######
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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@

Expand Down
4 changes: 2 additions & 2 deletions README.ntopng
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 34 additions & 3 deletions configure.seed
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)'
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -286,14 +316,15 @@ 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)
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)
Expand Down
1 change: 1 addition & 0 deletions include/ntop_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/Flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down