firewall: fix wrong rule order if multiple protocols are used
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 27 Jan 2011 22:19:53 +0000 (22:19 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 27 Jan 2011 22:19:53 +0000 (22:19 +0000)
SVN-Revision: 25179

package/firewall/Makefile
package/firewall/files/lib/core_rule.sh

index 1b6ec880994b474a1d922a90702776032b1f33d8..4a8a5d3199f7628562d7346368232854ec4f2e35 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=firewall
 
 PKG_VERSION:=2
-PKG_RELEASE:=20
+PKG_RELEASE:=21
 
 include $(INCLUDE_DIR)/package.mk
 
index 9443eef8cfe654bb53ad6cf58dea9309501154aa..8c234a33a13e9e6a9984521be34516492674a314 100644 (file)
@@ -52,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}"
 
-       local rule_pos
-       eval 'rule_pos=$((++FW__RULE_COUNT_'${mode#G}'_'$chain'))'
-
        [ "$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} \