aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2024-06-11 15:07:17 +0200
committerToni Uhlig <matzeton@googlemail.com>2024-06-12 15:07:17 +0200
commit165b18c82933bfbab41673804811df518c092d50 (patch)
tree79a561a975cb9bb82f783fd1fbc316be846f82d1
parent1fbfd46fe81890b6ff82f1b7faf863379c20ce67 (diff)
Fixed OpenWrt `nDPId-testing` build.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--examples/c-influxd/c-influxd.c5
-rw-r--r--packages/openwrt/net/nDPId-testing/Makefile14
2 files changed, 17 insertions, 2 deletions
diff --git a/examples/c-influxd/c-influxd.c b/examples/c-influxd/c-influxd.c
index 6477480f6..6ab88a9c7 100644
--- a/examples/c-influxd/c-influxd.c
+++ b/examples/c-influxd/c-influxd.c
@@ -1,5 +1,6 @@
#include <curl/curl.h>
#include <pthread.h>
+#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/epoll.h>
@@ -737,7 +738,7 @@ static int init_influx_ctx(struct influx_ctx * const ctx, char const * const url
if (curl_easy_setopt(ctx->curl, CURLOPT_URL, url) != CURLE_OK ||
curl_easy_setopt(ctx->curl, CURLOPT_USERAGENT, "nDPIsrvd-influxd") != CURLE_OK ||
curl_easy_setopt(ctx->curl, CURLOPT_HTTPHEADER, ctx->http_header) != CURLE_OK ||
- curl_easy_setopt(ctx->curl, CURLOPT_TIMEOUT, influxdb_interval_ull) != CURLE_OK)
+ curl_easy_setopt(ctx->curl, CURLOPT_TIMEOUT, (long)influxdb_interval_ull) != CURLE_OK)
{
return -1;
}
@@ -774,7 +775,7 @@ static void post_influx_ctx(struct influx_ctx * const ctx)
static void * send_to_influxdb(void * thread_data)
{
- struct influx_ctx influx_ctx;
+ struct influx_ctx influx_ctx = {};
(void)thread_data;
init_influx_ctx(&influx_ctx, influxdb_url, influxdb_token);
diff --git a/packages/openwrt/net/nDPId-testing/Makefile b/packages/openwrt/net/nDPId-testing/Makefile
index 12a4b7bab..3c53a4b5c 100644
--- a/packages/openwrt/net/nDPId-testing/Makefile
+++ b/packages/openwrt/net/nDPId-testing/Makefile
@@ -51,6 +51,14 @@ config NDPID_TESTING_LIBNDPI_COMMIT_HASH
Set the desired libnDPI git commit hash you want to link nDPId against.
Leave empty to use the dev branch.
Disabled by default.
+
+config NDPI_TESTING_INFLUXDB
+ bool "nDPIsrvd-influxdb"
+ depends on PACKAGE_nDPId-testing && PACKAGE_libcurl
+ default n
+ help
+ An InfluxDB push daemon. It aggregates various statistics gathered from nDPId.
+ The results are sent to a specified InfluxDB endpoint.
endef
CMAKE_OPTIONS += -DBUILD_EXAMPLES=ON
@@ -65,6 +73,10 @@ CMAKE_OPTIONS += -DSTATIC_LIBNDPI_INSTALLDIR="$(PKG_BUILD_DIR)/libnDPI/install"
TARGET_CFLAGS += -DLIBNDPI_STATIC=1
TARGET_CFLAGS += -Werror
+ifneq ($(CONFIG_NDPI_TESTING_INFLUXDB),)
+CMAKE_OPTIONS += -DENABLE_CURL=ON
+endif
+
ifneq ($(CONFIG_LIBNDPI_GCRYPT),)
CMAKE_OPTIONS += -DNDPI_WIDTH_GCRYPT=ON
endif
@@ -105,6 +117,8 @@ endef
endif
define Build/Prepare
+ @rm -f '$(DL_DIR)/$(PKG_SOURCE)'
+ @rm -rf '$(PKG_BUILD_DIR)/*'
@echo 'tar: $(DL_DIR)/$(PKG_SOURCE)'
@echo 'pwd: $(shell pwd)'
@echo 'PKG_DIRECTORY=$(PKG_DIRECTORY)'