vpn-policy-routing: update config file, support PROCD_RELOAD_DELAY
authorStan Grishin <stangri@melmac.net>
Tue, 23 Feb 2021 01:12:17 +0000 (01:12 +0000)
committerStan Grishin <stangri@melmac.net>
Tue, 23 Feb 2021 01:12:17 +0000 (01:12 +0000)
Signed-off-by: Stan Grishin <stangri@melmac.net>
net/vpn-policy-routing/Makefile
net/vpn-policy-routing/files/vpn-policy-routing.conf
net/vpn-policy-routing/files/vpn-policy-routing.init

index 3fc0f17279dfb7d3a7670733bc5d4bf6205f023a..5f86ae9dacc60012548082f575402cf7a8ef8ad4 100644 (file)
@@ -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 <stangri@melmac.net>
 
index ec0f773356106bc60c4142e8d43a9c2185d19827..ed6f01cdd4469c3c460adf8cca117e17cae53255 100644 (file)
@@ -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'
index 56e2c532315a54ac69d2135f52673a09829775d7..0f9cb479ea7f700ab6433f8372485208ed510175 100755 (executable)
@@ -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