diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-10-03 15:22:28 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-10-03 15:57:16 +0200 |
commit | be3f466373645e900c71285dffd153e37455c7e7 (patch) | |
tree | 0f73c5bf40c430c57a85112ccb76a9ce8c7dc8a2 /packages | |
parent | b7d8564b6542f57812e243f2d86e7e45feb7ad58 (diff) |
OpenWrt UCI/Initscript
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/openwrt/net/nDPId-testing/Makefile | 5 | ||||
-rw-r--r-- | packages/openwrt/net/nDPId-testing/nDPId-testing.config | 31 | ||||
-rw-r--r-- | packages/openwrt/net/nDPId-testing/nDPId-testing.init | 85 |
3 files changed, 121 insertions, 0 deletions
diff --git a/packages/openwrt/net/nDPId-testing/Makefile b/packages/openwrt/net/nDPId-testing/Makefile index 075c161b7..0841f0d20 100644 --- a/packages/openwrt/net/nDPId-testing/Makefile +++ b/packages/openwrt/net/nDPId-testing/Makefile @@ -107,6 +107,11 @@ define Package/nDPId-testing/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nDPIsrvd-collectd $(1)/usr/bin/nDPIsrvd-testing-collectd $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nDPIsrvd-json-dump $(1)/usr/bin/nDPIsrvd-testing-json-dump + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) $(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) + $(call Package/nDPId-testing/install-collectd-files) endef diff --git a/packages/openwrt/net/nDPId-testing/nDPId-testing.config b/packages/openwrt/net/nDPId-testing/nDPId-testing.config new file mode 100644 index 000000000..0cf894bdd --- /dev/null +++ b/packages/openwrt/net/nDPId-testing/nDPId-testing.config @@ -0,0 +1,31 @@ +config nDPId-testing + option enabled 0 + option respawn 0 + # General + #option interface 'br-lan' + #option internal_only 0 + #option external_only 0 + #option bpf_filter 'tcp' + #option proto_file '' + #option cat_file '' + #option ja3_file '' + #option ssl_file '' + #option alias '' + #option analysis 0 + #option compression 0 + # Tuning + #option 'max_flows_per_thread' 2048 + #option 'max_idle_flows_per_thread' 64 + #option 'max_reader_threads' 2 + #option 'daemon_status_interval' 600000000 + #option 'compression_scan_interval' 20000000 + #option 'compression_flow_inactivity' 30000000 + #option 'flow_scan_interval' 10000000 + #option 'generic_max_idle_time' 600000000 + #option 'icmp_max_idle_time' 120000000 + #option 'udp_max_idle_time' 180000000 + #option 'tcp_max_idle_time' 3145032704 + #option 'tcp_max_post_end_flow_time' 120000000 + #option 'max_packets_per_flow_to_send' 15 + #option 'max_packets_per_flow_to_process' 32 + #option 'max_packets_per_flow_to_analyse' 32 diff --git a/packages/openwrt/net/nDPId-testing/nDPId-testing.init b/packages/openwrt/net/nDPId-testing/nDPId-testing.init new file mode 100644 index 000000000..372fb3981 --- /dev/null +++ b/packages/openwrt/net/nDPId-testing/nDPId-testing.init @@ -0,0 +1,85 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=80 + +USE_PROCD=1 + +NDPID_BIN="/usr/sbin/nDPId-testing" + +print_arg_bool() { + local cfg="$1" + local var="$2" + local opt="$3" + local aux + + config_get_bool aux "$cfg" "$var" '0' + if [ $aux -ne 0 ]; then + printf ' %s' "$opt" + fi +} + +print_arg_str() { + local cfg="$1" + local var="$2" + local opt="$3" + local aux + + config_get aux "$cfg" "$var" + if [ ! -z "$aux" ]; then + printf ' %s' "$opt$aux" + fi +} + +start_instance() { + local cfg=$1 + local aux + local args + + config_get_bool aux "$cfg" 'enabled' '0' + #[ "$aux" = 0 ] && return 1 + + # General + args="$(print_arg_str "$cfg" 'interface' '-i')" + args="$args$(print_arg_bool "$cfg" 'internal_only' '-I')" + args="$args$(print_arg_bool "$cfg" 'external_only' '-E')" + args="$args$(print_arg_str "$cfg" 'bpf_filter' '-B')" + args="$args$(print_arg_str "$cfg" 'proto_file' '-P')" + args="$args$(print_arg_str "$cfg" 'cat_file' '-C')" + args="$args$(print_arg_str "$cfg" 'ja3_file' '-J')" + args="$args$(print_arg_str "$cfg" 'ssl_file' '-S')" + args="$args$(print_arg_str "$cfg" 'alias' '-a')" + args="$args$(print_arg_bool "$cfg" 'analysis' '-A')" + args="$args$(print_arg_bool "$cfg" 'compression' '-z')" + + # Tuning + args="$args$(print_arg_str "$cfg" 'max_flows_per_thread' '-omax-flows-per-thread=')" + args="$args$(print_arg_str "$cfg" 'max_idle_flows_per_thread' '-omax-idle-flows-per-thread=')" + args="$args$(print_arg_str "$cfg" 'max_reader_threads' '-omax-reader-threads=')" + args="$args$(print_arg_str "$cfg" 'daemon_status_interval' '-odaemon-status-interval=')" + args="$args$(print_arg_str "$cfg" 'compression_scan_interval' '-ocompression-scan-interval=')" + args="$args$(print_arg_str "$cfg" 'compression_flow_inactivity' '-ocompression-flow-inactivity=')" + args="$args$(print_arg_str "$cfg" 'flow_scan_interval' '-oflow-scan-interval=')" + args="$args$(print_arg_str "$cfg" 'generic_max_idle_time' '-ogeneric-max-idle-time=')" + args="$args$(print_arg_str "$cfg" 'icmp_max_idle_time' '-oicmp-max-idle-time=')" + args="$args$(print_arg_str "$cfg" 'udp_max_idle_time' '-oudp-max-idle-time=')" + args="$args$(print_arg_str "$cfg" 'tcp_max_idle_time' '-otcp-max-idle-time=')" + args="$args$(print_arg_str "$cfg" 'tcp_max_post_end_flow_time' '-otcp-max-post-end-flow-time=')" + args="$args$(print_arg_str "$cfg" 'max_packets_per_flow_to_send' '-omax-packets-per-flow-to-send=')" + args="$args$(print_arg_str "$cfg" 'max_packets_per_flow_to_process' '-omax-packets-per-flow-to-process=')" + args="$args$(print_arg_str "$cfg" 'max_packets_per_flow_to_analyse' '-omax-packets-per-flow-to-analyse=')" + + procd_open_instance + procd_set_param command $NDPID_BIN + procd_append_param command $args + + config_get_bool aux "$cfg" 'respawn' '0' + [ "$aux" = 1 ] && procd_set_param respawn + + procd_close_instance +} + +start_service() { + config_load nDPId-testing + config_foreach start_instance nDPId-testing +} |