X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/1efeaa35d1f86cc6e962180db9e90fc7f1698061..cbe52027620c51cb36475fb042069862a35c95c3:/package/firewall/files/lib/core_rule.sh diff --git a/package/firewall/files/lib/core_rule.sh b/package/firewall/files/lib/core_rule.sh index dbaf1102e..9443eef8c 100644 --- a/package/firewall/files/lib/core_rule.sh +++ b/package/firewall/files/lib/core_rule.sh @@ -36,16 +36,15 @@ fw_load_rule() { local table=f local chain=input - if [ "$rule_target" == "NOTRACK" ]; then + local target="${rule_target:-REJECT}" + if [ "$target" == "NOTRACK" ]; then table=r chain="zone_${rule_src}_notrack" - elif [ -n "$rule_src" ]; then - chain="zone_${rule_src}${rule_dest:+_forward}" + else + [ -n "$rule_src" ] && chain="zone_${rule_src}${rule_dest:+_forward}" + [ -n "$rule_dest" ] && target="zone_${rule_dest}_${target}" fi - local target="${rule_target:-REJECT}" - [ -n "$dest" ] && target="zone_${rule_dest}_${target}" - local mode fw_get_family_mode mode ${rule_family:-x} $rule_src I @@ -54,7 +53,7 @@ fw_load_rule() { fw_get_negation dest_spec '-d' "${rule_dest_ip:+$rule_dest_ip/$rule_dest_ip_prefixlen}" local rule_pos - eval 'rule_pos=$((++FW__RULE_COUNT_'$mode'_'$chain'))' + eval 'rule_pos=$((++FW__RULE_COUNT_'${mode#G}'_'$chain'))' [ "$rule_proto" == "tcpudp" ] && rule_proto="tcp udp" for rule_proto in $rule_proto; do