mirror of
				https://github.com/optim-enterprises-bv/nDPId.git
				synced 2025-10-30 01:42:22 +00:00 
			
		
		
		
	OpenWrt UCI/Initscript
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
							
								
								
									
										31
									
								
								packages/openwrt/net/nDPId-testing/nDPId-testing.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								packages/openwrt/net/nDPId-testing/nDPId-testing.config
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
							
								
								
									
										85
									
								
								packages/openwrt/net/nDPId-testing/nDPId-testing.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								packages/openwrt/net/nDPId-testing/nDPId-testing.init
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Toni Uhlig
					Toni Uhlig