summaryrefslogtreecommitdiff
path: root/data/templates/firewall
diff options
context:
space:
mode:
authorjack9603301 <jack9603301@163.com>2021-03-09 00:39:20 +0800
committerjack9603301 <jack9603301@163.com>2021-03-09 02:01:41 +0800
commit4c8d882e9125fb45977f74a217e9d716138d6291 (patch)
tree40fb85fb3b4cf1cc1cc812bb529e653ea6418a5b /data/templates/firewall
parent87bbe75152e3e0625776587c1fd4cd7104319fe1 (diff)
downloadvyos-1x-4c8d882e9125fb45977f74a217e9d716138d6291.tar.gz
vyos-1x-4c8d882e9125fb45977f74a217e9d716138d6291.zip
nptv6: T2518: Support IPv6 address translation
Diffstat (limited to 'data/templates/firewall')
-rw-r--r--data/templates/firewall/nftables-nat66.tmpl11
1 files changed, 7 insertions, 4 deletions
diff --git a/data/templates/firewall/nftables-nat66.tmpl b/data/templates/firewall/nftables-nat66.tmpl
index b1a8f7a16..9f5d49ba7 100644
--- a/data/templates/firewall/nftables-nat66.tmpl
+++ b/data/templates/firewall/nftables-nat66.tmpl
@@ -13,8 +13,14 @@
{% endif %}
{% set trns_address = dnat_type + config.translation.address if config.translation is defined and config.translation.address is defined and config.translation.address is not none %}
{% elif chain == "POSTROUTING" %}
+{% if config.translation.address | is_ip_network %}
+{# support 1:1 network translation #}
+{% set snat_type = "snat prefix to " %}
+{% else %}
+{% set snat_type = "snat to " %}
+{% endif %}
{% set interface = " oifname \"" + config.outbound_interface + "\"" if config.outbound_interface is defined else '' %}
-{% set trns_prefix = "snat prefix to " + config.translation.prefix if config.translation is defined and config.translation.prefix is defined and config.translation.prefix is not none %}
+{% set trns_address = snat_type + config.translation.address if config.translation is defined and config.translation.address is defined and config.translation.address is not none %}
{% endif %}
{% set comment = "NPT-NAT-" + rule %}
{% if rule.log %}
@@ -35,9 +41,6 @@
{% if dest_address %}
{% set output = output + " " + dest_address %}
{% endif %}
-{% if trns_prefix %}
-{% set output = output + " " + trns_prefix %}
-{% endif %}
{% if trns_address %}
{% set output = output + " " + trns_address %}
{% endif %}