diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-07-16 06:03:15 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-07-16 06:03:15 +0000 |
commit | 5d550758f0fedd784517e6a9057ddd9e4e7d93bf (patch) | |
tree | 698c98d72bc35de39515e1f96edd92ac1d1f82c6 /package/firewall/files/lib | |
parent | d5e9eb69715f97c4c5dda4dc5da4c5839ebf152a (diff) | |
download | upstream-5d550758f0fedd784517e6a9057ddd9e4e7d93bf.tar.gz upstream-5d550758f0fedd784517e6a9057ddd9e4e7d93bf.tar.bz2 upstream-5d550758f0fedd784517e6a9057ddd9e4e7d93bf.zip |
[package] firewall: allow redirecting only destination port (#7197)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22227 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/firewall/files/lib')
-rw-r--r-- | package/firewall/files/lib/core_redirect.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/package/firewall/files/lib/core_redirect.sh b/package/firewall/files/lib/core_redirect.sh index b51f79390a..15d01b0a75 100644 --- a/package/firewall/files/lib/core_redirect.sh +++ b/package/firewall/files/lib/core_redirect.sh @@ -26,8 +26,8 @@ fw_load_redirect() { fw_callback pre redirect - [ -n "$redirect_src" -a -n "$redirect_dest_ip" ] || { - fw_die "redirect ${redirect_name}: needs src and dest_ip" + [ -n "$redirect_src" -a -n "$redirect_dest_ip$redirect_dest_port" ] || { + fw_die "redirect ${redirect_name}: needs src and dest_ip or dest_port" } list_contains FW_CONNTRACK_ZONES $redirect_src || \ @@ -53,6 +53,7 @@ fw_load_redirect() { --to-destination ${redirect_dest_ip}${redirect_dest_port:+:$nat_dest_port} \ } + [ -n "$redirect_dest_ip" ] && \ fw add $mode f zone_${redirect_src}_forward ACCEPT ^ { $redirect_src_ip $redirect_dest_ip } { \ -d $redirect_dest_ip \ ${redirect_proto:+-p $redirect_proto} \ |