diff options
author | Steven Barth <cyrus@openwrt.org> | 2014-10-02 19:15:38 +0000 |
---|---|---|
committer | Steven Barth <cyrus@openwrt.org> | 2014-10-02 19:15:38 +0000 |
commit | def69a96e91d70ea3721776c6e9355db3cc31da7 (patch) | |
tree | fcdd283372a6d276b5d62f8220bf11906991e3fd /package/network/ipv6/map/files/map.sh | |
parent | 2fa8a656a690063e6a2f0ed4f7bcaab5e2edc073 (diff) | |
download | upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.tar.gz upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.tar.bz2 upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.zip |
map: fix portsets starting with 0 and use regular NAT for 1:1 MAP
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 42741
Diffstat (limited to 'package/network/ipv6/map/files/map.sh')
-rwxr-xr-x | package/network/ipv6/map/files/map.sh | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/package/network/ipv6/map/files/map.sh b/package/network/ipv6/map/files/map.sh index fceeb8a641..83de4cc4dc 100755 --- a/package/network/ipv6/map/files/map.sh +++ b/package/network/ipv6/map/files/map.sh @@ -122,19 +122,28 @@ proto_map_setup() { [ "$zone" != "-" ] && json_add_string zone "$zone" json_add_array firewall - for portset in $(eval "echo \$RULE_${k}_PORTSETS"); do - for proto in icmp tcp udp; do - json_add_object "" - json_add_string type nat - json_add_string target SNAT - json_add_string family inet - json_add_string proto "$proto" - json_add_boolean connlimit_ports 1 - json_add_string snat_ip $(eval "echo \$RULE_${k}_IPV4ADDR") - json_add_string snat_port "$portset" - json_close_object - done - done + if [ -z "$(eval "echo \$RULE_${k}_PORTSETS")" ]; then + json_add_object "" + json_add_string type nat + json_add_string target SNAT + json_add_string family inet + json_add_string snat_ip $(eval "echo \$RULE_${k}_IPV4ADDR") + json_close_object + else + for portset in $(eval "echo \$RULE_${k}_PORTSETS"); do + for proto in icmp tcp udp; do + json_add_object "" + json_add_string type nat + json_add_string target SNAT + json_add_string family inet + json_add_string proto "$proto" + json_add_boolean connlimit_ports 1 + json_add_string snat_ip $(eval "echo \$RULE_${k}_IPV4ADDR") + json_add_string snat_port "$portset" + json_close_object + done + done + fi if [ "$type" = "map-t" ]; then json_add_object "" json_add_string type rule |