summaryrefslogtreecommitdiff
path: root/data/templates/firewall/nftables-nat66.j2
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-08-03 12:58:24 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-08-03 12:58:24 +0000
commitecc03bd6e499bfa071218aa70d325fcfcc191dec (patch)
tree5c12722c49f1a3d9914e1364f79315107631c3fb /data/templates/firewall/nftables-nat66.j2
parent08699a10ccea1ea428b856d7b3dd7644d66ea699 (diff)
downloadvyos-1x-ecc03bd6e499bfa071218aa70d325fcfcc191dec.tar.gz
vyos-1x-ecc03bd6e499bfa071218aa70d325fcfcc191dec.zip
nat66: T4586: Add SNAT destination prefix and DNAT address
Ability to configure SNAT destination prefix and DNAT source address Add option "!" - not address/prefix for NAT66
Diffstat (limited to 'data/templates/firewall/nftables-nat66.j2')
-rw-r--r--data/templates/firewall/nftables-nat66.j212
1 files changed, 10 insertions, 2 deletions
diff --git a/data/templates/firewall/nftables-nat66.j2 b/data/templates/firewall/nftables-nat66.j2
index 003b138b2..ca19506f2 100644
--- a/data/templates/firewall/nftables-nat66.j2
+++ b/data/templates/firewall/nftables-nat66.j2
@@ -3,8 +3,10 @@
{% macro nptv6_rule(rule,config, chain) %}
{% set comment = '' %}
{% set base_log = '' %}
-{% set src_prefix = 'ip6 saddr ' ~ config.source.prefix if config.source.prefix is vyos_defined %}
-{% set dest_address = 'ip6 daddr ' ~ config.destination.address if config.destination.address is vyos_defined %}
+{% set dst_prefix = 'ip6 daddr ' ~ config.destination.prefix.replace('!','!= ') if config.destination.prefix is vyos_defined %}
+{% set src_prefix = 'ip6 saddr ' ~ config.source.prefix.replace('!','!= ') if config.source.prefix is vyos_defined %}
+{% set source_address = 'ip6 saddr ' ~ config.source.address.replace('!','!= ') if config.source.address is vyos_defined %}
+{% set dest_address = 'ip6 daddr ' ~ config.destination.address.replace('!','!= ') if config.destination.address is vyos_defined %}
{% if chain is vyos_defined('PREROUTING') %}
{% set comment = 'DST-NAT66-' ~ rule %}
{% set base_log = '[NAT66-DST-' ~ rule %}
@@ -52,6 +54,12 @@
{% if src_prefix is vyos_defined %}
{% set output = output ~ ' ' ~ src_prefix %}
{% endif %}
+{% if dst_prefix is vyos_defined %}
+{% set output = output ~ ' ' ~ dst_prefix %}
+{% endif %}
+{% if source_address is vyos_defined %}
+{% set output = output ~ ' ' ~ source_address %}
+{% endif %}
{% if dest_address is vyos_defined %}
{% set output = output ~ ' ' ~ dest_address %}
{% endif %}