summaryrefslogtreecommitdiff
path: root/src/op_mode/nat.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/op_mode/nat.py')
-rwxr-xr-xsrc/op_mode/nat.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/op_mode/nat.py b/src/op_mode/nat.py
index 4b54ecf31..a98fc4227 100755
--- a/src/op_mode/nat.py
+++ b/src/op_mode/nat.py
@@ -133,6 +133,16 @@ port {port}'''
translation = f'''{translation}
port {port}'''
+ elif 'dnat' in expr:
+ translation = dict_search('dnat.addr', expr)
+ if expr['dnat'] and 'port' in expr['dnat']:
+ if jmespath.search('dnat.port.range', expr):
+ port = dict_search('dnat.port.range', expr)
+ port = '-'.join(map(str, port))
+ else:
+ port = expr['dnat']['port']
+ translation = f'''{translation}
+port {port}'''
else:
translation = 'exclude'
# Overwrite match loop 'proto' if specified filed 'protocol' exist