firewall: insert SNAT and DNAT rules according to the order of the configuration...
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 8 Oct 2010 12:11:55 +0000 (12:11 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 8 Oct 2010 12:11:55 +0000 (12:11 +0000)
SVN-Revision: 23318

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

index 389c2dff87a806c78738e821f0f9b80839ec366e..1b6ec880994b474a1d922a90702776032b1f33d8 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=firewall
 
 PKG_VERSION:=2
-PKG_RELEASE:=19
+PKG_RELEASE:=20
 
 include $(INCLUDE_DIR)/package.mk
 
index 9654e7177c58e12b9a96560fe6284c06d299a9b5..87941a2a174d3425a5acb49eb076657ce90da6d5 100644 (file)
@@ -88,7 +88,10 @@ fw_load_redirect() {
 
        [ "$redirect_proto" == "tcpudp" ] && redirect_proto="tcp udp"
        for redirect_proto in $redirect_proto; do
-               fw add $mode n $natchain $redirect_target ^ { $redirect_src_ip $redirect_dest_ip } { \
+               local pos
+               eval 'pos=$((++FW__REDIR_COUNT_'${mode#G}'_'$natchain'))'
+
+               fw add $mode n $natchain $redirect_target $pos { $redirect_src_ip $redirect_dest_ip } { \
                        $srcaddr $srcdaddr \
                        ${redirect_proto:+-p $redirect_proto} \
                        ${srcports:+--sport $srcports} \
index a0de3ba8bb5da4ef7919bdf540cacc5fd9ede86e..9443eef8cfe654bb53ad6cf58dea9309501154aa 100644 (file)
@@ -53,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