summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-07-26 19:23:30 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-07-26 19:23:30 +0000
commit948e55af1f59b99f98d807a142ed5b77c2680e2a (patch)
treebbb0e8be26e0209b7e27b7a3c3e59170987f77cb
parent8bbaafd554d003078607121e2de662c9c8edee40 (diff)
downloadvyos-1x-948e55af1f59b99f98d807a142ed5b77c2680e2a.tar.gz
vyos-1x-948e55af1f59b99f98d807a142ed5b77c2680e2a.zip
nat: T4531: Fix op-mode NAT rules add default values
Add default values for the function _get_formatted_output_rules For variables: sport, dport, proto, saddr, daddr As in parser and loop those values or some of them may not occur
-rwxr-xr-xsrc/op_mode/nat.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/op_mode/nat.py b/src/op_mode/nat.py
index f3f79f863..666c72c7c 100755
--- a/src/op_mode/nat.py
+++ b/src/op_mode/nat.py
@@ -52,6 +52,9 @@ def _get_raw_data_rules(direction):
def _get_formatted_output_rules(data, direction):
+ # Add default values before loop
+ sport, dport, proto = 'any', 'any', 'any'
+ saddr, daddr = '0.0.0.0/0', '0.0.0.0/0'
data_entries = []
for rule in data:
if 'comment' in rule['rule']: