aboutsummaryrefslogtreecommitdiffstats
path: root/package/firewall
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
commit7ed5a844a3626e54fbaef6ec8e2c576cdbe4d1a7 (patch)
tree2c9095d2b0f4caafb91bf33916cef59d2b8341f2 /package/firewall
parentff0ca066b820c970c900187d960f89c0506ea9d5 (diff)
downloadupstream-7ed5a844a3626e54fbaef6ec8e2c576cdbe4d1a7.tar.gz
upstream-7ed5a844a3626e54fbaef6ec8e2c576cdbe4d1a7.tar.bz2
upstream-7ed5a844a3626e54fbaef6ec8e2c576cdbe4d1a7.zip
[package] firewall: insert SNAT and DNAT rules according to the order of the configuration file (#8052)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23318 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/firewall')
-rw-r--r--package/firewall/Makefile2
-rw-r--r--package/firewall/files/lib/core_redirect.sh5
-rw-r--r--package/firewall/files/lib/core_rule.sh2
3 files changed, 6 insertions, 3 deletions
diff --git a/package/firewall/Makefile b/package/firewall/Makefile
index 389c2dff87..1b6ec88099 100644
--- a/package/firewall/Makefile
+++ b/package/firewall/Makefile
@@ -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
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