firewall: insert SNAT and DNAT rules according to the order of the configuration file (#8052)
SVN-Revision: 23318
This commit is contained in:
parent
458e8736fc
commit
a43f5b5038
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=firewall
|
PKG_NAME:=firewall
|
||||||
|
|
||||||
PKG_VERSION:=2
|
PKG_VERSION:=2
|
||||||
PKG_RELEASE:=19
|
PKG_RELEASE:=20
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,10 @@ fw_load_redirect() {
|
||||||
|
|
||||||
[ "$redirect_proto" == "tcpudp" ] && redirect_proto="tcp udp"
|
[ "$redirect_proto" == "tcpudp" ] && redirect_proto="tcp udp"
|
||||||
for redirect_proto in $redirect_proto; do
|
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 \
|
$srcaddr $srcdaddr \
|
||||||
${redirect_proto:+-p $redirect_proto} \
|
${redirect_proto:+-p $redirect_proto} \
|
||||||
${srcports:+--sport $srcports} \
|
${srcports:+--sport $srcports} \
|
||||||
|
|
|
@ -53,7 +53,7 @@ fw_load_rule() {
|
||||||
fw_get_negation dest_spec '-d' "${rule_dest_ip:+$rule_dest_ip/$rule_dest_ip_prefixlen}"
|
fw_get_negation dest_spec '-d' "${rule_dest_ip:+$rule_dest_ip/$rule_dest_ip_prefixlen}"
|
||||||
|
|
||||||
local rule_pos
|
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"
|
[ "$rule_proto" == "tcpudp" ] && rule_proto="tcp udp"
|
||||||
for rule_proto in $rule_proto; do
|
for rule_proto in $rule_proto; do
|
||||||
|
|
Loading…
Reference in New Issue