netifyd: update to 3.07

Signed-off-by: Darryl Sokoloski <darryl@sokoloski.ca>
This commit is contained in:
Darryl Sokoloski 2021-05-21 19:51:10 -04:00 committed by Kevin Darbyshire-Bryant
parent f51ef46aa6
commit d886127370
4 changed files with 92 additions and 40 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifyd
PKG_RELEASE:=3
PKG_RELEASE:=1
PKG_MAINTAINER:=Darryl Sokoloski <darryl@egloo.ca>
PKG_LICENSE:=GPL-3.0-or-later
@ -16,10 +16,10 @@ PKG_INSTALL:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.com/netify.ai/public/netify-agent.git
PKG_SOURCE_DATE:=2020-09-15
PKG_SOURCE_VERSION:=v3.05
#PKG_SOURCE_VERSION:=09fa5fb202ba95ee2d73a4eb0fefe9265d15c780
PKG_MIRROR_HASH:=2bcaa54f1660a30070f0c79a79259e96f169a9c7a0fe4a1195bb74f7de184204
PKG_SOURCE_DATE:=2021-05-19
PKG_SOURCE_VERSION:=v3.07
#PKG_SOURCE_VERSION:=a22c66b9d916347b34f6d26de2a95c94f446401b
PKG_MIRROR_HASH:=de6c4ce7bb00ec72478a7eeaa44b1a30d2ef64202f8524a000bce6015441a5ca
include $(INCLUDE_DIR)/package.mk
@ -80,6 +80,13 @@ endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/netifyd
$(CP) $(PKG_INSTALL_DIR)/usr/include/netifyd/*.h $(1)/usr/include/netifyd
$(INSTALL_DIR) $(1)/usr/include/netifyd/pcap-compat
$(CP) $(PKG_INSTALL_DIR)/usr/include/netifyd/pcap-compat/*.h $(1)/usr/include/netifyd/pcap-compat
$(INSTALL_DIR) $(1)/usr/include/netifyd/nlohmann
$(CP) $(PKG_INSTALL_DIR)/usr/include/netifyd/nlohmann/*.hpp $(1)/usr/include/netifyd/nlohmann
$(INSTALL_DIR) $(1)/usr/include/libndpi-2.9.0
$(INSTALL_DIR) $(1)/usr/include/libndpi-2.9.0/libndpi
$(CP) $(PKG_INSTALL_DIR)/usr/include/libndpi-2.9.0/libndpi/*.h $(1)/usr/include/libndpi-2.9.0/libndpi
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetifyd.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig

View File

@ -1,6 +1,18 @@
config netifyd
option enabled 1
# Enable auto-configuration for interfaces (internal/external)
option autoconfig 1
# option internal_if 'eth0'
# option external_if 'eth1'
# option filter 'not (udp and dst 239.255.255.250 and dst port 1900 and src 192.168.1.5)'
# Supplementary options, ex: disable connection tracking thread (-t)
#list options '-t'
#list options '--thread-detection-cores=2'
# Manual configuration of internal interfaces and options
#list internal_if 'br-lan -F "not (udp and dst 239.255.255.250 and dst port 1900)"'
#list internal_if 'eth0 -A 192.168.1.1/24'
# Manual configuration of external interfaces and options
#list external_if 'eth1'
#list external_if 'ppp0 -N eth2'

View File

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2016-2019 eGloo, Incorporated
# Copyright (C) 2016-2021 eGloo, Incorporated
#
# This is free software, licensed under the GNU General Public License v2.
@ -10,40 +10,84 @@ STOP=50
USE_PROCD=1
PROG=/usr/sbin/netifyd
function append_params() {
procd_append_param command $@
}
function append_ifopts() {
local filter=0
local filter_expr=
for a in $1; do
case $a in
-F|--device-filter)
filter=1
procd_append_param command $a
;;
-*)
if [ $filter -gt 0 ]; then
procd_append_param command "${filter_expr#\ }"
filter=0; filter_expr=
fi
procd_append_param command $a
;;
*)
if [ $filter -gt 0 ]; then
a=${a#\"}; a=${a%\"}; a=${a#\'}; a=${a%\'}
filter_expr="$filter_expr $a"
else
procd_append_param command $a
fi
esac
done
if [ $filter -gt 0 ]; then
procd_append_param command "${filter_expr#\ }"
fi
}
function append_internal_if() {
append_ifopts "-I $@"
}
function append_external_if() {
append_ifopts "-E $@"
}
start_netifyd() {
local instance enabled autoconfig internal_if external_if
local autoconfig enabled instance
instance="$1"
config_get_bool enabled "$instance" enabled 0
[ "$enabled" -eq 0 ] && return 0
[ ! -d /var/run/netifyd ] && mkdir -p /var/run/netifyd
config_get_bool autoconfig "$instance" autoconfig 1
config_get filter "$instance" filter
if [ "$autoconfig" -gt 0 ] ; then
source /usr/share/netifyd/functions.sh
load_modules
NETIFYD_AUTODETECT=yes
NETIFYD_OPTS=$(auto_detect_options)
else
config_get internal_if "$instance" internal_if "eth0"
config_get external_if "$instance" external_if "eth1"
NETIFYD_OPTS="-E $external_if -I $internal_if"
fi
source /usr/share/netifyd/functions.sh
load_modules
procd_open_instance
procd_set_param command $PROG -R $NETIFYD_OPTS
[ -n "$filter" ] && procd_append_param command -F "$filter"
procd_set_param file /etc/netifyd.conf
procd_set_param term_timeout 20
procd_set_param respawn
procd_set_param command $PROG -R
config_list_foreach "$instance" options append_params
config_get_bool autoconfig "$instance" autoconfig 1
if [ "$autoconfig" -gt 0 ]; then
NETIFYD_AUTODETECT=yes
procd_append_param command "$(auto_detect_options)"
fi
config_list_foreach "$instance" internal_if append_internal_if
config_list_foreach "$instance" external_if append_external_if
procd_close_instance
}
start_service() {
[ ! -d /var/run/netifyd ] && mkdir -p /var/run/netifyd
config_load netifyd
config_foreach start_netifyd netifyd
}

View File

@ -1,11 +0,0 @@
--- a/src/netifyd.cpp
+++ b/src/netifyd.cpp
@@ -144,7 +144,7 @@ static void nd_usage(int rc = 0, bool ve
{
fprintf(stderr, "%s\n", nd_get_version_and_features().c_str());
fprintf(stderr, "Copyright (C) 2015-2020 eGloo Incorporated\n"
- "[%s %s]\n", GIT_RELEASE, GIT_DATE);
+ "[%s]\n", PACKAGE_VERSION);
if (version) {
fprintf(stderr, "\nThis application uses nDPI v%s\n"
"http://www.ntop.org/products/deep-packet-inspection/ndpi/\n", ndpi_revision());