diff options
author | JeffWDH <JeffWDH@users.noreply.github.com> | 2023-09-29 04:13:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 04:13:17 -0400 |
commit | 5180622cd6c928812a644f427d65acae763c37cc (patch) | |
tree | 9add03e89b421c58c1fd1357872cb996c1875f02 /src/op_mode | |
parent | 400df973d3518e9f18cb84b52ca89e08a399e461 (diff) | |
download | vyos-1x-5180622cd6c928812a644f427d65acae763c37cc.tar.gz vyos-1x-5180622cd6c928812a644f427d65acae763c37cc.zip |
T5497: Add ability to resequence rule numbers for firewall
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/generate_firewall_rule-resequence.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/op_mode/generate_firewall_rule-resequence.py b/src/op_mode/generate_firewall_rule-resequence.py index b5b625a80..4362b484a 100755 --- a/src/op_mode/generate_firewall_rule-resequence.py +++ b/src/op_mode/generate_firewall_rule-resequence.py @@ -116,9 +116,18 @@ if __name__ == "__main__": print('Firewall is not configured') exit(1) - #config_dict = config.get_config_dict('firewall') config_dict = config.get_config_dict('firewall') + # Remove global-options, group and flowtable as they don't need sequencing + if 'global-options' in config_dict['firewall']: + del config_dict['firewall']['global-options'] + + if 'group' in config_dict['firewall']: + del config_dict['firewall']['group'] + + if 'flowtable' in config_dict['firewall']: + del config_dict['firewall']['flowtable'] + # Convert rule keys to integers, rule "10" -> rule 10 # This is necessary for sorting the rules config_dict = convert_rule_keys_to_int(config_dict) |