aboutsummaryrefslogtreecommitdiffstats
path: root/package/firewall/files/lib
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-08 12:11:55 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-08 12:11:55 +0000
commita43f5b5038a93c52b5d45bcbcff78adb6410c43c (patch)
tree475cdbadf7ca6b211e2c5a36adfbacce400f0b73 /package/firewall/files/lib
parent458e8736fc0646f892b77f50e80a24579058bb71 (diff)
downloadupstream-a43f5b5038a93c52b5d45bcbcff78adb6410c43c.tar.gz
upstream-a43f5b5038a93c52b5d45bcbcff78adb6410c43c.tar.bz2
upstream-a43f5b5038a93c52b5d45bcbcff78adb6410c43c.zip
firewall: insert SNAT and DNAT rules according to the order of the configuration file (#8052)
SVN-Revision: 23318
Diffstat (limited to 'package/firewall/files/lib')
-rw-r--r--package/firewall/files/lib/core_redirect.sh5
-rw-r--r--package/firewall/files/lib/core_rule.sh2
2 files changed, 5 insertions, 2 deletions
diff --git a/package/firewall/files/lib/core_redirect.sh b/package/firewall/files/lib/core_redirect.sh
index 9654e7177c..87941a2a17 100644
--- a/package/firewall/files/lib/core_redirect.sh
+++ b/package/firewall/files/lib/core_redirect.sh
@@ -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} \
diff --git a/package/firewall/files/lib/core_rule.sh b/package/firewall/files/lib/core_rule.sh
index a0de3ba8bb..9443eef8cf 100644
--- a/package/firewall/files/lib/core_rule.sh
+++ b/package/firewall/files/lib/core_rule.sh
@@ -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