From 948e55af1f59b99f98d807a142ed5b77c2680e2a Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 26 Jul 2022 19:23:30 +0000 Subject: 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 --- src/op_mode/nat.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/op_mode/nat.py') 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']: -- cgit v1.2.3