diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-07-30 12:19:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-30 12:19:26 +0200 |
commit | 2f2e8125560a19b51e0034ec88cf69ce1fd1afb5 (patch) | |
tree | 9573c835023421da71ec5fc9601c032bba301295 /src/op_mode/nat.py | |
parent | 2a9a2cfa12e87ae1b300354aeb3bdf7b10059d26 (diff) | |
parent | fa8a09089af3a9062ae4f4f0ebc8c8474d870783 (diff) | |
download | vyos-1x-2f2e8125560a19b51e0034ec88cf69ce1fd1afb5.tar.gz vyos-1x-2f2e8125560a19b51e0034ec88cf69ce1fd1afb5.zip |
Merge pull request #1445 from sever-sever/T4089
nat: T4089: Rewrite show nat destination rules
Diffstat (limited to 'src/op_mode/nat.py')
-rwxr-xr-x | src/op_mode/nat.py | 10 |
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 |