summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2023-08-23 13:00:27 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2023-08-23 13:00:27 +0000
commitf0ae034faa74a90ee3c98d31bfd8df2ae0513c7f (patch)
tree0db2f209030e14edcde49c991f55f93d34ad7b62 /python
parent8c7fbec24f8bfe064d8ad804951f5ae59b54748f (diff)
downloadvyos-1x-f0ae034faa74a90ee3c98d31bfd8df2ae0513c7f.tar.gz
vyos-1x-f0ae034faa74a90ee3c98d31bfd8df2ae0513c7f.zip
T5472: nat redirect: allow redirection without defining redirected port
Diffstat (limited to 'python')
-rw-r--r--python/vyos/nat.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/nat.py b/python/vyos/nat.py
index b6702f7e2..9cbc2b96e 100644
--- a/python/vyos/nat.py
+++ b/python/vyos/nat.py
@@ -56,10 +56,13 @@ def parse_nat_rule(rule_conf, rule_id, nat_type, ipv6=False):
elif 'translation' in rule_conf:
addr = dict_search_args(rule_conf, 'translation', 'address')
port = dict_search_args(rule_conf, 'translation', 'port')
- redirect_port = dict_search_args(rule_conf, 'translation', 'redirect', 'port')
- if redirect_port:
- translation_output = [f'redirect to {redirect_port}']
+ if 'redirect' in rule_conf['translation']:
+ translation_output = [f'redirect']
+ redirect_port = dict_search_args(rule_conf, 'translation', 'redirect', 'port')
+ if redirect_port:
+ translation_output.append(f'to {redirect_port}')
else:
+
translation_prefix = nat_type[:1]
translation_output = [f'{translation_prefix}nat']