firewall: fix chain selection logic, option dest must be ignored for notrack targets
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 28 Sep 2010 11:38:31 +0000 (11:38 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 28 Sep 2010 11:38:31 +0000 (11:38 +0000)
SVN-Revision: 23143

package/firewall/files/lib/core_rule.sh

index dbaf1102e96c2cc35276c0fab4de142e64f8143c..a0de3ba8bb5da4ef7919bdf540cacc5fd9ede86e 100644 (file)
@@ -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