kernel: add md5sum of kernel
[openwrt.git] / package / firewall / files / lib / core_rule.sh
index dbaf110..8c234a3 100644 (file)
@@ -36,16 +36,15 @@ fw_load_rule() {
 
        local table=f
        local chain=input
 
        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"
                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
 
        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
 
        local mode
        fw_get_family_mode mode ${rule_family:-x} $rule_src I
 
@@ -53,11 +52,11 @@ fw_load_rule() {
        fw_get_negation src_spec '-s' "${rule_src_ip:+$rule_src_ip/$rule_src_ip_prefixlen}"
        fw_get_negation dest_spec '-d' "${rule_dest_ip:+$rule_dest_ip/$rule_dest_ip_prefixlen}"
 
        fw_get_negation src_spec '-s' "${rule_src_ip:+$rule_src_ip/$rule_src_ip_prefixlen}"
        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'))'
-
        [ "$rule_proto" == "tcpudp" ] && rule_proto="tcp udp"
        for rule_proto in $rule_proto; do
        [ "$rule_proto" == "tcpudp" ] && rule_proto="tcp udp"
        for rule_proto in $rule_proto; do
+               local rule_pos
+               eval 'rule_pos=$((++FW__RULE_COUNT_'${mode#G}'_'$chain'))'
+
                fw add $mode $table $chain $target $rule_pos { $rule_src_ip $rule_dest_ip } { \
                        $src_spec $dest_spec \
                        ${rule_proto:+-p $rule_proto} \
                fw add $mode $table $chain $target $rule_pos { $rule_src_ip $rule_dest_ip } { \
                        $src_spec $dest_spec \
                        ${rule_proto:+-p $rule_proto} \
This page took 0.023355 seconds and 4 git commands to generate.