ntopng: 2.0 -> 5.2.1

This commit is contained in:
Nikolay Amiantov 2022-02-16 20:47:37 +03:00
parent dd3e416e1e
commit 6a91c56637
4 changed files with 22 additions and 98 deletions

View file

@ -1,12 +0,0 @@
diff --git a/src/Prefs.cpp b/src/Prefs.cpp
index 76385c4..db8d20d 100755
--- a/src/Prefs.cpp
+++ b/src/Prefs.cpp
@@ -795,7 +795,6 @@ int Prefs::checkOptions() {
ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to create log %s", path);
}
- free(data_dir); data_dir = strdup(ntop->get_install_dir());
docs_dir = ntop->getValidPath(docs_dir);
scripts_dir = ntop->getValidPath(scripts_dir);
callbacks_dir = ntop->getValidPath(callbacks_dir);

View file

@ -1,14 +0,0 @@
diff --git a/src/Ntop.cpp b/src/Ntop.cpp
index 8de92a9..510418f 100644
--- a/src/Ntop.cpp
+++ b/src/Ntop.cpp
@@ -197,8 +197,7 @@ void Ntop::registerPrefs(Prefs *_prefs) {
}
if(stat(prefs->get_callbacks_dir(), &statbuf)
- || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */
- || (!(statbuf.st_mode & S_IWRITE)) /* It's not writable */) {
+ || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */) {
ntop->getTrace()->traceEvent(TRACE_ERROR, "Invalid directory %s specified",
prefs->get_callbacks_dir());
_exit(-1);

View file

@ -1,34 +0,0 @@
From 9cb650ea96c0e5063775071cfdae072e92c553b8 Mon Sep 17 00:00:00 2001
From: emanuele-f <faranda@ntop.org>
Date: Tue, 18 Sep 2018 12:49:57 +0200
Subject: [PATCH] Compilation fix with new libpcap
SOCKET and INVALID_SOCKET are now defined in pcap.h
---
third-party/mongoose/mongoose.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/third-party/mongoose/mongoose.c b/third-party/mongoose/mongoose.c
index 6a61cea9b..634c142e3 100644
--- a/third-party/mongoose/mongoose.c
+++ b/third-party/mongoose/mongoose.c
@@ -247,7 +247,9 @@ struct pollfd {
#define mg_rename(x, y) rename(x, y)
#define mg_sleep(x) usleep((x) * 1000)
#define ERRNO errno
+#ifndef INVALID_SOCKET
#define INVALID_SOCKET (-1)
+#endif
/* ntop */
#if ((ULONG_MAX) == (UINT_MAX))
@@ -270,7 +272,9 @@ struct pollfd {
#endif
//#define INT64_FMT PRId64
+#ifndef SOCKET
typedef int SOCKET;
+#endif
#define WINCDECL
#endif // End of Windows and UNIX specific includes

View file

@ -1,62 +1,46 @@
{ lib, stdenv, fetchurl, libpcap,/* gnutls, libgcrypt,*/ libxml2, glib
, geoip, geolite-legacy, sqlite, which, autoreconfHook, git
, pkg-config, groff, curl, json_c, luajit, zeromq, rrdtool
{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, bash, autoreconfHook
, zeromq, ndpi, json_c, openssl, libpcap, libcap, curl, libmaxminddb
, rrdtool, sqlite, libmysqlclient, expat, net-snmp
}:
# ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/
# directory, but we use luajit, zeromq, and rrdtool from nixpkgs
stdenv.mkDerivation rec {
pname = "ntopng";
version = "2.0";
version = "5.2.1";
src = fetchurl {
urls = [
"mirror://sourceforge/project/ntop/ntopng/old/ntopng-${version}.tar.gz"
"mirror://sourceforge/project/ntop/ntopng/ntopng-${version}.tar.gz"
];
sha256 = "0l82ivh05cmmqcvs26r6y69z849d28njipphqzvnakf43ggddgrw";
src = fetchFromGitHub {
owner = "ntop";
repo = "ntopng";
rev = version;
sha256 = "sha256-FeRERSq8F3HEelUCkA6pgNNcP94xrWy6EbJgk+cEdqc=";
};
patches = [
./0001-Undo-weird-modification-of-data_dir.patch
./0002-Remove-requirement-to-have-writeable-callback-dir.patch
./0003-New-libpcap-defines-SOCKET.patch
(fetchpatch {
url = "https://github.com/ntop/ntopng/commit/0aa580e1a45f248fffe6d11729ce40571f08e187.patch";
sha256 = "sha256-xqEVwfGgkNS+akbJnLZsVvEQdp9GxxUen8VkFomtcPI=";
})
];
buildInputs = [ libpcap/* gnutls libgcrypt*/ libxml2 glib geoip geolite-legacy
sqlite which autoreconfHook git pkg-config groff curl json_c luajit zeromq
rrdtool ];
nativeBuildInputs = [ bash autoreconfHook pkg-config ];
buildInputs = [
zeromq ndpi json_c openssl libpcap curl libmaxminddb rrdtool sqlite
libmysqlclient expat net-snmp libcap
];
autoreconfPhase = ''
substituteInPlace autogen.sh --replace "/bin/rm" "rm"
substituteInPlace nDPI/autogen.sh --replace "/bin/rm" "rm"
$shell autogen.sh
'';
autoreconfPhase = "bash autogen.sh";
preConfigure = ''
substituteInPlace Makefile.in --replace "/bin/rm" "rm"
'';
preBuild = ''
substituteInPlace src/Ntop.cpp --replace "/usr/local" "$out"
sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \
-e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \
-e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \
-e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \
-e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \
sed -e "s|\(#define CONST_BIN_DIR \).*|\1\"$out/bin\"|g" \
-e "s|\(#define CONST_SHARE_DIR \).*|\1\"$out/share\"|g" \
-i include/ntop_defines.h
rm -rf httpdocs/geoip
ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip
'' + lib.optionalString stdenv.isDarwin ''
sed 's|LIBS += -lstdc++.6||' -i Makefile
'';
NIX_CFLAGS_COMPILE = "-fpermissive"
+ lib.optionalString stdenv.cc.isClang " -Wno-error=reserved-user-defined-literal";
enableParallelBuilding = true;
meta = with lib; {
description = "High-speed web-based traffic analysis and flow collection tool";