Do not interfere with CFLAGS/LDFLAGS env anymore. (#1659)
* CI fixes * some build systems do not like that (e.g. OpenWrt) * fixed some rrdtool related build warnings/errors Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
+37
-22
@@ -13,6 +13,8 @@ jobs:
|
||||
coverage:
|
||||
name: Coverage (ubuntu-latest)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -25,7 +27,7 @@ jobs:
|
||||
sudo apt-get install libpcre3-dev libmaxminddb-dev lcov
|
||||
sudo apt-get install wdiff colordiff
|
||||
- name: Configure
|
||||
run: env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-code-coverage --with-pcre --with-maxminddb --enable-tls-sigs
|
||||
run: ./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-code-coverage --with-pcre --with-maxminddb --enable-tls-sigs
|
||||
- name: Build
|
||||
run: make all
|
||||
- name: Test
|
||||
@@ -45,6 +47,8 @@ jobs:
|
||||
python-bindings:
|
||||
name: Python Bindings (ubuntu-latest)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -59,7 +63,7 @@ jobs:
|
||||
sudo apt-get install autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev
|
||||
- name: Build nDPI library
|
||||
run: |
|
||||
env CC=gcc CFLAGS='-Werror' ./autogen.sh
|
||||
./autogen.sh
|
||||
make
|
||||
sudo make install
|
||||
- name: Generate Python bindings
|
||||
@@ -108,6 +112,9 @@ jobs:
|
||||
performance:
|
||||
name: Performance (ubuntu-latest)
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
CFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -117,7 +124,7 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison libpcap-dev
|
||||
sudo apt-get install golang-1.16-go libgoogle-perftools-dev graphviz
|
||||
env GO111MODULE=on go install github.com/google/pprof@latest
|
||||
go install github.com/google/pprof@latest
|
||||
sudo ln -s ${HOME}/go/bin/pprof /usr/bin/pprof
|
||||
pprof -h
|
||||
- name: Configure nDPI library
|
||||
@@ -164,13 +171,16 @@ jobs:
|
||||
test:
|
||||
name: ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.gcrypt }} ${{ matrix.compiler }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} ${{ matrix.msan }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: -Werror
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "ubuntu-18.04", "macOS-latest", "macos-11", "windows-latest"]
|
||||
arch: ["x86_64"]
|
||||
gcrypt: ["--with-local-libgcrypt", ""]
|
||||
compiler: ["default-cc"]
|
||||
compiler: ["cc"]
|
||||
pcre: [""]
|
||||
maxminddb: [""]
|
||||
msan: [""]
|
||||
@@ -203,56 +213,56 @@ jobs:
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "--with-sanitizer"
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-latest
|
||||
arch: "x86_64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "--with-sanitizer"
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-latest
|
||||
arch: "x86_64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "--with-thread-sanitizer"
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-18.04
|
||||
arch: "x86_64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "--with-sanitizer"
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: macOS-latest
|
||||
arch: "x86_64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "" # Disable sanitizer on macos
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: macos-11
|
||||
arch: "x86_64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "" # Disable sanitizer on macos
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-latest
|
||||
arch: "arm64"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "" # Disable sanitizer on arm64
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-latest
|
||||
arch: "armhf"
|
||||
gcrypt: ""
|
||||
pcre: "--with-pcre"
|
||||
maxminddb: "--with-maxminddb"
|
||||
msan: "--with-sanitizer"
|
||||
- compiler: "default-cc"
|
||||
- compiler: "cc"
|
||||
os: ubuntu-latest
|
||||
arch: "s390x"
|
||||
gcrypt: ""
|
||||
@@ -321,6 +331,9 @@ jobs:
|
||||
msys2 -c 'make install'
|
||||
msys2 -c 'cd ..'
|
||||
msys2 -c 'rm -rf libgcrypt/'
|
||||
env:
|
||||
CC:
|
||||
CFLAGS:
|
||||
- name: Installing MacOS prerequisites
|
||||
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64')
|
||||
run: |
|
||||
@@ -338,30 +351,30 @@ jobs:
|
||||
run: |
|
||||
brew install libmaxminddb
|
||||
- name: Configure nDPI on Ubuntu
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'default-cc')
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'cc')
|
||||
run: |
|
||||
env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
- name: Configure nDPI on MacOS
|
||||
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'default-cc')
|
||||
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'cc')
|
||||
run: |
|
||||
env CC=clang CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
- name: Configure nDPI on Windows
|
||||
if: startsWith(matrix.os, 'windows') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'default-cc')
|
||||
if: startsWith(matrix.os, 'windows') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'cc')
|
||||
run: |
|
||||
msys2 -c 'env CFLAGS=\"-Werror\" ./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs --disable-npcap ${{ matrix.gcrypt }}'
|
||||
msys2 -c './autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs --disable-npcap ${{ matrix.gcrypt }}'
|
||||
- name: Build nDPI on Windows
|
||||
if: startsWith(matrix.os, 'windows') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'default-cc')
|
||||
if: startsWith(matrix.os, 'windows') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'cc')
|
||||
run: |
|
||||
msys2 -c 'make all'
|
||||
msys2 -c 'ldd ./example/ndpiReader.exe'
|
||||
- name: Configure nDPI with specified GCC version on Ubuntu
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'gcc')
|
||||
run: |
|
||||
env CC=${{ matrix.compiler }} CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
- name: Configure nDPI with specified CLANG on Ubuntu
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.compiler, 'clang')
|
||||
run: |
|
||||
env CC=${{ matrix.compiler }} CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs
|
||||
- name: Build nDPI
|
||||
if: startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.os, 'windows')
|
||||
run: |
|
||||
@@ -406,8 +419,10 @@ jobs:
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64')
|
||||
run: |
|
||||
make distclean
|
||||
env CFLAGS='-Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs --host=x86_64-w64-mingw32
|
||||
./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs --host=x86_64-w64-mingw32
|
||||
make all
|
||||
env:
|
||||
CC:
|
||||
- name: Display qemu specified architecture (arm64 - little endian)
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'arm64')
|
||||
uses: docker://multiarch/ubuntu-core:arm64-bionic
|
||||
|
||||
+14
-12
@@ -29,9 +29,9 @@ AS_IF([test "${with_sanitizer+set}" = set -a "${with_thread_sanitizer+set}" = se
|
||||
AC_MSG_ERROR([Configure options `--with-sanitizer' and `--with_thread_sanitizer' can not used at the same time.])
|
||||
])
|
||||
AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -O0 -g3"
|
||||
NDPI_CFLAGS="${NDPI_CFLAGS} -O0 -g3"
|
||||
],[
|
||||
CFLAGS="${CFLAGS} -g"
|
||||
NDPI_CFLAGS="${NDPI_CFLAGS} -g"
|
||||
])
|
||||
AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = set],[
|
||||
AS_IF([test "x$enable_gprof" = "xyes"], [
|
||||
@@ -40,18 +40,18 @@ AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = se
|
||||
])
|
||||
|
||||
AS_IF([test "${with_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
|
||||
LDFLAGS="${LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
|
||||
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
|
||||
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
|
||||
])
|
||||
|
||||
AS_IF([test "${with_thread_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -fsanitize=thread -fno-omit-frame-pointer"
|
||||
LDFLAGS="${LDFLAGS} -fsanitize=thread"
|
||||
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=thread -fno-omit-frame-pointer"
|
||||
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fsanitize=thread"
|
||||
])
|
||||
|
||||
AS_IF([test "x${enable_code_coverage}" = "xyes"],[
|
||||
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
|
||||
LDFLAGS="${LDFLAGS} --coverage"
|
||||
NDPI_CFLAGS="${NDPI_CFLAGS} -fprofile-arcs -ftest-coverage"
|
||||
NDPI_LDFLAGS="${NDPI_LDFLAGS} --coverage"
|
||||
])
|
||||
|
||||
AS_IF([test "${enable_npcap+set}" = set],[DISABLE_NPCAP=1],[DISABLE_NPCAP=0])
|
||||
@@ -149,7 +149,7 @@ AS_IF([test "x${enable_tls_sigs}" = "xyes"],[
|
||||
HANDLE_TLS_SIGS=""
|
||||
])
|
||||
|
||||
CFLAGS="-W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-address-of-packed-member ${CFLAGS}"
|
||||
NDPI_CFLAGS="-W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-address-of-packed-member ${NDPI_CFLAGS}"
|
||||
|
||||
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h math.h float.h])
|
||||
AC_CHECK_LIB([m], [sqrt], [], [LIBM="-lm"])
|
||||
@@ -202,16 +202,16 @@ case "$host" in
|
||||
case "$host" in
|
||||
x86_64-*)
|
||||
BUILD_MINGW_X64=1
|
||||
LDFLAGS="${LDFLAGS} -L/mingw64/lib"
|
||||
NDPI_LDFLAGS="${NDPI_LDFLAGS} -L/mingw64/lib"
|
||||
;;
|
||||
i686-*)
|
||||
LDFLAGS="${LDFLAGS} -L/mingw32/lib"
|
||||
NDPI_LDFLAGS="${NDPI_LDFLAGS} -L/mingw32/lib"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unsupported MingW cross compiler.])
|
||||
;;
|
||||
esac
|
||||
CFLAGS="-D__USE_MINGW_ANSI_STDIO -D__STDC_FORMAT_MACROS ${CFLAGS}"
|
||||
NDPI_CFLAGS="-D__USE_MINGW_ANSI_STDIO -D__STDC_FORMAT_MACROS ${NDPI_CFLAGS}"
|
||||
LIBS="${LIBS} -lws2_32"
|
||||
BUILD_MINGW=1
|
||||
EXE_SUFFIX=".exe"
|
||||
@@ -369,4 +369,6 @@ AC_SUBST(PCRE_ENABLED)
|
||||
AC_SUBST(HANDLE_TLS_SIGS)
|
||||
AC_SUBST(DISABLE_NPCAP)
|
||||
AC_SUBST(EXE_SUFFIX)
|
||||
AC_SUBST(NDPI_CFLAGS)
|
||||
AC_SUBST(NDPI_LDFLAGS)
|
||||
AC_OUTPUT
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ SRCHOME=../src
|
||||
ifneq ($(OS),Windows_NT)
|
||||
CFLAGS+=-fPIC -DPIC
|
||||
endif
|
||||
CFLAGS+=-I$(SRCHOME)/include @PCAP_INC@ @CFLAGS@ @GPROF_CFLAGS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
CFLAGS+=-I$(SRCHOME)/include @NDPI_CFLAGS@ @PCAP_INC@ @GPROF_CFLAGS@
|
||||
LDFLAGS+=@NDPI_LDFLAGS@
|
||||
LIBNDPI=$(SRCHOME)/lib/libndpi.a
|
||||
LIBS=$(LIBNDPI) @PCAP_LIB@ @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@
|
||||
HEADERS=reader_util.h $(SRCHOME)/include/ndpi_api.h \
|
||||
|
||||
+8
-8
@@ -10,8 +10,8 @@ fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_process_packet_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_process_packet_LDFLAGS) $(LDFLAGS) -o $@
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_process_packet_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_process_packet_with_main_SOURCES = fuzz_process_packet.c
|
||||
fuzz_process_packet_with_main_CFLAGS = -DBUILD_MAIN
|
||||
@@ -19,8 +19,8 @@ fuzz_process_packet_with_main_LDADD = ../src/lib/libndpi.a
|
||||
fuzz_process_packet_with_main_LDFLAGS = $(ADDITIONAL_LIBS) $(LIBS)
|
||||
# force usage of CXX for linker
|
||||
fuzz_process_packet_with_main_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_process_packet_with_main_LDFLAGS) $(LDFLAGS) -o $@
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_process_packet_with_main_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_ndpi_reader_SOURCES = fuzz_ndpi_reader.c
|
||||
fuzz_ndpi_reader_CFLAGS = -I../example/
|
||||
@@ -32,8 +32,8 @@ fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_ndpi_reader_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_LDFLAGS) $(LDFLAGS) -o $@
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_ndpi_reader_with_main_SOURCES = fuzz_ndpi_reader.c
|
||||
fuzz_ndpi_reader_with_main_CFLAGS = -I../example/ -DBUILD_MAIN
|
||||
@@ -41,8 +41,8 @@ fuzz_ndpi_reader_with_main_LDADD = ../src/lib/libndpi.a
|
||||
fuzz_ndpi_reader_with_main_LDFLAGS = ../example/libndpiReader.a $(PCAP_LIB) $(ADDITIONAL_LIBS) $(LIBS)
|
||||
# force usage of CXX for linker
|
||||
fuzz_ndpi_reader_with_main_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_with_main_LDFLAGS) $(LDFLAGS) -o $@
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) @NDPI_CFLAGS@ $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_with_main_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@
|
||||
|
||||
# required for Google oss-fuzz
|
||||
# see https://github.com/google/oss-fuzz/tree/master/projects/ndpi
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
CC=@CC@
|
||||
INC=-I ../src/include -I/usr/local/include
|
||||
LIBDPI=../src/lib/libndpi.a
|
||||
LDFLAGS=@LDFLAGS@
|
||||
CFLAGS+=@NDPI_CFLAGS@
|
||||
LDFLAGS+=@NDPI_LDFLAGS@
|
||||
LIB=$(LIBDPI) -lm @ADDITIONAL_LIBS@ @LIBS@
|
||||
|
||||
TOOLS=metric_anomaly
|
||||
@@ -9,7 +10,7 @@ TOOLS=metric_anomaly
|
||||
all: $(TOOLS)
|
||||
|
||||
metric_anomaly: metric_anomaly.c Makefile $(LIBDPI)
|
||||
$(CC) $(CPPFLAGS) -g $(INC) $(LDFLAGS) metric_anomaly.c -o metric_anomaly $(LIB)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) metric_anomaly.c -o metric_anomaly $(LIB)
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o $(TOOLS) *~
|
||||
|
||||
+4
-3
@@ -1,7 +1,8 @@
|
||||
CC=@CC@
|
||||
INC=-I ../src/include -I/usr/local/include
|
||||
LIBDPI=../src/lib/libndpi.a
|
||||
LDFLAGS=@LDFLAGS@
|
||||
CFLAGS+=@NDPI_CFLAGS@
|
||||
LDFLAGS+=@NDPI_LDFLAGS@
|
||||
LIB=$(LIBDPI) -lm @ADDITIONAL_LIBS@ @LIBRRD@ @LIBS@
|
||||
|
||||
TOOLS=rrd_anomaly rrd_similarity
|
||||
@@ -9,10 +10,10 @@ TOOLS=rrd_anomaly rrd_similarity
|
||||
all: $(TOOLS)
|
||||
|
||||
rrd_anomaly: rrd_anomaly.c Makefile $(LIBDPI)
|
||||
$(CC) $(CPPFLAGS) -g $(INC) $(LDFLAGS) rrd_anomaly.c -o rrd_anomaly $(LIB)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) rrd_anomaly.c -o rrd_anomaly $(LIB)
|
||||
|
||||
rrd_similarity: rrd_similarity.c Makefile $(LIBDPI)
|
||||
$(CC) $(CPPFLAGS) -g $(INC) $(LDFLAGS) rrd_similarity.c -o rrd_similarity $(LIB)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -g $(INC) $(LDFLAGS) rrd_similarity.c -o rrd_similarity $(LIB)
|
||||
|
||||
clean:
|
||||
/bin/rm -f *.o $(TOOLS) *~
|
||||
|
||||
@@ -54,11 +54,11 @@ int main(int argc, char *argv[]) {
|
||||
unsigned long step = 0, ds_cnt = 0;
|
||||
rrd_value_t *data, *p;
|
||||
char **names, *filename = NULL, *start_s, *end_s, *cf;
|
||||
u_int i, j, t, first = 1, quick_mode = 0, verbose = 0;
|
||||
time_t start, end;
|
||||
u_int i, first = 1, quick_mode = 0, verbose = 0;
|
||||
time_t t, start, end;
|
||||
struct ndpi_ses_struct ses;
|
||||
float alpha, ro;
|
||||
char c;
|
||||
int c;
|
||||
|
||||
/* Defaults */
|
||||
alpha = DEFAULT_ALPHA;
|
||||
@@ -138,8 +138,6 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
p = data;
|
||||
for(t=start+1, i=0; t<end; t+=step, i++) {
|
||||
j = 0; /* Consider only the first DS */
|
||||
/* for(j=0; j<ds_cnt; j++) */ {
|
||||
rrd_value_t value = *p++;
|
||||
|
||||
if(!isnan(value)) {
|
||||
@@ -156,7 +154,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if(verbose || is_anomaly) {
|
||||
if(quick_mode) {
|
||||
printf("%u\n", t);
|
||||
printf("%ld\n", t);
|
||||
} else {
|
||||
const time_t _t = t;
|
||||
struct tm *t_info = localtime((const time_t*)&_t);
|
||||
@@ -176,7 +174,6 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rrd_freemem(data);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ u_int verbose = 0, similarity_threshold = 100, skip_zero = 0;
|
||||
/* *************************************************** */
|
||||
|
||||
static void help() {
|
||||
printf("Usage: rrd_similarity [-v][-a <alpha>][-e <end>][-q][-s <start>]\n"
|
||||
printf("Usage: rrd_similarity [-v][-e <end>][-q][-s <start>]\n"
|
||||
" -f <filename> -d <basedir> [-t <threshold>]\n"
|
||||
"-a | Set alpha. Valid range >0 .. <1. Default %.2f\n"
|
||||
"-e <end> | RRD end time. Default %s\n"
|
||||
@@ -77,7 +77,8 @@ void analyze_rrd(rrd_file_stats *rrd, time_t start, time_t end) {
|
||||
unsigned long step = 0, ds_cnt = 0;
|
||||
rrd_value_t *data, *p;
|
||||
char **names;
|
||||
u_int t, i, j, num_points;
|
||||
time_t t;
|
||||
u_int i, num_points;
|
||||
struct ndpi_analyze_struct *s;
|
||||
|
||||
if(rrd_fetch_r(rrd->path, "AVERAGE", &start, &end, &step, &ds_cnt, &names, &data) != 0) {
|
||||
@@ -205,16 +206,13 @@ void find_rrds(char *basedir, char *filename, rrd_file_stats *rrds, u_int *num_r
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
rrd_time_value_t start_tv, end_tv;
|
||||
char *filename = NULL, *start_s, *end_s, *dirname = NULL, *basedir = NULL;
|
||||
u_int first = 1, quick_mode = 0;
|
||||
float alpha;
|
||||
char c;
|
||||
char *filename = NULL, *start_s, *end_s, *basedir = NULL;
|
||||
int c;
|
||||
time_t start, end;
|
||||
u_int num_rrds = 0, i;
|
||||
rrd_file_stats *rrds;
|
||||
|
||||
/* Defaults */
|
||||
alpha = DEFAULT_ALPHA;
|
||||
start_s = DEFAULT_START;
|
||||
end_s = DEFAULT_END;
|
||||
|
||||
@@ -235,25 +233,10 @@ int main(int argc, char *argv[]) {
|
||||
end_s = optarg;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quick_mode = 1;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
{
|
||||
float f = atof(optarg);
|
||||
|
||||
if((f > 0) && (f < 1))
|
||||
alpha = f;
|
||||
else
|
||||
printf("Discarding -a: valid range is >0 .. <1\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
filename = optarg;
|
||||
break;
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ includedir = ${prefix}/include/ndpi
|
||||
ifneq ($(OS),Windows_NT)
|
||||
CFLAGS += -fPIC -DPIC
|
||||
endif
|
||||
CFLAGS += -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION @CFLAGS@ @GPROF_CFLAGS@ @CUSTOM_NDPI@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
CFLAGS += -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION @NDPI_CFLAGS@ @GPROF_CFLAGS@ @CUSTOM_NDPI@
|
||||
LDFLAGS += @NDPI_LDFLAGS@
|
||||
LIBS = @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@
|
||||
|
||||
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
|
||||
|
||||
@@ -7,10 +7,10 @@ SRCHOME=../../src
|
||||
ifneq ($(OS),Windows_NT)
|
||||
CFLAGS+=-fPIC -DPIC
|
||||
endif
|
||||
CFLAGS+=-g -I$(SRCHOME)/include @CFLAGS@
|
||||
CFLAGS+=-g -I$(SRCHOME)/include @NDPI_CFLAGS@
|
||||
LIBNDPI=$(SRCHOME)/lib/libndpi.a
|
||||
LIBS=$(LIBNDPI) @ADDITIONAL_LIBS@ -lpthread @LIBS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LDFLAGS+=@NDPI_LDFLAGS@
|
||||
HEADERS=$(SRCHOME)/include/ndpi_api.h $(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
|
||||
OBJS=dga_evaluate
|
||||
PREFIX?=@prefix@
|
||||
|
||||
@@ -8,10 +8,10 @@ SRCHOME=../../src
|
||||
ifneq ($(OS),Windows_NT)
|
||||
CFLAGS+=-fPIC -DPIC
|
||||
endif
|
||||
CFLAGS+=-g -I$(SRCHOME)/include @JSONC_CFLAGS@ @PCAP_INC@ @CFLAGS@
|
||||
CFLAGS+=-g -I$(SRCHOME)/include @NDPI_CFLAGS@ @JSONC_CFLAGS@ @PCAP_INC@
|
||||
LIBNDPI=$(SRCHOME)/lib/libndpi.a
|
||||
LIBS=$(LIBNDPI) @PCAP_LIB@ @ADDITIONAL_LIBS@ @JSONC_LIBS@ @LIBS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LDFLAGS+=@NDPI_LDFLAGS@
|
||||
HEADERS=$(SRCHOME)/include/ndpi_api.h $(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
|
||||
OBJS=unit
|
||||
PREFIX?=@prefix@
|
||||
|
||||
Reference in New Issue
Block a user