Skip to content

Commit 8dfb5ff

Browse files
committed
validate_config
1 parent 6b80294 commit 8dfb5ff

4 files changed

Lines changed: 26 additions & 1 deletion

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.10.1
1+
2.10.0

etc/init.d/common

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,29 @@ reload_service() {
8686
kill -1 $(cat "$PIDFILE")
8787
}
8888

89+
validate_config() {
90+
if [[ "$NFQWS_ARGS" =~ "--new" ]]; then
91+
echo "Using --new in NFQWS_ARGS is not allowed. Use NFQWS_ARGS_CUSTOM instead"
92+
return 1
93+
fi
94+
if [[ "$NFQWS_ARGS_QUIC" =~ "--new" ]]; then
95+
echo "Using --new in NFQWS_ARGS_QUIC is not allowed. Use NFQWS_ARGS_CUSTOM instead"
96+
return 1
97+
fi
98+
if [[ "$NFQWS_ARGS_UDP" =~ "--new" ]]; then
99+
echo "Using --new in NFQWS_ARGS_UDP is not allowed. Use NFQWS_ARGS_CUSTOM instead"
100+
return 1
101+
fi
102+
if [[ "$NFQWS_EXTRA_ARGS" =~ "--new" ]]; then
103+
echo "Using --new in NFQWS_EXTRA_ARGS is not allowed. Use NFQWS_ARGS_CUSTOM instead"
104+
return 1
105+
fi
106+
if [[ "$NFQWS_ARGS_IPSET" =~ "--new" ]]; then
107+
echo "Using --new in NFQWS_ARGS_IPSET is not allowed. Use NFQWS_ARGS_CUSTOM instead"
108+
return 1
109+
fi
110+
}
111+
89112
create_running_config() {
90113
local MARK=$(/bin/ndmc -c show ip policy 2>&1 | grep -i "description = $POLICY_NAME:" -A 1 | grep 'mark:' | grep -o '[^ ]*$' | head -n 1)
91114
if [ -n "$MARK" ]; then

etc/init.d/entware-end

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ start() {
44
return 1
55
fi
66

7+
validate_config || return 1
78
create_running_config
89
kernel_modules
910

etc/init.d/openwrt-end

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extra_command "firewall_stop" "Unload firewall rules"
1313
extra_command "kernel_modules" "Load kernel modules"
1414

1515
start_service() {
16+
validate_config || return 1
1617
create_running_config
1718
kernel_modules
1819

0 commit comments

Comments
 (0)