From eced9ee66916714db589195b321d9b0e3acf67af Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Tue, 23 Feb 2021 01:12:17 +0000 Subject: [PATCH] vpn-policy-routing: update config file, support PROCD_RELOAD_DELAY Signed-off-by: Stan Grishin --- net/vpn-policy-routing/Makefile | 2 +- .../files/vpn-policy-routing.conf | 4 +- .../files/vpn-policy-routing.init | 39 ++++++++++++------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/net/vpn-policy-routing/Makefile b/net/vpn-policy-routing/Makefile index 3fc0f1727..5f86ae9da 100644 --- a/net/vpn-policy-routing/Makefile +++ b/net/vpn-policy-routing/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=vpn-policy-routing PKG_VERSION:=0.3.2 -PKG_RELEASE:=10 +PKG_RELEASE:=12 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Stan Grishin diff --git a/net/vpn-policy-routing/files/vpn-policy-routing.conf b/net/vpn-policy-routing/files/vpn-policy-routing.conf index ec0f77335..ed6f01cdd 100644 --- a/net/vpn-policy-routing/files/vpn-policy-routing.conf +++ b/net/vpn-policy-routing/files/vpn-policy-routing.conf @@ -6,10 +6,10 @@ config vpn-policy-routing 'config' option dest_ipset '0' option resolver_ipset 'dnsmasq.ipset' option ipv6_enabled '0' - list supported_interface '' - list ignored_interface 'vpnserver wgserver' + list ignored_interface 'vpnserver wgserver' option boot_timeout '30' option iptables_rule_option 'append' + option procd_reload_delay '1' option webui_enable_column '0' option webui_protocol_column '0' option webui_chain_column '0' diff --git a/net/vpn-policy-routing/files/vpn-policy-routing.init b/net/vpn-policy-routing/files/vpn-policy-routing.init index 56e2c5323..0f9cb479e 100755 --- a/net/vpn-policy-routing/files/vpn-policy-routing.init +++ b/net/vpn-policy-routing/files/vpn-policy-routing.init @@ -41,14 +41,15 @@ readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m' readonly _ERROR_='\033[0;31mERROR\033[0m' readonly _WARNING_='\033[0;33mWARNING\033[0m' -# declare gatewaySummary errorSummary warningSummary -# declare serviceEnabled verbosity strictMode -# declare wanTableID wanMark fwMask -# declare ipv6Enabled srcIpset destIpset resolverIpset -# declare wanIface4 wanIface6 ifaceMark ifaceTableID -# declare ifAll ifSupported ignoredIfaces supportedIfaces icmpIface -# declare wanGW4 wanGW6 bootTimeout insertOption -# declare webuiChainColumn webuiShowIgnore dnsmasqIpsetSupported +gatewaySummary=''; errorSummary=''; warningSummary=''; +serviceEnabled=''; verbosity=''; strictMode=''; +wanTableID=''; wanMark=''; fwMask=''; +ipv6Enabled=''; srcIpset=''; destIpset=''; resolverIpset=''; +wanIface4=''; wanIface6=''; ifaceMark=''; ifaceTableID=''; +ifAll=''; ifSupported=''; ignoredIfaces=''; supportedIfaces=''; icmpIface=''; +wanGW4=''; wanGW6=''; bootTimeout=''; insertOption=''; +webuiChainColumn=''; webuiShowIgnore=''; dnsmasqIpsetSupported=''; +procdReloadDelay=''; usedChainsList='PREROUTING' ipsetSupported='true' configLoaded='false' @@ -203,6 +204,7 @@ load_package_config() { config_get supportedIfaces 'config' 'supported_interface' config_get bootTimeout 'config' 'boot_timeout' '30' config_get insertOption 'config' 'iptables_rule_option' 'append' + config_get procdReloadDelay 'config' 'procd_reload_delay' '0' config_get_bool webuiChainColumn 'config' 'webui_chain_column' '0' config_get_bool webuiShowIgnore 'config' 'webui_show_ignore_target' '0' config_foreach append_chains_targets 'policy' @@ -991,6 +993,11 @@ service_triggers() { local n is_enabled || return 1 + if [ "$procdReloadDelay" -gt 0 ] && [ "$procdReloadDelay" -lt 100 ]; then +# shellcheck disable=SC2034 + PROCD_RELOAD_DELAY=$(( procdReloadDelay * 1000 )) + fi + procd_open_validate validate_config validate_policy @@ -1135,25 +1142,27 @@ support() { validate_config() { uci_validate_section "${packageName}" config "${1}" \ 'enabled:bool:0' \ - 'verbosity:range(0,2):1' \ 'strict_enforcement:bool:1' \ + 'ipv6_enabled:bool:0' \ 'src_ipset:bool:0' \ 'dest_ipset:bool:0' \ 'resolver_ipset::or("", "none", "dnsmasq.ipset")' \ - 'ipv6_enabled:bool:0' \ - 'supported_interface:list(string)' \ + 'verbosity:range(0,2):1' \ + 'wan_tid:integer:201' \ + 'wan_fw_mark:hex(8)' \ + 'fw_mask:hex(8)' \ + 'icmp_interface:string' \ 'ignored_interface:list(string)' \ + 'supported_interface:list(string)' \ 'boot_timeout:integer:30' \ 'iptables_rule_option:or("", "append", "insert")' \ + 'procd_reload_delay:integer:0' \ 'webui_enable_column:bool:0' \ 'webui_protocol_column:bool:0' \ 'webui_supported_protocol:list(string)' \ 'webui_chain_column:bool:0' \ 'webui_sorting:bool:1' \ - 'icmp_interface:string' \ - 'wan_tid:integer:201' \ - 'wan_fw_mark:hex(8)' \ - 'fw_mask:hex(8)' + 'webui_show_ignore_target:bool:0' } # shellcheck disable=SC2120